Commit 06d67ed4 authored by Adrian Damian's avatar Adrian Damian
Browse files

Added the core authorization classes - code review changes

parent d6c8a952
Loading
Loading
Loading
Loading
+728 B (16.8 KiB)
Loading image diff...
+8 −1
Original line number Diff line number Diff line
@@ -76,7 +76,8 @@ public class Group
     * Ctor.
     * 
     * @param groupID
     *            Unique ID for the group
     *            Unique ID for the group. Must be a valid URI fragment component,
     *            so it's restricted to alphanumeric and "-", ".","_","~" characters.
     * @param owner
     *            Owner/Creator of the group.
     */
@@ -87,6 +88,12 @@ public class Group
        {
            throw new IllegalArgumentException("Null groupID");
        }
        
        // check for invalid path characters in groupID
        if(!groupID.matches("^[a-zA-Z0-9\\-\\.~_]*$"))
            throw new IllegalArgumentException("Invalid group ID " + groupID
                    + ": may not contain space ( ), slash (/), escape (\\), or percent (%)");

        this.groupID = groupID;
        if(owner == null)
        {
+1 −23
Original line number Diff line number Diff line
@@ -140,9 +140,6 @@ public class GroupProperty
        final int prime = 31;
        int result = 1;
        result = prime * result + ((key == null) ? 0 : key.hashCode());
        result = prime * result + (readOnly ? 1231 : 1237);
        result = prime * result
                + ((value == null) ? 0 : value.hashCode());
        return result;
    }

@@ -165,26 +162,7 @@ public class GroupProperty
            return false;
        }
        GroupProperty other = (GroupProperty) obj;
        if (key == null)
        {
            if (other.key != null)
            {
                return false;
            }
        }
        else if (!key.equals(other.key))
        {
            return false;
        }
        if (readOnly != other.readOnly)
        {
            return false;
        }
        if (!value.equals(other.value))
        {
            return false;
        }
        return true;
        return key.equals(other.key);
    }
    
    @Override
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ package ca.nrc.cadc.auth.model;
/**
 * Represents the posix account details associated with a user account.
 */
public class PosixDetails
public class PosixDetails implements UserDetails
{
    private long uid;
    private long gid;
+2 −4
Original line number Diff line number Diff line
@@ -46,8 +46,7 @@ public class User<T extends Principal>

    private Set<Principal> principals = new HashSet<Principal>();
    
    public UserDetails userDetails;
    public PosixDetails posixDetails;
    public Set<UserDetails> details = new HashSet<UserDetails>();
    
    
    public User(final T userID)
@@ -79,8 +78,7 @@ public class User<T extends Principal>
    {
        final int prime = 31;
        int result = 1;
        result = prime * result
                + ((userID == null) ? 0 : userID.hashCode());
        result = prime * result + userID.hashCode();
        return result;
    }

Loading