public class DefaultPermissionManager extends Object implements PermissionManager, PermissionDelegateRegistry
PermissionDelegatePermissionManager.CriterionTARGET_APPLICATION, TARGET_PEOPLE_DIRECTORY, TARGET_SYSTEM| Constructor and Description |
|---|
DefaultPermissionManager() |
| Modifier and Type | Method and Description |
|---|---|
<X> List<X> |
getPermittedEntities(com.atlassian.user.User user,
Permission permission,
Iterator<? extends X> objects,
int maxResults)
Filter an iterator based on which entities in the list have a particular permission.
|
<X> List<X> |
getPermittedEntities(com.atlassian.user.User user,
Permission permission,
Iterator<X> entities,
int maxResults,
Collection<? extends PermissionManager.Criterion> otherCriteria)
Filter an iterator based on which entities in the list have a particular permission.
|
<X> List<X> |
getPermittedEntities(com.atlassian.user.User user,
Permission permission,
List<? extends X> objects)
Filter a list based on which entities in the list have a particular permission.
|
<X> List<X> |
getPermittedEntitiesNoExemptions(com.atlassian.user.User user,
Permission permission,
Iterator<? extends X> objects,
int maxResults)
Filter an iterator based on which entities in the list have a particular permission.
|
<X> List<X> |
getPermittedEntitiesNoExemptions(com.atlassian.user.User user,
Permission permission,
Iterator<X> entities,
int maxResults,
Collection<? extends PermissionManager.Criterion> otherCriteria)
Filter an iterator based on which entities in the list have a particular permission.
|
<X> List<X> |
getPermittedEntitiesNoExemptions(com.atlassian.user.User user,
Permission permission,
List<? extends X> objects)
Filter a list based on which entities in the list have a particular permission.
|
boolean |
hasCreatePermission(com.atlassian.user.User user,
Object container,
Class<?> typeToCreate)
Determine whether a user has permission to create an entity of a particular type within a given container.
|
boolean |
hasCreatePermission(com.atlassian.user.User user,
Object container,
Object objectToCreate)
Determine whether a user has permission to create a particular entity within a given container.
|
boolean |
hasMovePermission(com.atlassian.user.User user,
Object source,
Object target,
String movePoint)
Determine whether a user has permission to move a particular entity to a given target.
|
boolean |
hasPermission(com.atlassian.user.User user,
Permission permission,
Class targetType)
Determine whether a user has a particular permission for all instances of the specified target type.
|
boolean |
hasPermission(com.atlassian.user.User user,
Permission permission,
Object target)
Determine whether a user has a particular permission against a given target.
|
boolean |
hasPermissionNoExemptions(com.atlassian.user.User user,
Permission permission,
Object target)
Returns true if the user has the specified permission on the target object.
|
boolean |
hasRemoveHierarchyPermission(com.atlassian.user.User user,
Object target)
Determine whether a user has permission to remove a particular entity and all it children.
|
boolean |
isConfluenceAdministrator(com.atlassian.user.User user)
Determine if the user is a Confluence administrator.
|
boolean |
isSystemAdministrator(com.atlassian.user.User user)
Determine if the user is a system administrator.
|
void |
register(String key,
PermissionDelegate<?> delegate) |
void |
setAccessModeManager(AccessModeManager accessModeManager) |
void |
setConfluenceAccessManager(ConfluenceAccessManager confluenceAccessManager) |
void |
setContentTypeManager(ContentTypeManager contentTypeManager)
Deprecated.
since 7.16 use
setContentTypeModuleResolver(ContentTypeModuleResolver) |
void |
setContentTypeModuleResolver(ContentTypeModuleResolver contentTypeModuleResolver) |
void |
setDelegates(Map<String,PermissionDelegate> delegates)
Deprecated.
since 7.15 use
register(String, PermissionDelegate) |
void |
setPermissionCheckExemptions(PermissionCheckExemptions permissionCheckExemptions) |
void |
setScopesRequestCacheDelegate(ScopesRequestCacheDelegate scopesRequestCache) |
void |
withExemption(Runnable runnable)
Execute the given task with permission exemption.
|
public boolean hasPermission(com.atlassian.user.User user,
Permission permission,
Object target)
PermissionManagerhasPermission in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstpermission - the permission to checktarget - the object that the permission is being checked against. If this object is null, the method
will return falsepublic boolean hasPermission(com.atlassian.user.User user,
Permission permission,
Class targetType)
PermissionManagerhasPermission in interface PermissionManageruser - the userpermission - the permission to check (see PermissiontargetType - the type of the targetpublic boolean hasPermissionNoExemptions(com.atlassian.user.User user,
Permission permission,
Object target)
hasPermission(User, Permission, Object) does.
This implementation should become the default one once the exemption for the 'confluence-administrators' group is removed.
For parameter and return value information, see hasPermission(User, Permission, Object).
hasPermissionNoExemptions in interface PermissionManagerpublic boolean hasCreatePermission(com.atlassian.user.User user,
Object container,
Class<?> typeToCreate)
PermissionManager
The container is the natural container of the object being created. For example, a comment is contained in a page, which is contained within a space. A space is contained within TARGET_APPLICATION.
This overload should not be used when creating CustomContentEntityObject instances. In that case, permission
checks should use PermissionManager.hasCreatePermission(com.atlassian.user.User, Object, Object).
hasCreatePermission in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstcontainer - the target that the object is being created within. If this object is null, the method
will return falsetypeToCreate - the type of object being created (see above)ContentEntityObject.getType()public boolean hasCreatePermission(com.atlassian.user.User user,
Object container,
Object objectToCreate)
PermissionManager
The container is the natural container of the object being created. For example, a comment is contained in a page, which is contained within a space. A space is contained within TARGET_APPLICATION.
This overload is best when creating CustomContentEntityObject instances. Other permission checks should use
PermissionManager.hasCreatePermission(com.atlassian.user.User, Object, Class).
hasCreatePermission in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstcontainer - the target that the object is being created within. If this object is null, the method
will return falseobjectToCreate - the object being created (see above)public <X> List<X> getPermittedEntities(com.atlassian.user.User user, Permission permission, List<? extends X> objects)
PermissionManagergetPermittedEntities in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstpermission - the permission to check against the objectsobjects - the objects to checkpublic <X> List<X> getPermittedEntities(com.atlassian.user.User user, Permission permission, Iterator<? extends X> objects, int maxResults)
PermissionManagergetPermittedEntities in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstpermission - the permission to check against the objectsobjects - the objects to checkmaxResults - the maximum number of permitted entities to retrieve from the iterator (un-permitted entities are not counted)public <X> List<X> getPermittedEntities(com.atlassian.user.User user, Permission permission, Iterator<X> entities, int maxResults, Collection<? extends PermissionManager.Criterion> otherCriteria)
PermissionManagergetPermittedEntities in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstpermission - the permission to check against the objectsentities - the objects to checkmaxResults - the maximum number of permitted entities to retrieve from the iterator (un-permitted entities are not counted)otherCriteria - a collection of PermissionManager.Criterion objects through which the permitted entities must also be filteredpublic <X> List<X> getPermittedEntitiesNoExemptions(com.atlassian.user.User user, Permission permission, List<? extends X> objects)
PermissionManagerPermissionManager.getPermittedEntities(User, Permission, List) does.getPermittedEntitiesNoExemptions in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstpermission - the permission to check against the objectsobjects - the objects to checkpublic <X> List<X> getPermittedEntitiesNoExemptions(com.atlassian.user.User user, Permission permission, Iterator<? extends X> objects, int maxResults)
PermissionManagerPermissionManager.getPermittedEntities(User, Permission, Iterator, int) does.getPermittedEntitiesNoExemptions in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstpermission - the permission to check against the objectsobjects - the objects to checkmaxResults - the maximum number of permitted entities to retrieve from the iterator (un-permitted entities are not counted)public <X> List<X> getPermittedEntitiesNoExemptions(com.atlassian.user.User user, Permission permission, Iterator<X> entities, int maxResults, Collection<? extends PermissionManager.Criterion> otherCriteria)
PermissionManagerPermissionManager.getPermittedEntities(User, Permission, Iterator, int, Collection) does. You may also supply additional
criteria through which to filter the iterator.getPermittedEntitiesNoExemptions in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstpermission - the permission to check against the objectsentities - the objects to checkmaxResults - the maximum number of permitted entities to retrieve from the iterator (un-permitted entities are not counted)otherCriteria - a collection of PermissionManager.Criterion objects through which the permitted entities must also be filteredpublic boolean isConfluenceAdministrator(com.atlassian.user.User user)
PermissionManagerhasPermission(user, Permission.ADMINISTER, PermissionManager.TARGET_APPLICATION).isConfluenceAdministrator in interface PermissionManageruser - the user to check permissions againstpublic boolean isSystemAdministrator(com.atlassian.user.User user)
PermissionManagerhasPermission(user, Permission.ADMINISTER, PermissionManager.TARGET_SYSTEM).isSystemAdministrator in interface PermissionManageruser - the user to check permissions againstpublic void withExemption(Runnable runnable)
PermissionManagerCalls to:
PermissionManager.hasPermission(com.atlassian.user.User, Permission, Object)PermissionManager.hasPermission(com.atlassian.user.User, Permission, Class)PermissionManager.hasCreatePermission(com.atlassian.user.User, Object, Object)PermissionManager.hasCreatePermission(com.atlassian.user.User, Object, Class)SpacePermissionManager and ConfluenceAccessManager,
unless "noExemptions" variants are called.
Use with care.
withExemption in interface PermissionManagerrunnable - task to execute with permission exemption@Deprecated public void setDelegates(Map<String,PermissionDelegate> delegates)
register(String, PermissionDelegate)public void setPermissionCheckExemptions(PermissionCheckExemptions permissionCheckExemptions)
@Deprecated public void setContentTypeManager(ContentTypeManager contentTypeManager)
setContentTypeModuleResolver(ContentTypeModuleResolver)public void setContentTypeModuleResolver(ContentTypeModuleResolver contentTypeModuleResolver)
public void setConfluenceAccessManager(ConfluenceAccessManager confluenceAccessManager)
public void setAccessModeManager(AccessModeManager accessModeManager)
public void setScopesRequestCacheDelegate(ScopesRequestCacheDelegate scopesRequestCache)
public boolean hasMovePermission(com.atlassian.user.User user,
Object source,
Object target,
String movePoint)
PermissionManager
The target is the natural container of the object being moved to. For example, a pages is contained in a page, which is contained within a space. A space is contained within TARGET_APPLICATION.
hasMovePermission in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againstsource - the object and all it descendants is being moved. If this object is null, the method
will return falsetarget - where is the source being moved to (see above)movePoint - indicate where source node and target node relative (i.a before, after, append)public boolean hasRemoveHierarchyPermission(com.atlassian.user.User user,
Object target)
PermissionManager
The target is the natural container of the object being removed. For example, a page and all its descendants in a page, which is contained within a space.
hasRemoveHierarchyPermission in interface PermissionManageruser - the user seeking permission, or null if the anonymous user is being checked againsttarget - where is the object and all its descendant are being removedpublic void register(String key, PermissionDelegate<?> delegate)
register in interface PermissionDelegateRegistryCopyright © 2003–2022 Atlassian. All rights reserved.