public interface RoleManager extends PrincipalTypeManager
Describes the service interface for managing roles.
Modifier and Type | Method and Description |
---|---|
Role |
addRole(String roleName)
Add a new role
|
Role |
addRole(String roleName,
boolean mapped)
Add a new role and optionally map/replicate it to an external storage manager (if configured).
|
void |
addRoleToGroup(String roleName,
String groupName)
Add a role to a group.
|
void |
addRoleToRole(Role from,
Role to,
String associationName)
Add a hierarchical association between two roles.
|
void |
addRoleToUser(String username,
String roleName)
Add a role to a user.
|
Role |
getRole(String roleName)
Get a role
Role for a given role name. |
List<String> |
getRoleNames(String nameFilter)
Retrieves a detached and modifiable List of role names, finding roles matching the corresponding
role name filter.
|
List<Role> |
getRoles(String nameFilter)
Retrieves a detached and modifiable
Role list matching the corresponding
role name filter. |
List<Role> |
getRolesAssociatedFrom(Role from,
String associationName)
Retrieve all the roles which are associated from the provided role.
|
List<Role> |
getRolesAssociatedTo(Role to,
String associationName)
Retrieve all the roles which are associated to the provided role.
|
List<Role> |
getRolesForUser(String username)
Retrieves a detached and modifiable
Role list of all the roles
associated to a specific user. |
List<Role> |
getRolesInGroup(String groupName)
Retrieves a detached and modifiable
Role list of all the roles
associated to a specific group. |
boolean |
isGroupInRole(String groupName,
String roleName)
Whether or not a role is in a group.
|
boolean |
isUserInRole(String username,
String roleName)
Whether or not a user is in a role.
|
Role |
newRole(String name,
boolean mapped) |
Role |
newTransientRole(String name) |
void |
removeRole(String roleName)
Remove a given role
|
void |
removeRoleFromGroup(String roleName,
String groupName)
Remove a role from a group.
|
void |
removeRoleFromRole(Role from,
Role to,
String associationName)
Remove a hierarchical association between two roles.
|
void |
removeRoleFromUser(String username,
String roleName)
Remove a user from a role.
|
boolean |
roleExists(String roleName)
Whether or not a role exists.
|
void |
updateRole(Role role)
Updates a role and all its attributes
|
getPrincipalManager, getPrincipalType
Role addRole(String roleName) throws SecurityException
Add a new role
If an external security storage manager is used, the role will be mapped/replicated to it as well.
roleName
- The role nameRole
throws
- a security exception if the role already exists.SecurityException
Role addRole(String roleName, boolean mapped) throws SecurityException
Add a new role and optionally map/replicate it to an external storage manager (if configured).
roleName
- The role name.mapped
- if the new Role should be mapped/replicated to an external security storage manager (if used) or not.Role
throws
- a security exception if the role already exists.SecurityException
void removeRole(String roleName) throws SecurityException
Remove a given role
roleName
- throws
- a security exception.SecurityException
boolean roleExists(String roleName)
Whether or not a role exists.
roleName
- Role getRole(String roleName) throws SecurityException
Get a role Role
for a given role name.
roleName
- The role nameRole
.throws
- a security exception if the role does not exist.SecurityException
List<Role> getRolesForUser(String username) throws SecurityException
Retrieves a detached and modifiable Role
list of all the roles
associated to a specific user.
username
- The user name.Role
.throws
- a security exception if the user does not exist.SecurityException
List<Role> getRolesInGroup(String groupName) throws SecurityException
Retrieves a detached and modifiable Role
list of all the roles
associated to a specific group.
groupName
- The group nameRole
.throws
- a security exception if the group does not exist.SecurityException
void addRoleToUser(String username, String roleName) throws SecurityException
Add a role to a user.
username
- The user nameroleName
- The role namethrows
- a security exception if the role or the user do not exist.SecurityException
void removeRoleFromUser(String username, String roleName) throws SecurityException
Remove a user from a role.
username
- The user name.roleName
- The role namethrows
- a security exception.SecurityException
boolean isUserInRole(String username, String roleName) throws SecurityException
Whether or not a user is in a role.
username
- The user name.roleName
- The role namethrows
- a security exception if the role or the user does not exist.SecurityException
void addRoleToGroup(String roleName, String groupName) throws SecurityException
Add a role to a group.
roleName
- The role namegroupName
- The group namethrows
- a security exception.SecurityException
void removeRoleFromGroup(String roleName, String groupName) throws SecurityException
Remove a role from a group.
roleName
- The role namegroupName
- The group namethrows
- a security exception.SecurityException
boolean isGroupInRole(String groupName, String roleName) throws SecurityException
Whether or not a role is in a group.
groupName
- The group nameroleName
- The role namethrows
- a security exception if the role or the group does not exist.SecurityException
List<Role> getRoles(String nameFilter) throws SecurityException
Role
list matching the corresponding
role name filter.
nameFilter
- The filter used to retrieve matching roles.Role
SecurityException
List<String> getRoleNames(String nameFilter) throws SecurityException
Retrieves a detached and modifiable List of role names, finding roles matching the corresponding role name filter.
nameFilter
- The filter used to retrieve matching roles.SecurityException
void updateRole(Role role) throws SecurityException
role
- SecurityException
void addRoleToRole(Role from, Role to, String associationName) throws SecurityException
Default supported hierarchical associations are JetspeedPrincipalAssociationType.IS_A
and
JetspeedPrincipalAssociationType.IS_PART_OF
, but it will depend on the actual runtime configuration
if the required JetspeedPrincipalAssociationType
is available.
from
- The role for the from side of the associationto
- The role for the to side of the associationassociationName
- The name of the JetspeedPrincipalAssociationType
to createSecurityException
void removeRoleFromRole(Role from, Role to, String associationName) throws SecurityException
Default supported hierarchical associations are JetspeedPrincipalAssociationType.IS_A
and
JetspeedPrincipalAssociationType.IS_PART_OF
, but it will depend on the actual runtime configuration
if the required JetspeedPrincipalAssociationType
is available.
from
- The role for the from side of the associationto
- The role for the to side of the associationassociationName
- The name of the JetspeedPrincipalAssociationType
to createSecurityException
List<Role> getRolesAssociatedTo(Role to, String associationName)
Default supported hierarchical associations are JetspeedPrincipalAssociationType.IS_A
and
JetspeedPrincipalAssociationType.IS_PART_OF
, but it will depend on the actual runtime configuration
if the required JetspeedPrincipalAssociationType
is available.
If the corresponding JetspeedPrincipalAssociationType
is not available, this method will simply
return a empty list.
For a JetspeedPrincipalAssociationType.IS_PART_OF
association, this will return all
the nested roles which together represent the provided role.
For a JetspeedPrincipalAssociationType.IS_A
association, this will return all
the roles which extend the provided role.
Note: this method will only return the directly associated roles, not further derived associations.
to
- The role for the to side of the associationassociationName
- The name of the JetspeedPrincipalAssociationType
to createList<Role> getRolesAssociatedFrom(Role from, String associationName)
Default supported hierarchical associations are JetspeedPrincipalAssociationType.IS_A
and
JetspeedPrincipalAssociationType.IS_PART_OF
, but it will depend on the actual runtime configuration
if the required JetspeedPrincipalAssociationType
is available.
If the corresponding JetspeedPrincipalAssociationType
is not available, this method will simply
return a empty list.
For a JetspeedPrincipalAssociationType.IS_PART_OF
association, this will return (at most)
the single role where the provided role is part of.
For a JetspeedPrincipalAssociationType.IS_A
association, this will return all
the roles which the provided role extends.
Note: this method will only return the directly associated role(s), not further derived associations.
from
- The role for the from side of the associationassociationName
- The name of the JetspeedPrincipalAssociationType
to createCopyright © 1999–2016 The Apache Software Foundation. All rights reserved.