Class CachedRbacManager
- java.lang.Object
-
- org.apache.archiva.redback.rbac.cached.CachedRbacManager
-
- All Implemented Interfaces:
RBACManager
,RBACManagerListener
@Service("rbacManager#cached") public class CachedRbacManager extends Object implements RBACManager, RBACManagerListener
CachedRbacManager is a wrapped RBACManager with caching.- Author:
- Joakim Erdfelt
-
-
Constructor Summary
Constructors Constructor Description CachedRbacManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChildRole(Role role, Role childRole)
Adds a child to a role.void
addListener(RBACManagerListener listener)
void
clearCache()
Operation
createOperation(String name)
Permission
createPermission(String name)
Creates an implementation specificPermission
, or return an existingPermission
, depending on the providedname
parameter.Permission
createPermission(String name, String operationName, String resourceIdentifier)
Resource
createResource(String identifier)
Role
createRole(String name)
Role
createRole(String id, String name)
Creates a new role with the given id and role name.UserAssignment
createUserAssignment(String principal)
Creates an implementation specificUserAssignment
, or return an existingUserAssignment
, depending on the providedidentifier
parameter.void
eraseDatabase()
List<? extends Role>
getAllAssignableRoles()
Returns a list of all assignable rolesList<? extends Operation>
getAllOperations()
List<? extends Permission>
getAllPermissions()
List<? extends Resource>
getAllResources()
List<? extends Role>
getAllRoles()
Returns all roles defined in the datastore.List<? extends UserAssignment>
getAllUserAssignments()
Returns all user assignments definedMap<String,List<? extends Permission>>
getAssignedPermissionMap(String principal)
returns a map of assigned permissions keyed off of operation with a list value of PermissionsSet<? extends Permission>
getAssignedPermissions(String principal)
Returns a set of all permissions that are in all active roles for a given principal.Collection<? extends Role>
getAssignedRoles(String principal)
Returns the active roles for a given principal NOTE: roles that are returned might have parent roles themselves, if you just want all permissions then useRBACManager.getAssignedPermissions(String principal)
Collection<? extends Role>
getAssignedRoles(UserAssignment userAssignment)
Get the Collection ofRole
objects for this UserAssignment.Map<String,? extends Role>
getChildRoleIds(Role role)
Returns all the child roles of a given role as (role id, role) pairs.Map<String,? extends Role>
getChildRoleNames(Role role)
Returns all the child roles of a given role as (name, role) pairs.String
getDescriptionKey()
Collection<? extends Role>
getEffectivelyAssignedRoles(String principal)
Get a list of the effectively assigned roles to the specified user, this includes child rolesCollection<? extends Role>
getEffectivelyUnassignedRoles(String principal)
Get a list of all assignable roles that are currently not effectively assigned to the specific user, meaning, not a child of any already granted roleSet<? extends Role>
getEffectiveRoles(Role role)
Returns all effective roles.org.apache.archiva.components.cache.Cache<String,Set<? extends Role>>
getEffectiveRoleSetCache()
Resource
getGlobalResource()
Returns the global resource objectOperation
getOperation(String operationName)
org.apache.archiva.components.cache.Cache<String,? extends Operation>
getOperationsCache()
Map<String,? extends Role>
getParentRoleIds(Role role)
Returns all the parent roles of a given role as map of (id, role) elements.Map<String,? extends Role>
getParentRoleNames(Role role)
Returns all the parent roles of a given role as map of (name, role) elements.Permission
getPermission(String permissionName)
org.apache.archiva.components.cache.Cache<String,? extends Permission>
getPermissionsCache()
RBACManager
getRbacImpl()
Resource
getResource(String resourceIdentifier)
org.apache.archiva.components.cache.Cache<String,? extends Resource>
getResourcesCache()
Role
getRole(String roleName)
Returns the role identified by the given nameRole
getRoleById(String id)
Returns the role identified by the given IDMap<String,? extends Role>
getRoles(Collection<String> roleNames)
Returns the role instances for the given role names.org.apache.archiva.components.cache.Cache<String,? extends Role>
getRolesByIdCache()
org.apache.archiva.components.cache.Cache<String,? extends Role>
getRolesCache()
Collection<? extends Role>
getUnassignedRoles(String principal)
Get a list of all assignable roles that are currently not assigned to the specific user.UserAssignment
getUserAssignment(String principal)
org.apache.archiva.components.cache.Cache<String,? extends UserAssignment>
getUserAssignmentsCache()
List<? extends UserAssignment>
getUserAssignmentsForRoles(Collection<String> roleIds)
Returns the assignments for the given rolesorg.apache.archiva.components.cache.Cache<String,Map<String,List<? extends Permission>>>
getUserPermissionsCache()
void
initialize()
consumer of user manager can use it to reload various configuration with the configurable implementation is possible to change dynamically the real implementation used.boolean
isFinalImplementation()
boolean
isReadOnly()
Is the RBACManager read only? if so then create and modify actions are to be disabledboolean
operationExists(String name)
boolean
operationExists(Operation operation)
boolean
permissionExists(String name)
Tests for the existence of a permission.boolean
permissionExists(Permission permission)
void
rbacInit(boolean freshdb)
void
rbacPermissionRemoved(Permission permission)
void
rbacPermissionSaved(Permission permission)
void
rbacRoleRemoved(Role role)
void
rbacRoleSaved(Role role)
void
rbacUserAssignmentRemoved(UserAssignment userAssignment)
void
rbacUserAssignmentSaved(UserAssignment userAssignment)
void
removeListener(RBACManagerListener listener)
void
removeOperation(String operationName)
void
removeOperation(Operation operation)
void
removePermission(String permissionName)
void
removePermission(Permission permission)
void
removeResource(String resourceIdentifier)
void
removeResource(Resource resource)
void
removeRole(String roleName)
Removes the role with the given name from the datastore.void
removeRole(Role role)
Removes the given role from the datastore.void
removeRoleById(String id)
Removes the role with the given id from the datastore.void
removeUserAssignment(String principal)
Method removeAssignmentvoid
removeUserAssignment(UserAssignment userAssignment)
Method removeAssignmentboolean
resourceExists(String identifier)
boolean
resourceExists(Resource resource)
boolean
roleExists(String name)
Tests for the existence of a Role.boolean
roleExists(Role role)
Returns true, if the given role exists.boolean
roleExistsById(String id)
Returnstrue
, if a role with the given id exists.Operation
saveOperation(Operation operation)
Save the new or existing operation to the store.Permission
savePermission(Permission permission)
Resource
saveResource(Resource resource)
Role
saveRole(Role role)
Persists the given role to the backend datastore.void
saveRoles(Collection<Role> roles)
Persists all of the given roles to the backend datastore.UserAssignment
saveUserAssignment(UserAssignment userAssignment)
Method saveUserAssignmentvoid
setEffectiveRoleSetCache(org.apache.archiva.components.cache.Cache<String,Set<? extends Role>> effectiveRoleSetCache)
void
setOperationsCache(org.apache.archiva.components.cache.Cache<String,? extends Operation> operationsCache)
void
setPermissionsCache(org.apache.archiva.components.cache.Cache<String,? extends Permission> permissionsCache)
void
setRbacImpl(RBACManager rbacImpl)
void
setResourcesCache(org.apache.archiva.components.cache.Cache<String,? extends Resource> resourcesCache)
void
setRolesByIdCache(org.apache.archiva.components.cache.Cache<String,? extends Role> rolesByIdCache)
void
setRolesCache(org.apache.archiva.components.cache.Cache<String,? extends Role> rolesCache)
void
setUserAssignmentsCache(org.apache.archiva.components.cache.Cache<String,? extends UserAssignment> userAssignmentsCache)
void
setUserPermissionsCache(org.apache.archiva.components.cache.Cache<String,Map<String,List<? extends Permission>>> userPermissionsCache)
boolean
userAssignmentExists(String principal)
boolean
userAssignmentExists(UserAssignment assignment)
-
-
-
Constructor Detail
-
CachedRbacManager
public CachedRbacManager()
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:RBACManager
consumer of user manager can use it to reload various configuration with the configurable implementation is possible to change dynamically the real implementation used.- Specified by:
initialize
in interfaceRBACManager
-
addChildRole
public void addChildRole(Role role, Role childRole) throws RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManager
Adds a child to a role.- Specified by:
addChildRole
in interfaceRBACManager
- Parameters:
role
- the parent rolechildRole
- the child role, that is added to the parent role- Throws:
RbacObjectInvalidException
- if one of the role objects was not validRbacManagerException
- if the access to the backend datastore failed
-
addListener
public void addListener(RBACManagerListener listener)
- Specified by:
addListener
in interfaceRBACManager
-
createOperation
public Operation createOperation(String name) throws RbacManagerException
Description copied from interface:RBACManager
Creates an implementation specificOperation
, or return an existingOperation
, depending on the providedname
parameter. Note: Be sure to useRBACManager.saveOperation(Operation)
in order to persist any changes to the Role.- Specified by:
createOperation
in interfaceRBACManager
- Parameters:
name
- the name.- Returns:
- the new Operation.
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
createPermission
public Permission createPermission(String name) throws RbacManagerException
Description copied from interface:RBACManager
Creates an implementation specificPermission
, or return an existingPermission
, depending on the providedname
parameter. Note: Be sure to useRBACManager.savePermission(Permission)
in order to persist any changes to the Role.- Specified by:
createPermission
in interfaceRBACManager
- Parameters:
name
- the name.- Returns:
- the new Permission.
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
createPermission
public Permission createPermission(String name, String operationName, String resourceIdentifier) throws RbacManagerException
Description copied from interface:RBACManager
Creates an implementation specificPermission
with specifiedOperation
, andResource
identifiers. Note: Be sure to useRBACManager.savePermission(Permission)
in order to persist any changes to the Role.- Specified by:
createPermission
in interfaceRBACManager
- Parameters:
name
- the name.operationName
- theOperation.setName(String)
valueresourceIdentifier
- theResource.setIdentifier(String)
value- Returns:
- the new Permission.
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
createResource
public Resource createResource(String identifier) throws RbacManagerException
Description copied from interface:RBACManager
Creates an implementation specificResource
, or return an existingResource
, depending on the providedidentifier
parameter. Note: Be sure to useRBACManager.saveResource(Resource)
in order to persist any changes to the Role.- Specified by:
createResource
in interfaceRBACManager
- Parameters:
identifier
- the identifier.- Returns:
- the new Resource.
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
createRole
public Role createRole(String name)
Description copied from interface:RBACManager
Creates an implementation specificRole
, or return an existingRole
, depending on the providedname
parameter. Note: Be sure to useRBACManager.saveRole(Role)
in order to persist any changes to the Role.- Specified by:
createRole
in interfaceRBACManager
- Parameters:
name
- the name.- Returns:
- the new
Role
object.
-
createRole
public Role createRole(String id, String name)
Description copied from interface:RBACManager
Creates a new role with the given id and role name.- Specified by:
createRole
in interfaceRBACManager
- Parameters:
id
- the role identifier, which must be uniquename
- the role name, which must be unique- Returns:
- the new role instance
-
createUserAssignment
public UserAssignment createUserAssignment(String principal) throws RbacManagerException
Description copied from interface:RBACManager
Creates an implementation specificUserAssignment
, or return an existingUserAssignment
, depending on the providedidentifier
parameter. Note: Be sure to useRBACManager.saveUserAssignment(UserAssignment)
in order to persist any changes to the Role.- Specified by:
createUserAssignment
in interfaceRBACManager
- Parameters:
principal
- the principal reference to the user.- Returns:
- the new UserAssignment object.
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
eraseDatabase
public void eraseDatabase()
- Specified by:
eraseDatabase
in interfaceRBACManager
-
getAllAssignableRoles
public List<? extends Role> getAllAssignableRoles() throws RbacManagerException, RbacObjectNotFoundException
Description copied from interface:RBACManager
Returns a list of all assignable roles- Specified by:
getAllAssignableRoles
in interfaceRBACManager
- Returns:
- list of assignable roles
- Throws:
RbacManagerException
- if the access to the backend datastore failedRbacObjectNotFoundException
- See Also:
RBACManager.getAllAssignableRoles()
-
getAllOperations
public List<? extends Operation> getAllOperations() throws RbacManagerException
- Specified by:
getAllOperations
in interfaceRBACManager
- Throws:
RbacManagerException
-
getAllPermissions
public List<? extends Permission> getAllPermissions() throws RbacManagerException
- Specified by:
getAllPermissions
in interfaceRBACManager
- Throws:
RbacManagerException
-
getAllResources
public List<? extends Resource> getAllResources() throws RbacManagerException
- Specified by:
getAllResources
in interfaceRBACManager
- Throws:
RbacManagerException
-
getAllRoles
public List<? extends Role> getAllRoles() throws RbacManagerException
Description copied from interface:RBACManager
Returns all roles defined in the datastore.- Specified by:
getAllRoles
in interfaceRBACManager
- Returns:
- the list of roles defined in the datastore
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
getAllUserAssignments
public List<? extends UserAssignment> getAllUserAssignments() throws RbacManagerException
Description copied from interface:RBACManager
Returns all user assignments defined- Specified by:
getAllUserAssignments
in interfaceRBACManager
- Returns:
- list of assignments
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
getAssignedPermissionMap
public Map<String,List<? extends Permission>> getAssignedPermissionMap(String principal) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
returns a map of assigned permissions keyed off of operation with a list value of Permissions- Specified by:
getAssignedPermissionMap
in interfaceRBACManager
- Parameters:
principal
- the user principal name- Returns:
- the map of (operation,permission list) pairs
- Throws:
RbacObjectNotFoundException
- if the user with the given principal was not foundRbacManagerException
- if the access to the backend datastore failed- See Also:
RBACManager.getAssignedPermissionMap(java.lang.String)
-
getAssignedPermissions
public Set<? extends Permission> getAssignedPermissions(String principal) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
Returns a set of all permissions that are in all active roles for a given principal. This includes permissions from all assigned parent roles.- Specified by:
getAssignedPermissions
in interfaceRBACManager
- Parameters:
principal
- the user principal name- Returns:
- the list of all permissions assigned to the user
- Throws:
RbacObjectNotFoundException
- if the user with the given principal name was not foundRbacManagerException
- if the access to the backend datastore failed
-
getAssignedRoles
public Collection<? extends Role> getAssignedRoles(String principal) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
Returns the active roles for a given principal NOTE: roles that are returned might have parent roles themselves, if you just want all permissions then useRBACManager.getAssignedPermissions(String principal)
- Specified by:
getAssignedRoles
in interfaceRBACManager
- Parameters:
principal
- the user principal to search for assignments- Returns:
- Collection of
Role
objects. - Throws:
RbacObjectNotFoundException
- if the user with the given principal name was not foundRbacManagerException
- if the access to the backend datastore failed
-
getAssignedRoles
public Collection<? extends Role> getAssignedRoles(UserAssignment userAssignment) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
Get the Collection ofRole
objects for this UserAssignment.- Specified by:
getAssignedRoles
in interfaceRBACManager
- Parameters:
userAssignment
- the user assignment instance- Returns:
- Collection of
Role
objects for the provided UserAssignment. - Throws:
RbacObjectNotFoundException
- if the assignment could not be foundRbacManagerException
- if the access to the backend datastore failed
-
getChildRoleNames
public Map<String,? extends Role> getChildRoleNames(Role role) throws RbacManagerException
Description copied from interface:RBACManager
Returns all the child roles of a given role as (name, role) pairs.- Specified by:
getChildRoleNames
in interfaceRBACManager
- Parameters:
role
- the parent role- Returns:
- the list of child roles
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
getChildRoleIds
public Map<String,? extends Role> getChildRoleIds(Role role) throws RbacManagerException
Description copied from interface:RBACManager
Returns all the child roles of a given role as (role id, role) pairs.- Specified by:
getChildRoleIds
in interfaceRBACManager
- Parameters:
role
- the parent role- Returns:
- the map of child roles as (role id, role) pairs
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
getParentRoleNames
public Map<String,? extends Role> getParentRoleNames(Role role) throws RbacManagerException
Description copied from interface:RBACManager
Returns all the parent roles of a given role as map of (name, role) elements.- Specified by:
getParentRoleNames
in interfaceRBACManager
- Parameters:
role
- the role to check for parent roles- Returns:
- the list of parent roles that have
role
als child - Throws:
RbacManagerException
- if the access to the backend datastore failed
-
getParentRoleIds
public Map<String,? extends Role> getParentRoleIds(Role role) throws RbacManagerException
Description copied from interface:RBACManager
Returns all the parent roles of a given role as map of (id, role) elements.- Specified by:
getParentRoleIds
in interfaceRBACManager
- Parameters:
role
- the role to check for parents roles- Returns:
- a map of (role id, role) pairs that have
role
as child - Throws:
RbacManagerException
- if the access to the backend datastore failed
-
getEffectivelyAssignedRoles
public Collection<? extends Role> getEffectivelyAssignedRoles(String principal) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
Get a list of the effectively assigned roles to the specified user, this includes child roles- Specified by:
getEffectivelyAssignedRoles
in interfaceRBACManager
- Parameters:
principal
- the user principal- Returns:
- the list of roles effectively assigned to the given user
- Throws:
RbacObjectNotFoundException
- if the user with the given principal was not foundRbacManagerException
- if the access to the backend datastore failed
-
getEffectivelyUnassignedRoles
public Collection<? extends Role> getEffectivelyUnassignedRoles(String principal) throws RbacManagerException, RbacObjectNotFoundException
Description copied from interface:RBACManager
Get a list of all assignable roles that are currently not effectively assigned to the specific user, meaning, not a child of any already granted role- Specified by:
getEffectivelyUnassignedRoles
in interfaceRBACManager
- Parameters:
principal
- the user principal- Returns:
- the list of roles, that are currently not assigned to the user, or a empty list, if no such role was found.
- Throws:
RbacManagerException
- if the access to the backend datastore failedRbacObjectNotFoundException
- if the user with the given principal was not found
-
getEffectiveRoles
public Set<? extends Role> getEffectiveRoles(Role role) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
Returns all effective roles. Which means a list with the current role and all child roles recursively.- Specified by:
getEffectiveRoles
in interfaceRBACManager
- Parameters:
role
- the role to use as starting point- Returns:
- the set of roles that are found as children of the given role
- Throws:
RbacObjectNotFoundException
- if the given role was not foundRbacManagerException
- if the access to the backend datastore failed
-
getGlobalResource
public Resource getGlobalResource() throws RbacManagerException
Description copied from interface:RBACManager
Returns the global resource object- Specified by:
getGlobalResource
in interfaceRBACManager
- Returns:
- the global resource object
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
getOperation
public Operation getOperation(String operationName) throws RbacObjectNotFoundException, RbacManagerException
- Specified by:
getOperation
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacManagerException
-
getPermission
public Permission getPermission(String permissionName) throws RbacObjectNotFoundException, RbacManagerException
- Specified by:
getPermission
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacManagerException
-
getResource
public Resource getResource(String resourceIdentifier) throws RbacObjectNotFoundException, RbacManagerException
- Specified by:
getResource
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacManagerException
-
getRole
public Role getRole(String roleName) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
Returns the role identified by the given name- Specified by:
getRole
in interfaceRBACManager
- Parameters:
roleName
- the role name- Returns:
- the role instance, if a role by this name was found
- Throws:
RbacObjectNotFoundException
- if not role was found with the given nameRbacManagerException
- if the access to the underlying datastore failed
-
getRoleById
public Role getRoleById(String id) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
Returns the role identified by the given ID- Specified by:
getRoleById
in interfaceRBACManager
- Parameters:
id
- the role id- Returns:
- the role object, if the role with the given id exists
- Throws:
RbacObjectNotFoundException
- if no role was found with the given idRbacManagerException
- if the access to the underlying datastore failed
-
getRoles
public Map<String,? extends Role> getRoles(Collection<String> roleNames) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
Returns the role instances for the given role names.- Specified by:
getRoles
in interfaceRBACManager
- Parameters:
roleNames
- the list of role names.- Returns:
- a map of (name,role) pairs
- Throws:
RbacObjectNotFoundException
- if one of the given roles was not foundRbacManagerException
- if the access to the backend datastore failed
-
getUnassignedRoles
public Collection<? extends Role> getUnassignedRoles(String principal) throws RbacManagerException, RbacObjectNotFoundException
Description copied from interface:RBACManager
Get a list of all assignable roles that are currently not assigned to the specific user.- Specified by:
getUnassignedRoles
in interfaceRBACManager
- Parameters:
principal
- the user principal name- Returns:
- the list of roles not assigned to the given user
- Throws:
RbacManagerException
- if the access to the backend datastore failedRbacObjectNotFoundException
- if the user with the given principal was not found
-
getUserAssignment
public UserAssignment getUserAssignment(String principal) throws RbacObjectNotFoundException, RbacManagerException
- Specified by:
getUserAssignment
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacManagerException
-
getUserAssignmentsForRoles
public List<? extends UserAssignment> getUserAssignmentsForRoles(Collection<String> roleIds) throws RbacManagerException
Description copied from interface:RBACManager
Returns the assignments for the given roles- Specified by:
getUserAssignmentsForRoles
in interfaceRBACManager
- Parameters:
roleIds
- collection of role names- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
operationExists
public boolean operationExists(Operation operation)
- Specified by:
operationExists
in interfaceRBACManager
-
operationExists
public boolean operationExists(String name)
- Specified by:
operationExists
in interfaceRBACManager
-
permissionExists
public boolean permissionExists(Permission permission)
- Specified by:
permissionExists
in interfaceRBACManager
-
permissionExists
public boolean permissionExists(String name)
Description copied from interface:RBACManager
Tests for the existence of a permission.- Specified by:
permissionExists
in interfaceRBACManager
- Parameters:
name
- the name to test for.- Returns:
- true if permission exists.
-
rbacInit
public void rbacInit(boolean freshdb)
- Specified by:
rbacInit
in interfaceRBACManagerListener
-
clearCache
public void clearCache()
-
rbacPermissionRemoved
public void rbacPermissionRemoved(Permission permission)
- Specified by:
rbacPermissionRemoved
in interfaceRBACManagerListener
-
rbacPermissionSaved
public void rbacPermissionSaved(Permission permission)
- Specified by:
rbacPermissionSaved
in interfaceRBACManagerListener
-
rbacRoleRemoved
public void rbacRoleRemoved(Role role)
- Specified by:
rbacRoleRemoved
in interfaceRBACManagerListener
-
rbacRoleSaved
public void rbacRoleSaved(Role role)
- Specified by:
rbacRoleSaved
in interfaceRBACManagerListener
-
rbacUserAssignmentRemoved
public void rbacUserAssignmentRemoved(UserAssignment userAssignment)
- Specified by:
rbacUserAssignmentRemoved
in interfaceRBACManagerListener
-
rbacUserAssignmentSaved
public void rbacUserAssignmentSaved(UserAssignment userAssignment)
- Specified by:
rbacUserAssignmentSaved
in interfaceRBACManagerListener
-
removeListener
public void removeListener(RBACManagerListener listener)
- Specified by:
removeListener
in interfaceRBACManager
-
removeOperation
public void removeOperation(Operation operation) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removeOperation
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacObjectInvalidException
RbacManagerException
-
removeOperation
public void removeOperation(String operationName) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removeOperation
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacObjectInvalidException
RbacManagerException
-
removePermission
public void removePermission(Permission permission) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removePermission
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacObjectInvalidException
RbacManagerException
-
removePermission
public void removePermission(String permissionName) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removePermission
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacObjectInvalidException
RbacManagerException
-
removeResource
public void removeResource(Resource resource) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removeResource
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacObjectInvalidException
RbacManagerException
-
removeResource
public void removeResource(String resourceIdentifier) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removeResource
in interfaceRBACManager
- Throws:
RbacObjectNotFoundException
RbacObjectInvalidException
RbacManagerException
-
removeRole
public void removeRole(Role role) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManager
Removes the given role from the datastore.- Specified by:
removeRole
in interfaceRBACManager
- Parameters:
role
- the role to remove- Throws:
RbacObjectNotFoundException
- if the given role was not foundRbacObjectInvalidException
- if the given role has invalid dataRbacManagerException
- if the access to the backend datastore failed
-
removeRole
public void removeRole(String roleName) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManager
Removes the role with the given name from the datastore.- Specified by:
removeRole
in interfaceRBACManager
- Parameters:
roleName
- the role name- Throws:
RbacObjectNotFoundException
- if the role with the given name was not foundRbacManagerException
- if the access to the backend datastore failedRbacObjectInvalidException
-
removeRoleById
public void removeRoleById(String id) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManager
Removes the role with the given id from the datastore.- Specified by:
removeRoleById
in interfaceRBACManager
- Parameters:
id
- the role id- Throws:
RbacObjectNotFoundException
- if no role with the given id was foundRbacManagerException
- if the access to the backend datastore failed
-
removeUserAssignment
public void removeUserAssignment(String principal) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManager
Method removeAssignment- Specified by:
removeUserAssignment
in interfaceRBACManager
- Parameters:
principal
- the principal for which the assignment should be removed- Throws:
RbacObjectNotFoundException
- if the user with the given principal name was not foundRbacObjectInvalidException
- if the principal string was invalidRbacManagerException
- if the access to the backend datastore failed
-
removeUserAssignment
public void removeUserAssignment(UserAssignment userAssignment) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManager
Method removeAssignment- Specified by:
removeUserAssignment
in interfaceRBACManager
- Parameters:
userAssignment
- the assignment to remove- Throws:
RbacObjectNotFoundException
- if the assignment was not foundRbacObjectInvalidException
- if the provided assignment instance has invalid dataRbacManagerException
- if the access to the backend datastore failed
-
resourceExists
public boolean resourceExists(Resource resource)
- Specified by:
resourceExists
in interfaceRBACManager
-
resourceExists
public boolean resourceExists(String identifier)
- Specified by:
resourceExists
in interfaceRBACManager
-
roleExists
public boolean roleExists(Role role) throws RbacManagerException
Description copied from interface:RBACManager
Returns true, if the given role exists.- Specified by:
roleExists
in interfaceRBACManager
- Parameters:
role
- the role to check- Returns:
true
, if the role exists, otherwisefalse
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
roleExists
public boolean roleExists(String name) throws RbacManagerException
Description copied from interface:RBACManager
Tests for the existence of a Role.- Specified by:
roleExists
in interfaceRBACManager
- Returns:
- true if role exists in store.
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
roleExistsById
public boolean roleExistsById(String id) throws RbacManagerException
Description copied from interface:RBACManager
Returnstrue
, if a role with the given id exists.- Specified by:
roleExistsById
in interfaceRBACManager
- Parameters:
id
- the role id- Returns:
true
, if the role with the given id exists, otherwisefalse
- Throws:
RbacManagerException
- if the access to the backend datastore failed
-
saveOperation
public Operation saveOperation(Operation operation) throws RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManager
Save the new or existing operation to the store.- Specified by:
saveOperation
in interfaceRBACManager
- Parameters:
operation
- the operation to save (new or existing)- Returns:
- the Operation that was saved.
- Throws:
RbacObjectInvalidException
- if the object is not valid and cannot be savedRbacManagerException
- if the access to the backend datastore failed
-
savePermission
public Permission savePermission(Permission permission) throws RbacObjectInvalidException, RbacManagerException
- Specified by:
savePermission
in interfaceRBACManager
- Throws:
RbacObjectInvalidException
RbacManagerException
-
saveResource
public Resource saveResource(Resource resource) throws RbacObjectInvalidException, RbacManagerException
- Specified by:
saveResource
in interfaceRBACManager
- Throws:
RbacObjectInvalidException
RbacManagerException
-
saveRole
public Role saveRole(Role role) throws RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManager
Persists the given role to the backend datastore.- Specified by:
saveRole
in interfaceRBACManager
- Parameters:
role
- the role to save- Returns:
- the persisted role, if the method was successful
- Throws:
RbacObjectInvalidException
- if the given role object was not validRbacManagerException
- if the access to the backend datastore failed
-
saveRoles
public void saveRoles(Collection<Role> roles) throws RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManager
Persists all of the given roles to the backend datastore. Implementations should try to save all role instances and throw exceptions afterwards.- Specified by:
saveRoles
in interfaceRBACManager
- Parameters:
roles
- the list of roles to save- Throws:
RbacObjectInvalidException
- if one of the given role objects was not validRbacManagerException
- if the access to the backend datastore failed
-
saveUserAssignment
public UserAssignment saveUserAssignment(UserAssignment userAssignment) throws RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManager
Method saveUserAssignment- Specified by:
saveUserAssignment
in interfaceRBACManager
- Parameters:
userAssignment
- the user assignment instance to save- Throws:
RbacObjectInvalidException
- if the instance has invalid data and cannot be savedRbacManagerException
- if the access to the backend datastore failed
-
userAssignmentExists
public boolean userAssignmentExists(String principal)
- Specified by:
userAssignmentExists
in interfaceRBACManager
-
userAssignmentExists
public boolean userAssignmentExists(UserAssignment assignment)
- Specified by:
userAssignmentExists
in interfaceRBACManager
-
getOperationsCache
public org.apache.archiva.components.cache.Cache<String,? extends Operation> getOperationsCache()
-
setOperationsCache
public void setOperationsCache(org.apache.archiva.components.cache.Cache<String,? extends Operation> operationsCache)
-
getPermissionsCache
public org.apache.archiva.components.cache.Cache<String,? extends Permission> getPermissionsCache()
-
setPermissionsCache
public void setPermissionsCache(org.apache.archiva.components.cache.Cache<String,? extends Permission> permissionsCache)
-
getResourcesCache
public org.apache.archiva.components.cache.Cache<String,? extends Resource> getResourcesCache()
-
setResourcesCache
public void setResourcesCache(org.apache.archiva.components.cache.Cache<String,? extends Resource> resourcesCache)
-
getRolesCache
public org.apache.archiva.components.cache.Cache<String,? extends Role> getRolesCache()
-
setRolesCache
public void setRolesCache(org.apache.archiva.components.cache.Cache<String,? extends Role> rolesCache)
-
getRolesByIdCache
public org.apache.archiva.components.cache.Cache<String,? extends Role> getRolesByIdCache()
-
setRolesByIdCache
public void setRolesByIdCache(org.apache.archiva.components.cache.Cache<String,? extends Role> rolesByIdCache)
-
getUserAssignmentsCache
public org.apache.archiva.components.cache.Cache<String,? extends UserAssignment> getUserAssignmentsCache()
-
setUserAssignmentsCache
public void setUserAssignmentsCache(org.apache.archiva.components.cache.Cache<String,? extends UserAssignment> userAssignmentsCache)
-
getUserPermissionsCache
public org.apache.archiva.components.cache.Cache<String,Map<String,List<? extends Permission>>> getUserPermissionsCache()
-
setUserPermissionsCache
public void setUserPermissionsCache(org.apache.archiva.components.cache.Cache<String,Map<String,List<? extends Permission>>> userPermissionsCache)
-
getEffectiveRoleSetCache
public org.apache.archiva.components.cache.Cache<String,Set<? extends Role>> getEffectiveRoleSetCache()
-
setEffectiveRoleSetCache
public void setEffectiveRoleSetCache(org.apache.archiva.components.cache.Cache<String,Set<? extends Role>> effectiveRoleSetCache)
-
getRbacImpl
public RBACManager getRbacImpl()
-
setRbacImpl
public void setRbacImpl(RBACManager rbacImpl)
-
isFinalImplementation
public boolean isFinalImplementation()
- Specified by:
isFinalImplementation
in interfaceRBACManager
- Returns:
- true if this implementation is a final one and not a wrapper (configurable, cached)
-
getDescriptionKey
public String getDescriptionKey()
- Specified by:
getDescriptionKey
in interfaceRBACManager
- Returns:
- a key to be able to customize label in UI
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:RBACManager
Is the RBACManager read only? if so then create and modify actions are to be disabled- Specified by:
isReadOnly
in interfaceRBACManager
- Returns:
- boolean true if user manager is read only
-
-