com.sas.hls.security.role
Class Role

java.lang.Object
  extended by com.sas.hls.security.role.RoleDescriptor
      extended by com.sas.hls.security.role.Role
All Implemented Interfaces:
Identifiable, Serializable

public class Role
extends RoleDescriptor

Role is a logical grouping of privileges. A Role can be defined with a set of privileges that are required to perform actions by a user assigned to the role. A Role is associated with and scoped to a context where it is defined. A role context is an object that implements the RoleContext interface. See RoleContext. Examples of RoleContext are Organization, Project and Analysis objects.

Members (users and groups) of that context may be assigned to the roles associated with a given role context. This will grant them all the privileges of the role.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sas.hls.security.role.RoleDescriptor
OBJECT_TYPE
 
Constructor Summary
Role(Identifiable roleContext, String name, String identifier, String description, Set<Privilege> privileges)
          Constructor
Role(ObjectIdentity roleContext, String name, String identifier, String description, Set<Privilege> privileges)
          Constructor
Role(ObjectIdentity roleContext, String name, String identifier, String description, Set<Privilege> privileges, long revision)
          Constructor (internal version)
 
Method Summary
 boolean equals(Object obj)
          Indicate whether some other object is "equal to" this one.
 Set<Privilege> getPrivileges()
          Get the privileges associated with this role.
 int hashCode()
          Return a hash code value for the object.
 void setPrivileges(Set<Privilege> privileges)
          Set the privileges associated with this role.
 RoleDescriptor toDescriptor()
          Get a roleDescriptor for this role
static List<RoleDescriptor> toDescriptors(List<Role> roles)
          Get roleDescriptors for these roles
 String toString()
          Return a string representation of the object.
 
Methods inherited from class com.sas.hls.security.role.RoleDescriptor
getDescription, getIdentifier, getName, getObjectType, getRevision, getRoleContext, setDescription, setIdentifier, setName, setObjectType, setRevision, setRoleContext
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Role

public Role(ObjectIdentity roleContext,
            String name,
            String identifier,
            String description,
            Set<Privilege> privileges)
Constructor

Parameters:
roleContext - the context in which the role is being defined
name - the name of the role
identifier - the identifier of the role
description - the description of the role
privileges - the set of privileges of the role

Role

public Role(ObjectIdentity roleContext,
            String name,
            String identifier,
            String description,
            Set<Privilege> privileges,
            long revision)
Constructor (internal version)

Parameters:
roleContext - the context in which the role is being defined
name - the name of the role
identifier - the identifier of the role
description - the description of the role
privileges - the set of privileges of the role
revision - the internal revision number of this role

Role

public Role(Identifiable roleContext,
            String name,
            String identifier,
            String description,
            Set<Privilege> privileges)
Constructor

Parameters:
roleContext - the context in which the role is being defined
name - the name of the role
identifier - the identifier of the role
description - the description of the role
privileges - the set of privileges of the role
Method Detail

getPrivileges

public Set<Privilege> getPrivileges()
Get the privileges associated with this role.

Returns:
the privileges associated with this role.

setPrivileges

public void setPrivileges(Set<Privilege> privileges)
Set the privileges associated with this role.

Parameters:
privileges - the privileges to associate with this role

hashCode

public int hashCode()
Return a hash code value for the object.

Overrides:
hashCode in class RoleDescriptor
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Indicate whether some other object is "equal to" this one.

Overrides:
equals in class RoleDescriptor
See Also:
Object.equals(java.lang.Object)

toString

public String toString()
Return a string representation of the object.

Overrides:
toString in class RoleDescriptor
See Also:
Object.toString()

toDescriptor

public RoleDescriptor toDescriptor()
Get a roleDescriptor for this role

Returns:
a roleDescriptor for this role

toDescriptors

public static List<RoleDescriptor> toDescriptors(List<Role> roles)
Get roleDescriptors for these roles

Parameters:
roles - the list of roles for which to get roleDescriptors
Returns:
a list of corresponding roleDescriptors for the provided roles


Copyright (c) 2016, SAS Institute Inc., Cary, NC, USA