Package com.appiancorp.suiteapi.common
Class Role
java.lang.Object
com.appiancorp.suiteapi.common.Role
- All Implemented Interfaces:
Comparable<Role>
- Direct Known Subclasses:
ContentRole
Holds the data for an individual role within a role map.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceTakes a set of existing permissions and a set of new permissions and decides how to combine them into a result set. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Role.PermissionMergeStrategyReturns the result of addingnewPermissionstoexistingPermissions.static final Role.PermissionMergeStrategyReturns the result of removingnewPermissionsfromexistingPermissions.static final Role.PermissionMergeStrategyReturnsnewPermissions. -
Constructor Summary
ConstructorsConstructorDescriptionRole()Copy constructor.Creates a role with the given name and empty id/uuid sets.Creates a role with the given name and the given ids/uuids.Creates a role with the given name and the given ids/uuids.Role(String name, Set<String> usernames, Set<Long> groupIds, Set<String> userUuids, Set<String> groupUuids) Creates a role with the given name and the given ids/uuids. -
Method Summary
Modifier and TypeMethodDescriptionaddPermissions(Set<Role> existingPermissions, Set<Role> permissionsToAdd) Returns a newSet<Role>with permissions (groups and users) frompermissionsToAddadded toexistingPermissions.static RoleapplyRole(Role existingRole, Role newRole, Role.PermissionMergeStrategy strategy) Returns a newRolethat is the result of applying thestrategytoexistingRoleandnewRole.applyRoleMap(Set<Role> existingRoleMap, Set<Role> newRoleMap, Role.PermissionMergeStrategy strategy) Returns a newSet<Role>that is the result of applying the permissionstrategyto matching pairs ofRoles fromexistingRoleMapandnewRoleMap.intbooleanReturns true if the given object is a non-null Role object that has the same name as this Role.Returns the ids of the groups that have this role.Returns the UUIDs of the groups that have this role.getName()Returns the name of this role.Returns the usernames of the users that have this role.Returns the UUIDs of the users that have this role.inthashCode()Returns the hash code for this Role, calculated as the hash code of this Role's name.removePermissions(Set<Role> existingPermissions, Set<Role> permissionsToRemove) Returns a newSet<Role>with permissions (groups and users) frompermissionsToRemoveremoved fromexistingPermissions.voidsetGroupIds(Set<Long> groupIds) voidsetGroupUuids(Set<String> groupUuids) voidvoidsetUsernames(Set<String> userIds) voidsetUserUuids(Set<String> userUuids) toString()
-
Field Details
-
asRoleName
-
ADDING_STRATEGY
Returns the result of addingnewPermissionstoexistingPermissions. If any new permissions already exist, they are ignored. -
REMOVING_STRATEGY
Returns the result of removingnewPermissionsfromexistingPermissions. -
REPLACING_STRATEGY
ReturnsnewPermissions.
-
-
Constructor Details
-
Role
public Role() -
Role
Creates a role with the given name and empty id/uuid sets. -
Role
public Role(String name, Set<String> usernames, Set<Long> groupIds, Set<String> userUuids, Set<String> groupUuids) Creates a role with the given name and the given ids/uuids. Adding/removing to/from the given sets will affect the created role. Ifnullis passed in for one of the sets, the role will use a new empty set instead. -
Role
Creates a role with the given name and the given ids/uuids. -
Role
public Role(String name, String[] usernames, Long[] groupIds, String[] userUuids, String[] groupUuids) Creates a role with the given name and the given ids/uuids. -
Role
Copy constructor. Creates a role with the same data as the given role (the new role will have its own sets, so changes to the original role will not affect the new role).
-
-
Method Details
-
equals
Returns true if the given object is a non-null Role object that has the same name as this Role. Returns false otherwise. -
hashCode
public int hashCode()Returns the hash code for this Role, calculated as the hash code of this Role's name. -
toString
-
getName
Returns the name of this role. -
setName
-
getUsernames
Returns the usernames of the users that have this role. -
setUsernames
-
getUserUuids
Returns the UUIDs of the users that have this role. This field is not populated except when using the IX API. -
setUserUuids
-
getGroupIds
Returns the ids of the groups that have this role. -
setGroupIds
-
getGroupUuids
Returns the UUIDs of the groups that have this role. This field is not populated except when using the IX API. -
setGroupUuids
-
compareTo
- Specified by:
compareToin interfaceComparable<Role>
-
addPermissions
Returns a newSet<Role>with permissions (groups and users) frompermissionsToAddadded toexistingPermissions. -
removePermissions
public static Set<Role> removePermissions(Set<Role> existingPermissions, Set<Role> permissionsToRemove) Returns a newSet<Role>with permissions (groups and users) frompermissionsToRemoveremoved fromexistingPermissions. -
applyRoleMap
public static Set<Role> applyRoleMap(Set<Role> existingRoleMap, Set<Role> newRoleMap, Role.PermissionMergeStrategy strategy) Returns a newSet<Role>that is the result of applying the permissionstrategyto matching pairs ofRoles fromexistingRoleMapandnewRoleMap.Roles are matched up by role name. -
applyRole
public static Role applyRole(Role existingRole, Role newRole, Role.PermissionMergeStrategy strategy) Returns a newRolethat is the result of applying thestrategytoexistingRoleandnewRole. For example, if the strategy wasADDING_STRATEGY, this would return a newRolewith the groups and users of bothnewRoleandexistingRole.
-