@Component public class RolesManagerImpl extends java.lang.Object implements RolesManager
RolesManager.GrantedAuthorityDisplayComparator, RolesManager.GrantedAuthorityNameComparator, RolesManager.GrantedAuthorityNoCamparator, RolesManager.SortRolesByType
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
classType |
USER
Constructor and Description |
---|
RolesManagerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addGlobalRoleType(GrantedAuthority ga)
Creates a new global role available to all partners.
|
void |
addRoleType(java.lang.String roleName,
java.lang.String displayName)
Creates a new role for the current partner.
|
void |
addUserRole(XInfo userXinfo,
GrantedAuthority roleToAdd)
For the current partner, assign a role to a user.
|
int |
deleteRoleType(GrantedAuthority roleToDelete)
Deletes a role for the current partner.
|
java.util.Set<XInfo> |
getRoleHolders(GrantedAuthority role)
For the current partner, returns the set of users that hold a specified role.
|
java.util.Set<GrantedAuthority> |
getRoleTypes(RolesManager.SortRolesByType sortType,
GrantedAuthority.RoleScope scope)
Returns the set of roles for the current partner
|
java.util.Set<GrantedAuthority> |
getRoleTypes(java.lang.String partnerRef,
RolesManager.SortRolesByType sortType,
GrantedAuthority.RoleScope scope)
Returns the set of all roles for the specified partner.
|
java.util.Set<XInfo> |
getUnconnectedRoleHolders(GrantedAuthority role)
Returns the set of users, across all partners, that hold a specified role
|
java.util.Set<GrantedAuthority> |
getUserRoles(XInfo userXinfo,
RolesManager.SortRolesByType sortType)
For the current partner, returns the set of roles assigned to a user.
|
boolean |
hasRole(XInfo userXinfo,
GrantedAuthority role)
Returns whether a user holds a particular role.
|
void |
removeUserRole(XInfo userXinfo,
GrantedAuthority roleToRemove)
For the current partner, removes a role from a user.
|
public void addRoleType(java.lang.String roleName, java.lang.String displayName)
RolesManager
addRoleType
in interface RolesManager
roleName
- Role, by name, to adddisplayName
- Role's display namepublic void addGlobalRoleType(GrantedAuthority ga)
RolesManager
Note: For use only by Service Administrators.
For their application, partners call RolesManager.deleteRoleType(GrantedAuthority)
.
addGlobalRoleType
in interface RolesManager
ga
- Role to add@Transactional public int deleteRoleType(GrantedAuthority roleToDelete) throws NotFoundException
RolesManager
deleteRoleType
in interface RolesManager
roleToDelete
- Role to delete, by name.NotFoundException
- The specified role was not foundpublic java.util.Set<GrantedAuthority> getRoleTypes(java.lang.String partnerRef, RolesManager.SortRolesByType sortType, GrantedAuthority.RoleScope scope) throws NotFoundException
RolesManager
Note: For use only by Service Administrators.
For their application, partners call
#getRoleTypes(SortRolesByType, RoleScope)
getRoleTypes
in interface RolesManager
partnerRef
- The partner's external referencesortType
- Specifies how to order the returned rolesscope
- Specifies which roles to return based on who defined themNotFoundException
- The specified partner or role was not foundpublic java.util.Set<GrantedAuthority> getRoleTypes(RolesManager.SortRolesByType sortType, GrantedAuthority.RoleScope scope)
RolesManager
getRoleTypes
in interface RolesManager
sortType
- Specifies how to order the returned rolesscope
- Specifies which roles to return based on who defined thempublic java.util.Set<GrantedAuthority> getUserRoles(XInfo userXinfo, RolesManager.SortRolesByType sortType) throws NotFoundException
RolesManager
getUserRoles
in interface RolesManager
userXinfo
- A user's external identifier informationsortType
- How to sort the returned roles.NotFoundException
- If the user was not found.public void addUserRole(XInfo userXinfo, GrantedAuthority roleToAdd) throws NotFoundException
RolesManager
Note: For use only by Service Administrators.
For their application, partners call RolesManager.removeUserRole(XInfo, GrantedAuthority)
.
addUserRole
in interface RolesManager
userXinfo
- A user's external identifier informationroleToAdd
- The role to addNotFoundException
- If the user was not found.public void removeUserRole(XInfo userXinfo, GrantedAuthority roleToRemove) throws NotFoundException
RolesManager
removeUserRole
in interface RolesManager
userXinfo
- A user's external identifier informationroleToRemove
- The role to removeNotFoundException
- When the userpublic boolean hasRole(XInfo userXinfo, GrantedAuthority role) throws NotFoundException
RolesManager
hasRole
in interface RolesManager
userXinfo
- A user's external identifier informationrole
- Role to checkNotFoundException
- If the user was not found.public java.util.Set<XInfo> getRoleHolders(GrantedAuthority role)
RolesManager
getRoleHolders
in interface RolesManager
role
- Role to checkpublic java.util.Set<XInfo> getUnconnectedRoleHolders(GrantedAuthority role)
RolesManager
getUnconnectedRoleHolders
in interface RolesManager
role
- Role to check