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, RBACManagerListenerCachedRbacManager 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 voidaddChildRole(Role role, Role childRole)Adds a child to a role.voidaddListener(RBACManagerListener listener)voidclearCache()OperationcreateOperation(String name)PermissioncreatePermission(String name)Creates an implementation specificPermission, or return an existingPermission, depending on the providednameparameter.PermissioncreatePermission(String name, String operationName, String resourceIdentifier)ResourcecreateResource(String identifier)RolecreateRole(String name)RolecreateRole(String id, String name)Creates a new role with the given id and role name.UserAssignmentcreateUserAssignment(String principal)Creates an implementation specificUserAssignment, or return an existingUserAssignment, depending on the providedidentifierparameter.voideraseDatabase()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 ofRoleobjects 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.StringgetDescriptionKey()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()ResourcegetGlobalResource()Returns the global resource objectOperationgetOperation(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.PermissiongetPermission(String permissionName)org.apache.archiva.components.cache.Cache<String,? extends Permission>getPermissionsCache()RBACManagergetRbacImpl()ResourcegetResource(String resourceIdentifier)org.apache.archiva.components.cache.Cache<String,? extends Resource>getResourcesCache()RolegetRole(String roleName)Returns the role identified by the given nameRolegetRoleById(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.UserAssignmentgetUserAssignment(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()voidinitialize()consumer of user manager can use it to reload various configuration with the configurable implementation is possible to change dynamically the real implementation used.booleanisFinalImplementation()booleanisReadOnly()Is the RBACManager read only? if so then create and modify actions are to be disabledbooleanoperationExists(String name)booleanoperationExists(Operation operation)booleanpermissionExists(String name)Tests for the existence of a permission.booleanpermissionExists(Permission permission)voidrbacInit(boolean freshdb)voidrbacPermissionRemoved(Permission permission)voidrbacPermissionSaved(Permission permission)voidrbacRoleRemoved(Role role)voidrbacRoleSaved(Role role)voidrbacUserAssignmentRemoved(UserAssignment userAssignment)voidrbacUserAssignmentSaved(UserAssignment userAssignment)voidremoveListener(RBACManagerListener listener)voidremoveOperation(String operationName)voidremoveOperation(Operation operation)voidremovePermission(String permissionName)voidremovePermission(Permission permission)voidremoveResource(String resourceIdentifier)voidremoveResource(Resource resource)voidremoveRole(String roleName)Removes the role with the given name from the datastore.voidremoveRole(Role role)Removes the given role from the datastore.voidremoveRoleById(String id)Removes the role with the given id from the datastore.voidremoveUserAssignment(String principal)Method removeAssignmentvoidremoveUserAssignment(UserAssignment userAssignment)Method removeAssignmentbooleanresourceExists(String identifier)booleanresourceExists(Resource resource)booleanroleExists(String name)Tests for the existence of a Role.booleanroleExists(Role role)Returns true, if the given role exists.booleanroleExistsById(String id)Returnstrue, if a role with the given id exists.OperationsaveOperation(Operation operation)Save the new or existing operation to the store.PermissionsavePermission(Permission permission)ResourcesaveResource(Resource resource)RolesaveRole(Role role)Persists the given role to the backend datastore.voidsaveRoles(Collection<Role> roles)Persists all of the given roles to the backend datastore.UserAssignmentsaveUserAssignment(UserAssignment userAssignment)Method saveUserAssignmentvoidsetEffectiveRoleSetCache(org.apache.archiva.components.cache.Cache<String,Set<? extends Role>> effectiveRoleSetCache)voidsetOperationsCache(org.apache.archiva.components.cache.Cache<String,? extends Operation> operationsCache)voidsetPermissionsCache(org.apache.archiva.components.cache.Cache<String,? extends Permission> permissionsCache)voidsetRbacImpl(RBACManager rbacImpl)voidsetResourcesCache(org.apache.archiva.components.cache.Cache<String,? extends Resource> resourcesCache)voidsetRolesByIdCache(org.apache.archiva.components.cache.Cache<String,? extends Role> rolesByIdCache)voidsetRolesCache(org.apache.archiva.components.cache.Cache<String,? extends Role> rolesCache)voidsetUserAssignmentsCache(org.apache.archiva.components.cache.Cache<String,? extends UserAssignment> userAssignmentsCache)voidsetUserPermissionsCache(org.apache.archiva.components.cache.Cache<String,Map<String,List<? extends Permission>>> userPermissionsCache)booleanuserAssignmentExists(String principal)booleanuserAssignmentExists(UserAssignment assignment)
-
-
-
Constructor Detail
-
CachedRbacManager
public CachedRbacManager()
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:RBACManagerconsumer 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:
initializein interfaceRBACManager
-
addChildRole
public void addChildRole(Role role, Role childRole) throws RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManagerAdds a child to a role.- Specified by:
addChildRolein 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:
addListenerin interfaceRBACManager
-
createOperation
public Operation createOperation(String name) throws RbacManagerException
Description copied from interface:RBACManagerCreates an implementation specificOperation, or return an existingOperation, depending on the providednameparameter. Note: Be sure to useRBACManager.saveOperation(Operation)in order to persist any changes to the Role.- Specified by:
createOperationin 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:RBACManagerCreates an implementation specificPermission, or return an existingPermission, depending on the providednameparameter. Note: Be sure to useRBACManager.savePermission(Permission)in order to persist any changes to the Role.- Specified by:
createPermissionin 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:RBACManagerCreates an implementation specificPermissionwith specifiedOperation, andResourceidentifiers. Note: Be sure to useRBACManager.savePermission(Permission)in order to persist any changes to the Role.- Specified by:
createPermissionin 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:RBACManagerCreates an implementation specificResource, or return an existingResource, depending on the providedidentifierparameter. Note: Be sure to useRBACManager.saveResource(Resource)in order to persist any changes to the Role.- Specified by:
createResourcein 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:RBACManagerCreates an implementation specificRole, or return an existingRole, depending on the providednameparameter. Note: Be sure to useRBACManager.saveRole(Role)in order to persist any changes to the Role.- Specified by:
createRolein interfaceRBACManager- Parameters:
name- the name.- Returns:
- the new
Roleobject.
-
createRole
public Role createRole(String id, String name)
Description copied from interface:RBACManagerCreates a new role with the given id and role name.- Specified by:
createRolein 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:RBACManagerCreates an implementation specificUserAssignment, or return an existingUserAssignment, depending on the providedidentifierparameter. Note: Be sure to useRBACManager.saveUserAssignment(UserAssignment)in order to persist any changes to the Role.- Specified by:
createUserAssignmentin 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:
eraseDatabasein interfaceRBACManager
-
getAllAssignableRoles
public List<? extends Role> getAllAssignableRoles() throws RbacManagerException, RbacObjectNotFoundException
Description copied from interface:RBACManagerReturns a list of all assignable roles- Specified by:
getAllAssignableRolesin 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:
getAllOperationsin interfaceRBACManager- Throws:
RbacManagerException
-
getAllPermissions
public List<? extends Permission> getAllPermissions() throws RbacManagerException
- Specified by:
getAllPermissionsin interfaceRBACManager- Throws:
RbacManagerException
-
getAllResources
public List<? extends Resource> getAllResources() throws RbacManagerException
- Specified by:
getAllResourcesin interfaceRBACManager- Throws:
RbacManagerException
-
getAllRoles
public List<? extends Role> getAllRoles() throws RbacManagerException
Description copied from interface:RBACManagerReturns all roles defined in the datastore.- Specified by:
getAllRolesin 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:RBACManagerReturns all user assignments defined- Specified by:
getAllUserAssignmentsin 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:RBACManagerreturns a map of assigned permissions keyed off of operation with a list value of Permissions- Specified by:
getAssignedPermissionMapin 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:RBACManagerReturns 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:
getAssignedPermissionsin 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:RBACManagerReturns 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:
getAssignedRolesin interfaceRBACManager- Parameters:
principal- the user principal to search for assignments- Returns:
- Collection of
Roleobjects. - 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:RBACManagerGet the Collection ofRoleobjects for this UserAssignment.- Specified by:
getAssignedRolesin interfaceRBACManager- Parameters:
userAssignment- the user assignment instance- Returns:
- Collection of
Roleobjects 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:RBACManagerReturns all the child roles of a given role as (name, role) pairs.- Specified by:
getChildRoleNamesin 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:RBACManagerReturns all the child roles of a given role as (role id, role) pairs.- Specified by:
getChildRoleIdsin 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:RBACManagerReturns all the parent roles of a given role as map of (name, role) elements.- Specified by:
getParentRoleNamesin interfaceRBACManager- Parameters:
role- the role to check for parent roles- Returns:
- the list of parent roles that have
roleals 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:RBACManagerReturns all the parent roles of a given role as map of (id, role) elements.- Specified by:
getParentRoleIdsin interfaceRBACManager- Parameters:
role- the role to check for parents roles- Returns:
- a map of (role id, role) pairs that have
roleas 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:RBACManagerGet a list of the effectively assigned roles to the specified user, this includes child roles- Specified by:
getEffectivelyAssignedRolesin 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:RBACManagerGet 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:
getEffectivelyUnassignedRolesin 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:RBACManagerReturns all effective roles. Which means a list with the current role and all child roles recursively.- Specified by:
getEffectiveRolesin 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:RBACManagerReturns the global resource object- Specified by:
getGlobalResourcein 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:
getOperationin interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacManagerException
-
getPermission
public Permission getPermission(String permissionName) throws RbacObjectNotFoundException, RbacManagerException
- Specified by:
getPermissionin interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacManagerException
-
getResource
public Resource getResource(String resourceIdentifier) throws RbacObjectNotFoundException, RbacManagerException
- Specified by:
getResourcein interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacManagerException
-
getRole
public Role getRole(String roleName) throws RbacObjectNotFoundException, RbacManagerException
Description copied from interface:RBACManagerReturns the role identified by the given name- Specified by:
getRolein 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:RBACManagerReturns the role identified by the given ID- Specified by:
getRoleByIdin 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:RBACManagerReturns the role instances for the given role names.- Specified by:
getRolesin 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:RBACManagerGet a list of all assignable roles that are currently not assigned to the specific user.- Specified by:
getUnassignedRolesin 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:
getUserAssignmentin interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacManagerException
-
getUserAssignmentsForRoles
public List<? extends UserAssignment> getUserAssignmentsForRoles(Collection<String> roleIds) throws RbacManagerException
Description copied from interface:RBACManagerReturns the assignments for the given roles- Specified by:
getUserAssignmentsForRolesin 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:
operationExistsin interfaceRBACManager
-
operationExists
public boolean operationExists(String name)
- Specified by:
operationExistsin interfaceRBACManager
-
permissionExists
public boolean permissionExists(Permission permission)
- Specified by:
permissionExistsin interfaceRBACManager
-
permissionExists
public boolean permissionExists(String name)
Description copied from interface:RBACManagerTests for the existence of a permission.- Specified by:
permissionExistsin interfaceRBACManager- Parameters:
name- the name to test for.- Returns:
- true if permission exists.
-
rbacInit
public void rbacInit(boolean freshdb)
- Specified by:
rbacInitin interfaceRBACManagerListener
-
clearCache
public void clearCache()
-
rbacPermissionRemoved
public void rbacPermissionRemoved(Permission permission)
- Specified by:
rbacPermissionRemovedin interfaceRBACManagerListener
-
rbacPermissionSaved
public void rbacPermissionSaved(Permission permission)
- Specified by:
rbacPermissionSavedin interfaceRBACManagerListener
-
rbacRoleRemoved
public void rbacRoleRemoved(Role role)
- Specified by:
rbacRoleRemovedin interfaceRBACManagerListener
-
rbacRoleSaved
public void rbacRoleSaved(Role role)
- Specified by:
rbacRoleSavedin interfaceRBACManagerListener
-
rbacUserAssignmentRemoved
public void rbacUserAssignmentRemoved(UserAssignment userAssignment)
- Specified by:
rbacUserAssignmentRemovedin interfaceRBACManagerListener
-
rbacUserAssignmentSaved
public void rbacUserAssignmentSaved(UserAssignment userAssignment)
- Specified by:
rbacUserAssignmentSavedin interfaceRBACManagerListener
-
removeListener
public void removeListener(RBACManagerListener listener)
- Specified by:
removeListenerin interfaceRBACManager
-
removeOperation
public void removeOperation(Operation operation) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removeOperationin interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacObjectInvalidExceptionRbacManagerException
-
removeOperation
public void removeOperation(String operationName) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removeOperationin interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacObjectInvalidExceptionRbacManagerException
-
removePermission
public void removePermission(Permission permission) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removePermissionin interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacObjectInvalidExceptionRbacManagerException
-
removePermission
public void removePermission(String permissionName) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removePermissionin interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacObjectInvalidExceptionRbacManagerException
-
removeResource
public void removeResource(Resource resource) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removeResourcein interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacObjectInvalidExceptionRbacManagerException
-
removeResource
public void removeResource(String resourceIdentifier) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
- Specified by:
removeResourcein interfaceRBACManager- Throws:
RbacObjectNotFoundExceptionRbacObjectInvalidExceptionRbacManagerException
-
removeRole
public void removeRole(Role role) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManagerRemoves the given role from the datastore.- Specified by:
removeRolein 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:RBACManagerRemoves the role with the given name from the datastore.- Specified by:
removeRolein 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:RBACManagerRemoves the role with the given id from the datastore.- Specified by:
removeRoleByIdin 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:RBACManagerMethod removeAssignment- Specified by:
removeUserAssignmentin 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:RBACManagerMethod removeAssignment- Specified by:
removeUserAssignmentin 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:
resourceExistsin interfaceRBACManager
-
resourceExists
public boolean resourceExists(String identifier)
- Specified by:
resourceExistsin interfaceRBACManager
-
roleExists
public boolean roleExists(Role role) throws RbacManagerException
Description copied from interface:RBACManagerReturns true, if the given role exists.- Specified by:
roleExistsin 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:RBACManagerTests for the existence of a Role.- Specified by:
roleExistsin 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:RBACManagerReturnstrue, if a role with the given id exists.- Specified by:
roleExistsByIdin 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:RBACManagerSave the new or existing operation to the store.- Specified by:
saveOperationin 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:
savePermissionin interfaceRBACManager- Throws:
RbacObjectInvalidExceptionRbacManagerException
-
saveResource
public Resource saveResource(Resource resource) throws RbacObjectInvalidException, RbacManagerException
- Specified by:
saveResourcein interfaceRBACManager- Throws:
RbacObjectInvalidExceptionRbacManagerException
-
saveRole
public Role saveRole(Role role) throws RbacObjectInvalidException, RbacManagerException
Description copied from interface:RBACManagerPersists the given role to the backend datastore.- Specified by:
saveRolein 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:RBACManagerPersists all of the given roles to the backend datastore. Implementations should try to save all role instances and throw exceptions afterwards.- Specified by:
saveRolesin 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:RBACManagerMethod saveUserAssignment- Specified by:
saveUserAssignmentin 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:
userAssignmentExistsin interfaceRBACManager
-
userAssignmentExists
public boolean userAssignmentExists(UserAssignment assignment)
- Specified by:
userAssignmentExistsin 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:
isFinalImplementationin interfaceRBACManager- Returns:
- true if this implementation is a final one and not a wrapper (configurable, cached)
-
getDescriptionKey
public String getDescriptionKey()
- Specified by:
getDescriptionKeyin interfaceRBACManager- Returns:
- a key to be able to customize label in UI
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:RBACManagerIs the RBACManager read only? if so then create and modify actions are to be disabled- Specified by:
isReadOnlyin interfaceRBACManager- Returns:
- boolean true if user manager is read only
-
-