Class ThesaurusAccessController
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.core.impl.right.AbstractProfileStorageBasedAccessController
-
- org.ametys.plugins.thesaurus.right.ThesaurusAccessController
-
- All Implemented Interfaces:
AccessController
,LogEnabled
,Initializable
,Component
,Contextualizable
,Serviceable
public class ThesaurusAccessController extends AbstractProfileStorageBasedAccessController implements Contextualizable
AccessController
for a thesaurus objects. The rights are checked on '/cms' context. Read access is allowed to any connected user.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.right.AbstractProfileStorageBasedAccessController
AbstractProfileStorageBasedAccessController.CacheKind
-
Nested classes/interfaces inherited from interface org.ametys.core.right.AccessController
AccessController.AccessResult
-
-
Field Summary
-
Fields inherited from class org.ametys.plugins.core.impl.right.AbstractProfileStorageBasedAccessController
__ANONYMOUS_USER_IDENTITY, __ANY_CONTECTED_USER_IDENTITY, _cacheManager, _profileAssignmentStorageEP, _rightProfileDAO
-
-
Constructor Summary
Constructors Constructor Description ThesaurusAccessController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
_convertContext(Object initialContext)
For methods getXXXXPermissionYYY allow to have a modification of the context before transfering it to the profile assignment storage extension point The default implemenation keep the context as it isprotected String
_convertRightId(String rightId)
Convert the asked right id to the real right to checkprotected Set<? extends Object>
_convertWorkspaceToRootRightContexts(Set<Object> workspacesContexts)
Get the current workspaces contexts and turn it into root contexts in order to allow methods hasXXXAnyPermissionOnWorkspace to workvoid
contextualize(Context context)
AccessController.AccessResult
getPermission(UserIdentity user, Set<GroupIdentity> userGroups, String rightId, Object object)
Gets the kind of access a user has on an object for a given rightMap<GroupIdentity,AccessController.AccessResult>
getPermissionByGroup(String rightId, Object object)
Gets the permission by group only on an object for the given right.Map<String,AccessController.AccessResult>
getPermissionByRight(UserIdentity user, Set<GroupIdentity> userGroups, Object object)
Gets the kind of access a user has on an object for all rightsMap<UserIdentity,AccessController.AccessResult>
getPermissionByUser(String rightId, Object object)
Gets the permission by user only on an object for the given right.AccessController.AccessResult
getPermissionForAnonymous(String rightId, Object object)
Gets the permission for Anonymous only on an object for a given rightAccessController.AccessResult
getPermissionForAnyConnectedUser(String rightId, Object object)
Gets the permission for any connected user only on an object for a given rightAccessController.AccessResult
getReadAccessPermission(UserIdentity user, Set<GroupIdentity> userGroups, Object object)
Gets the kind of access a user has on an object for thye read accessMap<GroupIdentity,AccessController.AccessResult>
getReadAccessPermissionByGroup(Object object)
Gets the read access permission by group only on an object.Map<UserIdentity,AccessController.AccessResult>
getReadAccessPermissionByUser(Object object)
Gets the read access permission by user only on an object.AccessController.AccessResult
getReadAccessPermissionForAnonymous(Object object)
Gets the read access permission for Anonymous only on an objectAccessController.AccessResult
getReadAccessPermissionForAnyConnectedUser(Object object)
Gets the read access permission for any connected user only on an objectboolean
isSupported(Object object)
Returns true if this access controller supports the given objectvoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.plugins.core.impl.right.AbstractProfileStorageBasedAccessController
_getPermission, _getPermissionByGroup, _getPermissionByUser, _getPermissionForAnonymous, _getPermissionForAnyConnectedUser, _hasRightResultInFirstCache, _hasRightResultInSecondCache, _putInFirstCache, _putInSecondCache, hasAnonymousAnyPermissionOnWorkspace, hasAnonymousAnyReadAccessPermissionOnWorkspace, hasAnyConnectedUserAnyPermissionOnWorkspace, hasAnyConnectedUserAnyReadAccessPermissionOnWorkspace, hasUserAnyPermissionOnWorkspace, hasUserAnyReadAccessPermissionOnWorkspace, initialize
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Constructor Detail
-
ThesaurusAccessController
public ThesaurusAccessController()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractProfileStorageBasedAccessController
- Throws:
ServiceException
-
isSupported
public boolean isSupported(Object object)
Description copied from interface:AccessController
Returns true if this access controller supports the given object- Specified by:
isSupported
in interfaceAccessController
- Parameters:
object
- The object to test- Returns:
- true if this access controller supports the given object
-
_convertContext
protected Object _convertContext(Object initialContext)
Description copied from class:AbstractProfileStorageBasedAccessController
For methods getXXXXPermissionYYY allow to have a modification of the context before transfering it to the profile assignment storage extension point The default implemenation keep the context as it is- Overrides:
_convertContext
in classAbstractProfileStorageBasedAccessController
- Parameters:
initialContext
- The right context that is supported- Returns:
- the context modified
-
_convertRightId
protected String _convertRightId(String rightId)
Convert the asked right id to the real right to check- Parameters:
rightId
- The asked right id- Returns:
- the right to check
-
getPermission
public AccessController.AccessResult getPermission(UserIdentity user, Set<GroupIdentity> userGroups, String rightId, Object object)
Description copied from interface:AccessController
Gets the kind of access a user has on an object for a given right- Specified by:
getPermission
in interfaceAccessController
- Overrides:
getPermission
in classAbstractProfileStorageBasedAccessController
- Parameters:
user
- The user. Cannot be null.userGroups
- The groups the user belongs torightId
- The id of the right of the userobject
- The context object to check the access- Returns:
- the kind of access a user has on an object for a right
-
getReadAccessPermission
public AccessController.AccessResult getReadAccessPermission(UserIdentity user, Set<GroupIdentity> userGroups, Object object)
Description copied from interface:AccessController
Gets the kind of access a user has on an object for thye read access- Specified by:
getReadAccessPermission
in interfaceAccessController
- Overrides:
getReadAccessPermission
in classAbstractProfileStorageBasedAccessController
- Parameters:
user
- The user. Cannot be null.userGroups
- The groups the user belongs toobject
- The context object to check the access- Returns:
- the kind of access a user has on an object for the read access
-
getPermissionByRight
public Map<String,AccessController.AccessResult> getPermissionByRight(UserIdentity user, Set<GroupIdentity> userGroups, Object object)
Description copied from interface:AccessController
Gets the kind of access a user has on an object for all rights- Specified by:
getPermissionByRight
in interfaceAccessController
- Overrides:
getPermissionByRight
in classAbstractProfileStorageBasedAccessController
- Parameters:
user
- The user. Cannot be null.userGroups
- The groups the user belongs toobject
- The context object to check the access- Returns:
- the kind of access a user has on an object for all rights
-
getPermissionForAnonymous
public AccessController.AccessResult getPermissionForAnonymous(String rightId, Object object)
Description copied from interface:AccessController
Gets the permission for Anonymous only on an object for a given right- Specified by:
getPermissionForAnonymous
in interfaceAccessController
- Overrides:
getPermissionForAnonymous
in classAbstractProfileStorageBasedAccessController
- Parameters:
rightId
- The id of the right to checkobject
- The object- Returns:
- the permission for Anonymous only on an object for a given right
-
getReadAccessPermissionForAnonymous
public AccessController.AccessResult getReadAccessPermissionForAnonymous(Object object)
Description copied from interface:AccessController
Gets the read access permission for Anonymous only on an object- Specified by:
getReadAccessPermissionForAnonymous
in interfaceAccessController
- Overrides:
getReadAccessPermissionForAnonymous
in classAbstractProfileStorageBasedAccessController
- Parameters:
object
- The object- Returns:
- the read access permission for Anonymous only on an object
-
getPermissionForAnyConnectedUser
public AccessController.AccessResult getPermissionForAnyConnectedUser(String rightId, Object object)
Description copied from interface:AccessController
Gets the permission for any connected user only on an object for a given right- Specified by:
getPermissionForAnyConnectedUser
in interfaceAccessController
- Overrides:
getPermissionForAnyConnectedUser
in classAbstractProfileStorageBasedAccessController
- Parameters:
rightId
- The id of the right to checkobject
- The object- Returns:
- the permission for any connected user only on an object for a given right
-
getReadAccessPermissionForAnyConnectedUser
public AccessController.AccessResult getReadAccessPermissionForAnyConnectedUser(Object object)
Description copied from interface:AccessController
Gets the read access permission for any connected user only on an object- Specified by:
getReadAccessPermissionForAnyConnectedUser
in interfaceAccessController
- Overrides:
getReadAccessPermissionForAnyConnectedUser
in classAbstractProfileStorageBasedAccessController
- Parameters:
object
- The object- Returns:
- the read access permission for any connected user only on an object
-
getPermissionByUser
public Map<UserIdentity,AccessController.AccessResult> getPermissionByUser(String rightId, Object object)
Description copied from interface:AccessController
Gets the permission by user only on an object for the given right. It does not take account of the groups of the user, etc.- Specified by:
getPermissionByUser
in interfaceAccessController
- Overrides:
getPermissionByUser
in classAbstractProfileStorageBasedAccessController
- Parameters:
rightId
- The id of the right to checkobject
- The object- Returns:
- the permission by user only on an object for the given right
-
getReadAccessPermissionByGroup
public Map<GroupIdentity,AccessController.AccessResult> getReadAccessPermissionByGroup(Object object)
Description copied from interface:AccessController
Gets the read access permission by group only on an object.- Specified by:
getReadAccessPermissionByGroup
in interfaceAccessController
- Overrides:
getReadAccessPermissionByGroup
in classAbstractProfileStorageBasedAccessController
- Parameters:
object
- The object- Returns:
- the read access permission by group only on an object
-
getReadAccessPermissionByUser
public Map<UserIdentity,AccessController.AccessResult> getReadAccessPermissionByUser(Object object)
Description copied from interface:AccessController
Gets the read access permission by user only on an object. It does not take account of the groups of the user, etc.- Specified by:
getReadAccessPermissionByUser
in interfaceAccessController
- Overrides:
getReadAccessPermissionByUser
in classAbstractProfileStorageBasedAccessController
- Parameters:
object
- The object- Returns:
- the read access permission by user only on an object
-
getPermissionByGroup
public Map<GroupIdentity,AccessController.AccessResult> getPermissionByGroup(String rightId, Object object)
Description copied from interface:AccessController
Gets the permission by group only on an object for the given right.- Specified by:
getPermissionByGroup
in interfaceAccessController
- Overrides:
getPermissionByGroup
in classAbstractProfileStorageBasedAccessController
- Parameters:
rightId
- The id of the right to checkobject
- The object- Returns:
- the permission by group only on an object for the given right
-
_convertWorkspaceToRootRightContexts
protected Set<? extends Object> _convertWorkspaceToRootRightContexts(Set<Object> workspacesContexts)
Description copied from class:AbstractProfileStorageBasedAccessController
Get the current workspaces contexts and turn it into root contexts in order to allow methods hasXXXAnyPermissionOnWorkspace to work- Specified by:
_convertWorkspaceToRootRightContexts
in classAbstractProfileStorageBasedAccessController
- Parameters:
workspacesContexts
- The workspace contexts. Such as '/${WorkspaceName}', '/admin'- Returns:
- A null or empty set if the current AccessController does not apply to any workspace context, or the root object where ProfileAssignmentStorageExtension should start looking at to find any permission
-
-