public class AccessControlManager extends ChannelListener implements JPropertiesListener, AccessControlConstants, StoreListener
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REVISION |
order
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
Modifier and Type | Method and Description |
---|---|
boolean |
checkAccess(Member member,
java.lang.String resource,
java.util.Map<java.lang.String,java.lang.Object> context)
Check if the specified member is authorized to access the specified resource.
|
boolean |
checkAccessIfAclExists(Member member,
java.lang.String resource,
java.util.Map<java.lang.String,java.lang.Object> context)
Check if the specified member is authorized to access the specified resource IF AND ONLY IF resource has been configured.
|
java.util.Set<java.lang.String> |
getDeclaredResources()
Retrieve the resources declared in properties.
|
static AccessControlManager |
getInstance() |
java.util.Set<java.lang.String> |
getValidResources()
Retrieve the resources allowed to be accessed (those declared in properties and the associated zone).
|
void |
handleCommitUpdate(Storable acl,
Storable oldAcl,
boolean firstTime)
This method gets called when after a storable has been updated.
|
void |
handleCreate(Storable acl,
boolean firstTime)
This method gets called when a storable is created.
|
void |
handleDelete(Storable acl,
boolean firstTime)
This method gets called when a storable is deleted.
|
void |
handleFinalize()
Called when the channel is finalized
|
void |
handlePrepareUpdate(Storable acl,
java.util.Map<java.lang.String,java.lang.String> attributes,
boolean firstTime)
This method gets called when before a storable will be updated.
|
void |
init() |
void |
initAfterStoreLoad()
Called just after the store has been loaded and
the channel has been initialized.
|
void |
initBeforeStoreLoad()
Called just before the store has been loaded.
|
protected static boolean |
internalCheckWorkspaceDataAccess(java.lang.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.
|
void |
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk.
|
void |
reloadProperties() |
compareTo, equals, init, initAfterStartup
public static final java.lang.String REVISION
public static AccessControlManager getInstance()
public void init()
public void reloadProperties()
public void propertiesChange(JProperties properties)
JPropertiesListener
You cannot alter the value received in parameters.
propertiesChange
in interface JPropertiesListener
properties
- the properties which have been modified (may not contain all JCMS properties)public void initBeforeStoreLoad() throws java.lang.Exception
ChannelListener
initBeforeStoreLoad
in class ChannelListener
java.lang.Exception
- any exception you may want to throw if a problem occurs needing to interrupt JCMS startup.public void initAfterStoreLoad() throws java.lang.Exception
ChannelListener
initAfterStoreLoad
in class ChannelListener
java.lang.Exception
- any exception you may want to throw if a problem occurs needing to interrupt JCMS startup.public void handleFinalize()
ChannelListener
handleFinalize
in class ChannelListener
public void handleCreate(Storable acl, boolean firstTime)
StoreListener
handleCreate
in interface StoreListener
acl
- the storablefirstTime
- true if it is the first time this operation is processedpublic void handlePrepareUpdate(Storable acl, java.util.Map<java.lang.String,java.lang.String> attributes, boolean firstTime)
StoreListener
handlePrepareUpdate
in interface StoreListener
acl
- the storableattributes
- the attributes to updatefirstTime
- true if it is the first time this operation is processedpublic void handleCommitUpdate(Storable acl, Storable oldAcl, boolean firstTime)
StoreListener
handleCommitUpdate
in interface StoreListener
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 processedpublic void handleDelete(Storable acl, boolean firstTime)
StoreListener
handleDelete
in interface StoreListener
acl
- the storablefirstTime
- true if it is the first time this operation is processedpublic java.util.Set<java.lang.String> getDeclaredResources()
public java.util.Set<java.lang.String> getValidResources()
public boolean checkAccess(Member member, java.lang.String resource, java.util.Map<java.lang.String,java.lang.Object> context)
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);
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 dataprotected static boolean internalCheckWorkspaceDataAccess(java.lang.String resource, Group aclGroup, Workspace ws, Data data, Member mbr)
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 editingpublic boolean checkAccessIfAclExists(Member member, java.lang.String resource, java.util.Map<java.lang.String,java.lang.Object> context)
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 any AccessControlList
, 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.
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 dataCopyright © 2001-2021 Jalios SA. All Rights Reserved.