Class AccessControlManager
- All Implemented Interfaces:
AccessControlConstants,PluginComponent,StoreListener,JPropertiesListener,Comparable
- Since:
- jcms-7.0
-
Field Summary
Fields inherited from class com.jalios.jcms.ChannelListener
orderFields inherited from interface com.jalios.jcms.accesscontrol.AccessControlConstants
ADMIN_RESOURCE, CTXT_DATA, CTXT_WORKSPACE, DBMBR_EDIT_RESOURCE, GRP_EDIT_RESOURCE, MBR_EDIT_RESOURCE, WORKSPACE_ADMIN_RESOURCE, WS_EDIT_RESOURCE, WSGRP_EDIT_RESOURCE, WSMBR_EDIT_RESOURCE -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if the specified member is authorized to access the specified resource.booleanCheck if the specified member is authorized to access the specified resource IF AND ONLY IF resource has been configured.Retrieve the resources declared in properties.static AccessControlManagerRetrieve the resources allowed to be accessed (those declared in properties and the associated zone).voidhandleCommitUpdate(Storable acl, Storable oldAcl, boolean firstTime) This method gets called when after a storable has been updated.voidhandleCreate(Storable acl, boolean firstTime) This method gets called when a storable is created.voidhandleDelete(Storable acl, boolean firstTime) This method gets called when a storable is deleted.voidCalled when the channel is finalizedvoidhandlePrepareUpdate(Storable acl, Map<String, String> attributes, boolean firstTime) This method gets called when before a storable will be updated.voidinit()voidCalled just after the store has been loaded and the channel has been initialized.voidCalled just before the store has been loaded.protected static booleaninternalCheckWorkspaceDataAccess(String resource, Group aclGroup, Workspace ws, Data data, Member mbr) This method is invoked when a Data ACL has been granted for a member, in such case, we check the minimum requirement to validate the authorization or not.booleanCheck if the specified resources is explicitely configured on at least one ACL instance.voidpropertiesChange(JProperties properties) Invoked after properties have been modified in JCMS and save on disk.voidMethods inherited from class com.jalios.jcms.ChannelListener
compareTo, equals, getOrder, init, initAfterStartup, initBeforeHibernateFactoryBuild
-
Method Details
-
getInstance
-
init
public void init() -
reloadProperties
public void reloadProperties() -
propertiesChange
Description copied from interface:JPropertiesListenerInvoked after properties have been modified in JCMS and save on disk.You cannot alter the value received in parameters.
Note that properties parameter may be null, a limited set of site properties, or all site properties.
To check that a property has been modified, reload the "current" property instead using
channel.getPropertiesorchannel.getProperty.- Specified by:
propertiesChangein interfaceJPropertiesListener- Parameters:
properties- the properties which have been submitted to change
-
initBeforeStoreLoad
Description copied from class:ChannelListenerCalled just before the store has been loaded. If for any reason you want to interrupt JCMS startup, you can throw an exception. The exception's message will be displayed in JCMS status page (to any user!).- Overrides:
initBeforeStoreLoadin classChannelListener- Throws:
Exception- any exception you may want to throw if a problem occurs needing to interrupt JCMS startup.
-
initAfterStoreLoad
Description copied from class:ChannelListenerCalled just after the store has been loaded and the channel has been initialized. If for any reason you want to interrupt JCMS startup, you can throw an exception. The exception's message will be displayed in JCMS status page (to any user!).- Overrides:
initAfterStoreLoadin classChannelListener- Throws:
Exception- any exception you may want to throw if a problem occurs needing to interrupt JCMS startup.
-
handleFinalize
public void handleFinalize()Description copied from class:ChannelListenerCalled when the channel is finalized- Overrides:
handleFinalizein classChannelListener
-
handleCreate
Description copied from interface:StoreListenerThis method gets called when a storable is created.- Specified by:
handleCreatein interfaceStoreListener- Parameters:
acl- the storablefirstTime- true if it is the first time this operation is processed
-
handlePrepareUpdate
Description copied from interface:StoreListenerThis method gets called when before a storable will be updated.
deprecated It should not be used anymore and will be removed from future version.- Specified by:
handlePrepareUpdatein interfaceStoreListener- Parameters:
acl- the storableattributes- the attributes to updatefirstTime- true if it is the first time this operation is processed
-
handleCommitUpdate
Description copied from interface:StoreListenerThis method gets called when after a storable has been updated.- Specified by:
handleCommitUpdatein interfaceStoreListener- Parameters:
acl- the storable, this instance is the object that was created at first and that will be stored in jcms until deletion of the storable with this ID. You should always manipulate this object if you maintain any index.oldAcl- the previous version of the storable, it is a clone, do not use in any index, it should only be used to access old values.firstTime- true if it is the first time this operation is processed
-
handleDelete
Description copied from interface:StoreListenerThis method gets called when a storable is deleted.- Specified by:
handleDeletein interfaceStoreListener- Parameters:
acl- the storablefirstTime- true if it is the first time this operation is processed
-
getDeclaredResources
Retrieve the resources declared in properties.- Returns:
- a Set of resource path.
-
getValidResources
Retrieve the resources allowed to be accessed (those declared in properties and the associated zone).- Returns:
- a Set of resource path.
-
checkAccess
Check if the specified member is authorized to access the specified resource.A valid context map containing the current Workspace is required for all access check on workspace resources (eg resource starting with "admin-ws/" as defined by "admin-ws".
Use utility method for easier invocation :boolean isAuthorized = AccessControlManager.checkAccess(loggedMember, "admin-ws/types/content", AccessControlUtil.getContext(workspace));
A valid context map containing the current Data being edited is required for all access to data resource (as declared in properties). Use utility method for easier invocation :
Map<String,Object> aclContext = AccessControlUtil.getContext(null, AccessControlConstants.CTXT_DATA, someMemberBeingEdited); boolean isAuthorized = AccessControlManager.checkAccess(loggedMember, "admin/users/member", aclContext);
- Parameters:
member- a Memberresource- a resource URI using a path representation, eg "admin/dev/store-cleaner"context- an optional context map containing relevant information such as workspace or data- Returns:
- true if the access is authorized, false otherwise
- Since:
- jcms-7.0.0
-
internalCheckWorkspaceDataAccess
protected static boolean internalCheckWorkspaceDataAccess(String resource, Group aclGroup, Workspace ws, Data data, Member mbr) This method is invoked when a Data ACL has been granted for a member, in such case, we check the minimum requirement to validate the authorization or not.- Parameters:
resource- the resource which granted the edit authorization checkaclGroup- Group to which the ACL edit authorization was attachedws- the current Workspace in which it is being editeddata- the Data being editedmbr- the Member editing- Returns:
- is the authorization is validated or not
- Since:
- jcms-7.0.0
-
checkAccessIfAclExists
Check if the specified member is authorized to access the specified resource IF AND ONLY IF resource has been configured.This method ONLY performs the ACL check when the specified resource has been configured on at least one
AccessControlList, if resource has not been specified explicitely in anyAccessControlList, access is AUTHORIZED..DO NOT use this method for any security related resource that MUST be enforced by an implicit or explicit assignement of the ACL resource to a user. In such case, use
checkAccess(Member, String, Map).Access is always denied to anonymous user.
- Parameters:
member- a Memberresource- a resource URI using a path representation, eg "admin/dev/store-cleaner"context- an optional context map containing relevant information such as workspace or data- Returns:
- true if the access is authorized, false otherwise
- Since:
- jcms-10.0.4 / JCMS-7996
-
isResourceExplicitelyConfiguredInAtLeastOneAcl
Check if the specified resources is explicitely configured on at least one ACL instance.- Parameters:
resource- the resource to check.- Returns:
- true if resource exist in at least one ACL of the site, false if resource was NEVER explicitely been referenced in any ACL.
- Since:
- jcms-10.0.4 / JCMS-7996
-