Class AbstractSpacePermissionManager
- All Implemented Interfaces:
SpacePermissionManagerInternal,SpacePermissionSaverInternal,DefaultConfluenceAccessManager.AccessManagerPermissionChecker,SpacePermissionManager,SpacePermissionSaver
- Direct Known Subclasses:
CoarseGrainedCachingSpacePermissionManager,DefaultSpacePermissionManager
- Since:
- 7.16
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSpacePermissionManager(PermissionCheckExemptions permissionCheckExemptions, ConfluenceAccessManager confluenceAccessManager, SpacePermissionAccessMapper spacePermissionAccessMapper, com.atlassian.crowd.embedded.api.CrowdService crowdService, AccessModeManager accessModeManager, GlobalSettingsManager settingsManager) -
Method Summary
Modifier and TypeMethodDescriptionReturns the default global permissions that are created when Confluence is set up.getGroupNamesWithPermission(@Nullable Space targetSpace, String permissionType) booleangroupHasPermission(String permissionType, @Nullable Space space, String group) Checks whether the given group has the given permissionbooleangroupInheritsPermission(String permissionType, @Nullable Space space, String group) Checks whether the given group inherits the given permission and not has it directly.final booleanhasAllPermissions(List<String> permissionTypes, @Nullable Space space, @Nullable ConfluenceUser user) Determines if remoteUser has all of the given permissions in spacefinal booleanhasGlobalPermissionViaGroups(@NonNull ConfluenceUser user, String permissionType) Used byDefaultConfluenceAccessManagervia an awkward circular dependency: hence this method must NOT call ConfluenceAccessManager.final booleanhasPermission(String permissionType, @Nullable Space space, @Nullable ConfluenceUser remoteUser) Determines if remoteUser has the given permission in spacefinal booleanhasPermissionForSpace(@Nullable ConfluenceUser user, List permissionTypes, @Nullable Space space) booleanhasPermissionNoExemptions(String permissionType, @Nullable Space space, @Nullable ConfluenceUser remoteUser) Returns true if the user has the specified permission on the target space.booleanhasPermissionNoExemptionsExceptViaNestedGroups(String permissionType, @Nullable Space space, @Nullable ConfluenceUser remoteUser) Returns true if the user has the specified permission on the target space except if it gets it from some parent of its parent group.booleanisPermittedInReadOnlyAccessMode(String permissionType) Check if the permission type is permitted in read only access modeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.confluence.security.access.DefaultConfluenceAccessManager.AccessManagerPermissionChecker
hasGlobalPermissionViaGroups, permissionExistsMethods inherited from interface com.atlassian.confluence.security.SpacePermissionManager
createDefaultSpacePermissions, createPrivateSpacePermissions, flushCaches, getAllPermissionsForGroup, getGlobalPermissions, getGlobalPermissions, getGroupsForPermissionType, getGroupsWithPermissions, getPermissionsForAnonymousUsers, getPermissionsForGroup, getPermissionsForUser, getUsersForPermissionType, getUsersWithPermissions, hasAllPermissions, hasPermission, hasPermissionForSpace, hasPermissionNoExemptions, permissionExists, removeAllPermissions, removeAllPermissionsForGroup, removeAllUserPermissions, removeGlobalPermissionForUser, removePermissionMethods inherited from interface com.atlassian.confluence.internal.security.SpacePermissionManagerInternal
removeAllPermissions, removeAllPermissionsForGroup, removeAllUserPermissions, removeGlobalPermissionForUser, removePermission, removePermissionsMethods inherited from interface com.atlassian.confluence.security.SpacePermissionSaver
savePermissionMethods inherited from interface com.atlassian.confluence.internal.security.SpacePermissionSaverInternal
saveGlobalPermissions, savePermission, saveSpacePermissions
-
Constructor Details
-
AbstractSpacePermissionManager
protected AbstractSpacePermissionManager(PermissionCheckExemptions permissionCheckExemptions, ConfluenceAccessManager confluenceAccessManager, SpacePermissionAccessMapper spacePermissionAccessMapper, com.atlassian.crowd.embedded.api.CrowdService crowdService, AccessModeManager accessModeManager, GlobalSettingsManager settingsManager)
-
-
Method Details
-
hasPermission
public final boolean hasPermission(String permissionType, @Nullable Space space, @Nullable ConfluenceUser remoteUser) Description copied from interface:SpacePermissionManagerDetermines if remoteUser has the given permission in spaceUnless you're writing code that is part of the permission checking implementation, or you're changing space permissions, you should be using
PermissionManagerinstead.- Specified by:
hasPermissionin interfaceSpacePermissionManager- Parameters:
permissionType- The permission type to look upspace- The space the permission applies to (can be null for global permissions)- Returns:
- true if remoteUser has the permission, false otherwise
-
hasPermissionNoExemptions
public boolean hasPermissionNoExemptions(String permissionType, @Nullable Space space, @Nullable ConfluenceUser remoteUser) Description copied from interface:SpacePermissionManagerReturns true if the user has the specified permission on the target space. This method does not allow exemptions for super-users likeSpacePermissionManager.hasPermission(String, Space, User)does.For parameter and return value information, see
SpacePermissionManager.hasPermission(String, Space, User).- Specified by:
hasPermissionNoExemptionsin interfaceSpacePermissionManager
-
hasPermissionNoExemptionsExceptViaNestedGroups
public boolean hasPermissionNoExemptionsExceptViaNestedGroups(String permissionType, @Nullable Space space, @Nullable ConfluenceUser remoteUser) Description copied from interface:SpacePermissionManagerReturns true if the user has the specified permission on the target space except if it gets it from some parent of its parent group. This method does not allow exemptions for super-users likeSpacePermissionManager.hasPermission(String, Space, User)does.For parameter and return value information, see
SpacePermissionManager.hasPermission(String, Space, User).- Specified by:
hasPermissionNoExemptionsExceptViaNestedGroupsin interfaceSpacePermissionManager
-
hasAllPermissions
public final boolean hasAllPermissions(List<String> permissionTypes, @Nullable Space space, @Nullable ConfluenceUser user) Description copied from interface:SpacePermissionManagerDetermines if remoteUser has all of the given permissions in spaceIf remoteUser lacks any of the given permissions, false is returned.
Unless you're writing code that is part of the permission checking implementation, or you're changing space permissions, you should be using
PermissionManagerinstead.- Specified by:
hasAllPermissionsin interfaceSpacePermissionManager- Parameters:
permissionTypes- A List of permission types (see SpacePermission) to checkspace- The space the permissions apply touser- The user to look up- Returns:
- true if remoteUser has the permission, false otherwise
-
hasGlobalPermissionViaGroups
public final boolean hasGlobalPermissionViaGroups(@NonNull ConfluenceUser user, String permissionType) Used byDefaultConfluenceAccessManagervia an awkward circular dependency: hence this method must NOT call ConfluenceAccessManager.- Specified by:
hasGlobalPermissionViaGroupsin interfaceDefaultConfluenceAccessManager.AccessManagerPermissionCheckerpermissionType- theSpacePermissiontype to look for.- Returns:
- true if the user has this permission specifically via group memberships
-
groupHasPermission
Description copied from interface:SpacePermissionManagerChecks whether the given group has the given permissionIf a null space is specified, this method looks up matching global permissions, otherwise space's permissions list is queried to see if the permission matches.
Similarly, if permissionType is not a space permission, a matching global permission is looked up.
- Specified by:
groupHasPermissionin interfaceSpacePermissionManager- Parameters:
permissionType- The permission type to look upspace- The space the permission applies to (can be null for global permissions)group- The group to look up the permission for- Returns:
- true if the group has the required permission, false otherwise
-
getGroupNamesWithPermission
-
hasPermissionForSpace
public final boolean hasPermissionForSpace(@Nullable ConfluenceUser user, List permissionTypes, @Nullable Space space) - Specified by:
hasPermissionForSpacein interfaceSpacePermissionManager
-
getDefaultGlobalPermissions
Description copied from interface:SpacePermissionManagerReturns the default global permissions that are created when Confluence is set up. These will exist in a newly set up system but may be removed afterwards. Note that the returned objects are freshly created and therefore do not have IDs or other persistence data.By default, confluence-administrators group has admin access, the default confluence users group can view the system and anonymous access is disabled.
- Specified by:
getDefaultGlobalPermissionsin interfaceSpacePermissionManager- Returns:
- a collection of
SpacePermissions.
-
isPermittedInReadOnlyAccessMode
Description copied from interface:SpacePermissionManagerCheck if the permission type is permitted in read only access mode- Specified by:
isPermittedInReadOnlyAccessModein interfaceSpacePermissionManager- Parameters:
permissionType- the permission type to be checked- Returns:
- true if the permission type is permitted in read only access mode
-
groupInheritsPermission
Description copied from interface:SpacePermissionManagerChecks whether the given group inherits the given permission and not has it directly.If a null space is specified, this method looks up matching global permissions, otherwise space's permissions list is queried to see if the permission matches.
Similarly, if permissionType is not a space permission, a matching global permission is looked up.
- Specified by:
groupInheritsPermissionin interfaceSpacePermissionManager- Parameters:
permissionType- The permission type to look upspace- The space the permission applies to (can be null for global permissions)group- The group to look up the permission for- Returns:
- true only if the group inherits the required permission and not has it directly, false otherwise
-