public class

DefaultPermissionManager

extends Object
implements PermissionManager
java.lang.Object
   ↳ com.atlassian.confluence.security.DefaultPermissionManager

Class Overview

Default implementation of PermissionManager. Delegates all the decision-making to a collection of delegates that handle the per-target-type permission checking.

Summary

[Expand]
Inherited Fields
From interface com.atlassian.confluence.security.PermissionManager
Public Constructors
DefaultPermissionManager()
Public Methods
<X> List<X> getPermittedEntities(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(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> getPermittedEntities(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.
boolean hasCreatePermission(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 hasPermission(User user, Permission permission, Object target)
Determine whether a user has a particular permission against a given target.
boolean hasPermissionNoExemptions(User user, Permission permission, Object target)
Returns true if the user has the specified permission on the target object.
boolean isConfluenceAdministrator(User user)
Determine if the user is a Confluence administrator.
void setContentTypeManager(ContentTypeManager contentTypeManager)
void setDeactivatedUserChecker(DeactivatedUserChecker deactivatedUserChecker)
void setDelegates(Map<StringPermissionDelegate> delegates)
void setOnDemandLicenseManager(OnDemandLicenseManager onDemandLicenseManager)
void setPermissionCheckExemptions(PermissionCheckExemptions permissionCheckExemptions)
void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.confluence.security.PermissionManager

Public Constructors

public DefaultPermissionManager ()

Public Methods

public List<X> getPermittedEntities (User user, Permission permission, Iterator<? extends X> objects, int maxResults)

Filter an iterator based on which entities in the list have a particular permission.

Parameters
user the user seeking permission, or null if the anonymous user is being checked against
permission the permission to check against the objects
objects the objects to check
maxResults the maximum number of permitted entities to retrieve from the iterator (un-permitted entities are not counted)
Returns
  • a new list of those members of the objects list that satisfy the given permission for the user

public List<X> getPermittedEntities (User user, Permission permission, List<? extends X> objects)

Filter a list based on which entities in the list have a particular permission.

Parameters
user the user seeking permission, or null if the anonymous user is being checked against
permission the permission to check against the objects
objects the objects to check
Returns
  • a new list of those members of the objects list that satisfy the given permission for the user

public List<X> getPermittedEntities (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. You may also supply additional criteria through which to filter the iterator.

Parameters
user the user seeking permission, or null if the anonymous user is being checked against
permission the permission to check against the objects
entities the objects to check
maxResults the maximum number of permitted entities to retrieve from the iterator (un-permitted entities are not counted)
otherCriteria a collection of Criterion objects through which the permitted entities must also be filtered
Returns
  • a new list of those members of the objects list that satisfy the given permission for the user

public boolean hasCreatePermission (User user, Object container, Class<?> typeToCreate)

Determine whether a user has permission to create an entity of a particular type within a given container.

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.

Parameters
user the user seeking permission, or null if the anonymous user is being checked against
container the target that the object is being created within. If this object is null, the method will return false
typeToCreate the type of object being created (see above)
Returns
  • true if the user has permission, false otherwise

public boolean hasPermission (User user, Permission permission, Object target)

Determine whether a user has a particular permission against a given target.

Parameters
user the user seeking permission, or null if the anonymous user is being checked against
permission the permission to check
target the object that the permission is being checked against. If this object is null, the method will return false
Returns
  • true if the user has this permission, false otherwise

public boolean hasPermissionNoExemptions (User user, Permission permission, Object target)

Returns true if the user has the specified permission on the target object. Does not allow exemptions for super-users like 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).

public boolean isConfluenceAdministrator (User user)

Determine if the user is a Confluence administrator. Calling this method is identical to calling hasPermission(user, Permission.ADMINISTER, PermissionManager.TARGET_APPLICATION).

Parameters
user the user to check permissions against
Returns
  • true if the user is a Confluence administrator, false otherwise

public void setContentTypeManager (ContentTypeManager contentTypeManager)

public void setDeactivatedUserChecker (DeactivatedUserChecker deactivatedUserChecker)

public void setDelegates (Map<StringPermissionDelegate> delegates)

public void setOnDemandLicenseManager (OnDemandLicenseManager onDemandLicenseManager)

public void setPermissionCheckExemptions (PermissionCheckExemptions permissionCheckExemptions)

public void setSpacePermissionManager (SpacePermissionManager spacePermissionManager)