Class AuthorizablePrivilegesInfoImpl
- java.lang.Object
-
- org.apache.sling.jackrabbit.usermanager.impl.AuthorizablePrivilegesInfoImpl
-
- All Implemented Interfaces:
AuthorizablePrivilegesInfo
public class AuthorizablePrivilegesInfoImpl extends Object implements AuthorizablePrivilegesInfo
Helper class to assist in the usage of access control of users/groups from scripts. The default access control policy defined by this provider has the following characteristics:- everybody has READ permission to all items,
- every known user is allowed to modify it's own properties except for her/his group membership,
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.sling.jackrabbit.usermanager.AuthorizablePrivilegesInfo
AuthorizablePrivilegesInfo.PropertyUpdateTypes
-
-
Constructor Summary
Constructors Constructor Description AuthorizablePrivilegesInfoImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate(org.osgi.framework.BundleContext bundleContext, Map<String,Object> properties)booleancanAddGroup(javax.jcr.Session jcrSession)Checks whether the current user has been granted privileges to add a new group.booleancanAddUser(javax.jcr.Session jcrSession)Checks whether the current user has been granted privileges to add a new user.booleancanChangePassword(javax.jcr.Session jcrSession, String userId)Checks whether the current user has been granted privileges to change the password of the specified user.booleancanDisable(javax.jcr.Session jcrSession, String userId)Checks whether the current user has been granted privileges to disable the specified user.booleancanRemove(javax.jcr.Session jcrSession, String principalId)Checks whether the current user has been granted privileges to remove the specified user or group.booleancanUpdateGroupMembers(javax.jcr.Session jcrSession, String groupId)Checks whether the current user has been granted privileges to update the membership of the specified group.booleancanUpdateProperties(javax.jcr.Session jcrSession, String principalId)Checks whether the current user has been granted privileges to update the properties of the specified user or group.booleancanUpdateProperties(javax.jcr.Session jcrSession, String principalId, AuthorizablePrivilegesInfo.PropertyUpdateTypes... propertyUpdateTypes)Checks whether the current user has been granted privileges to update the properties of the specified user or group.
-
-
-
Method Detail
-
canAddGroup
public boolean canAddGroup(javax.jcr.Session jcrSession)
Description copied from interface:AuthorizablePrivilegesInfoChecks whether the current user has been granted privileges to add a new group.- Specified by:
canAddGroupin interfaceAuthorizablePrivilegesInfo- Parameters:
jcrSession- the JCR session of the current user- Returns:
- true if the current user has the privileges, false otherwise
-
canAddUser
public boolean canAddUser(javax.jcr.Session jcrSession)
Description copied from interface:AuthorizablePrivilegesInfoChecks whether the current user has been granted privileges to add a new user.- Specified by:
canAddUserin interfaceAuthorizablePrivilegesInfo- Parameters:
jcrSession- the JCR session of the current user- Returns:
- true if the current user has the privileges, false otherwise
-
canRemove
public boolean canRemove(javax.jcr.Session jcrSession, String principalId)Description copied from interface:AuthorizablePrivilegesInfoChecks whether the current user has been granted privileges to remove the specified user or group.- Specified by:
canRemovein interfaceAuthorizablePrivilegesInfo- Parameters:
jcrSession- the JCR session of the current userprincipalId- the user or group id to check- Returns:
- true if the current user has the privileges, false otherwise
-
canUpdateGroupMembers
public boolean canUpdateGroupMembers(javax.jcr.Session jcrSession, String groupId)Description copied from interface:AuthorizablePrivilegesInfoChecks whether the current user has been granted privileges to update the membership of the specified group.- Specified by:
canUpdateGroupMembersin interfaceAuthorizablePrivilegesInfo- Parameters:
jcrSession- the JCR session of the current usergroupId- the group id to check- Returns:
- true if the current user has the privileges, false otherwise
-
canUpdateProperties
public boolean canUpdateProperties(javax.jcr.Session jcrSession, String principalId)Description copied from interface:AuthorizablePrivilegesInfoChecks whether the current user has been granted privileges to update the properties of the specified user or group. Equivalent of: #canUpdateProperties(Session, String, PropertyUpdateTypes.addProperty, PropertyUpdateTypes.addNestedProperty, PropertyUpdateTypes.alterProperty, PropertyUpdateTypes.removeProperty)- Specified by:
canUpdatePropertiesin interfaceAuthorizablePrivilegesInfo- Parameters:
jcrSession- the JCR session of the current userprincipalId- the user or group id to check- Returns:
- true if the current user has the privileges, false otherwise
-
canUpdateProperties
public boolean canUpdateProperties(javax.jcr.Session jcrSession, String principalId, AuthorizablePrivilegesInfo.PropertyUpdateTypes... propertyUpdateTypes)Description copied from interface:AuthorizablePrivilegesInfoChecks whether the current user has been granted privileges to update the properties of the specified user or group.- Specified by:
canUpdatePropertiesin interfaceAuthorizablePrivilegesInfo- Parameters:
jcrSession- the JCR session of the current userprincipalId- the user or group id to checkpropertyUpdateTypes- specify the types of property updates that may be supplied. See:AuthorizablePrivilegesInfo.PropertyUpdateTypes- Returns:
- true if the current user has the privileges, false otherwise
-
canDisable
public boolean canDisable(javax.jcr.Session jcrSession, String userId)Description copied from interface:AuthorizablePrivilegesInfoChecks whether the current user has been granted privileges to disable the specified user.- Specified by:
canDisablein interfaceAuthorizablePrivilegesInfo- Parameters:
jcrSession- the JCR session of the current useruserId- the user id to check- Returns:
- true if the current user has the privileges, false otherwise
-
canChangePassword
public boolean canChangePassword(javax.jcr.Session jcrSession, String userId)Description copied from interface:AuthorizablePrivilegesInfoChecks whether the current user has been granted privileges to change the password of the specified user.- Specified by:
canChangePasswordin interfaceAuthorizablePrivilegesInfo- Parameters:
jcrSession- the JCR session of the current useruserId- the user id to check- Returns:
- true if the current user has the privileges, false otherwise
-
activate
protected void activate(org.osgi.framework.BundleContext bundleContext, Map<String,Object> properties) throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException, UnsupportedEncodingException
-
-