Interface SpacePermissionManager
- All Superinterfaces:
SpacePermissionSaver
- All Known Subinterfaces:
SpacePermissionManagerInternal
- All Known Implementing Classes:
AbstractSpacePermissionManager
,CachingSpacePermissionManager
,CoarseGrainedCachingSpacePermissionManager
,DefaultSpacePermissionManager
,DelegatingSpacePermissionManager
,ReadOnlySpacePermissionManager
,RecoveryAwareCachingSpacePermissionManager
,RecoveryAwareCGCachingSpacePermissionManager
,RecoveryAwareSpacePermissionManager
,ScopesAwareSpacePermissionManager
,SpacePermissionCoordinator
PermissionManager
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
getAllPermissionsForGroup
(String group) Returns the default global permissions that are created when Confluence is set up.getGlobalPermissions
(String permissionType) getGroupsForPermissionType
(String permissionType, Space space) Collection<com.atlassian.user.Group>
getGroupsWithPermissions
(@Nullable Space space) Returns all groups which have permissions in a space or on a global level.Get all permissions granted to the anonymous users in the given spacegetPermissionsForGroup
(String group, Space space) Get all permissions for the given group in the specified spacegetPermissionsForUser
(ConfluenceUser user, Space space) Get all permissions for the given user in the specified spacegetUsersForPermissionType
(String permissionType, Space space) Collection<com.atlassian.user.User>
getUsersWithPermissions
(@Nullable Space space) Returns a collection of user objects with VIEWSPACE_PERMISSION in the space.boolean
groupHasPermission
(String permissionType, @Nullable Space space, String group) Checks whether the given group has the given permissionboolean
groupInheritsPermission
(String permissionType, @Nullable Space space, String group) Checks whether the given group inherits the given permission and not has it directly.boolean
hasAllPermissions
(List<String> permissionTypes, @Nullable Space space, @Nullable ConfluenceUser user) Determines if remoteUser has all of the given permissions in spacedefault boolean
hasAllPermissions
(List<String> permissionTypes, @Nullable Space space, @Nullable com.atlassian.user.User user) Deprecated.boolean
hasPermission
(String permissionType, @Nullable Space space, @Nullable ConfluenceUser user) Determines if remoteUser has the given permission in spacedefault boolean
hasPermission
(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser) Deprecated.since 8.8 usehasPermission(String, Space, ConfluenceUser)
boolean
hasPermissionForSpace
(@Nullable ConfluenceUser user, List permissionTypes, @Nullable Space space) default boolean
hasPermissionForSpace
(@Nullable com.atlassian.user.User user, List permissionTypes, @Nullable Space space) Deprecated.since 8.8 usaehasPermissionForSpace(ConfluenceUser, List, Space)
boolean
hasPermissionNoExemptions
(String permissionType, @Nullable Space space, @Nullable ConfluenceUser remoteUser) Returns true if the user has the specified permission on the target space.default boolean
hasPermissionNoExemptions
(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser) Deprecated.since 8.8 usehasPermissionNoExemptions(String, Space, ConfluenceUser)
boolean
hasPermissionNoExemptionsExceptViaNestedGroups
(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.boolean
isPermittedInReadOnlyAccessMode
(String permissionType) Check if the permission type is permitted in read only access modeboolean
permissionExists
(SpacePermission permission) Check whether the given SpacePermission exists.void
removeAllPermissions
(Space space) Deprecated.since 5.9.void
Deprecated.since 5.8.void
Deprecated.since 5.9.void
removeGlobalPermissionForUser
(ConfluenceUser user, String permissionType) Deprecated.since 5.9.void
removePermission
(SpacePermission permission) Deprecated.since 5.9.Methods inherited from interface com.atlassian.confluence.security.SpacePermissionSaver
savePermission
-
Method Details
-
removeAllPermissions
Deprecated.Removes all permissions belonging to space- Parameters:
space
- The space to remove the permissions for
-
removePermission
Deprecated.Removes the given permission, and generates aSpacePermissionRemoveEvent
in the process.- Parameters:
permission
- the permission to remove
-
hasPermission
Determines 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
PermissionManager
instead.- Parameters:
permissionType
- The permission type to look upspace
- The space the permission applies to (can be null for global permissions)remoteUser
- The user to look up (can be null for the anonymous user)- Returns:
- true if remoteUser has the permission, false otherwise
- Since:
- 8.8
-
hasPermission
@Deprecated default boolean hasPermission(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser) Deprecated.since 8.8 usehasPermission(String, Space, ConfluenceUser)
Determines 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
PermissionManager
instead.- Parameters:
permissionType
- The permission type to look upspace
- The space the permission applies to (can be null for global permissions)remoteUser
- The user to look up (can be null for the anonymous user)- Returns:
- true if remoteUser has the permission, false otherwise
-
hasPermissionNoExemptions
boolean hasPermissionNoExemptions(String permissionType, @Nullable Space space, @Nullable ConfluenceUser remoteUser) Returns true if the user has the specified permission on the target space. This method does not allow exemptions for super-users likehasPermission(String, Space, User)
does.For parameter and return value information, see
hasPermission(String, Space, User)
.- Since:
- 8.8
-
hasPermissionNoExemptions
@Deprecated default boolean hasPermissionNoExemptions(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser) Deprecated.since 8.8 usehasPermissionNoExemptions(String, Space, ConfluenceUser)
Returns true if the user has the specified permission on the target space. This method does not allow exemptions for super-users likehasPermission(String, Space, User)
does.For parameter and return value information, see
hasPermission(String, Space, User)
. -
hasPermissionNoExemptionsExceptViaNestedGroups
boolean hasPermissionNoExemptionsExceptViaNestedGroups(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. This method does not allow exemptions for super-users likehasPermission(String, Space, User)
does.For parameter and return value information, see
hasPermission(String, Space, User)
.- Since:
- 10.0
-
hasAllPermissions
boolean hasAllPermissions(List<String> permissionTypes, @Nullable Space space, @Nullable ConfluenceUser user) Determines 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
PermissionManager
instead.- 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
- Since:
- 8.8
-
hasAllPermissions
@Deprecated default boolean hasAllPermissions(List<String> permissionTypes, @Nullable Space space, @Nullable com.atlassian.user.User user) Deprecated.since 8.8 usehasAllPermissions(List, Space, ConfluenceUser)
Determines 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
PermissionManager
instead.- 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
-
removeAllUserPermissions
Deprecated.Removes all permissions for the given user, and generates aSpacePermissionsRemoveForUserEvent
in the process.- Since:
- 5.3
-
removeGlobalPermissionForUser
Deprecated.Removes global permission of specified type that is directly associated with a user, and generates aSpacePermissionsRemoveForUserEvent
in the process.- Parameters:
user
- the user to look uppermissionType
- the permission type to remove- Since:
- 5.4
-
removeAllPermissionsForGroup
Deprecated.Removes all permissions for the given group, and generates aSpacePermissionsRemoveForGroupEvent
in the process.- Parameters:
group
- the group to remove
-
getAllPermissionsForGroup
-
getGlobalPermissions
-
getGlobalPermissions
-
flushCaches
void flushCaches() -
groupHasPermission
Checks 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.
- Parameters:
group
- The group to look up the permission forspace
- The space the permission applies to (can be null for global permissions)permissionType
- The permission type to look up- Returns:
- true if the group has the required permission, false otherwise
-
createDefaultSpacePermissions
-
createPrivateSpacePermissions
-
hasPermissionForSpace
boolean hasPermissionForSpace(@Nullable ConfluenceUser user, List permissionTypes, @Nullable Space space) - Since:
- 8.8
-
hasPermissionForSpace
@Deprecated default boolean hasPermissionForSpace(@Nullable com.atlassian.user.User user, List permissionTypes, @Nullable Space space) Deprecated.since 8.8 usaehasPermissionForSpace(ConfluenceUser, List, Space)
-
getGroupsWithPermissions
@Transactional(readOnly=true) Collection<com.atlassian.user.Group> getGroupsWithPermissions(@Nullable Space space) Returns all groups which have permissions in a space or on a global level. If space is null, permissions on the global level will be checked.- Parameters:
space
- - space to query, if null global permissions returned- Returns:
- Collection of groups with permissions
-
getGroupsForPermissionType
-
getUsersWithPermissions
@Transactional(readOnly=true) Collection<com.atlassian.user.User> getUsersWithPermissions(@Nullable Space space) Returns a collection of user objects with VIEWSPACE_PERMISSION in the space. If no space is provided A list of users with USE_CONFLUENCE_PERMISSION will be returned- Parameters:
space
- - space to query, if null global permissions returned- Returns:
- Collection of User objects
-
getUsersForPermissionType
-
permissionExists
Check whether the given SpacePermission exists. Checks by attribute equality rather than by id.- Parameters:
permission
- the permission to look for.- Returns:
- true if the permission is recognised by the manager as existing.
-
getDefaultGlobalPermissions
Returns 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.
- Returns:
- a collection of
SpacePermission
s.
-
isPermittedInReadOnlyAccessMode
Check if the permission type is permitted in read only access mode- Parameters:
permissionType
- the permission type to be checked- Returns:
- true if the permission type is permitted in read only access mode
-
getPermissionsForUser
@Transactional(readOnly=true) List<SpacePermission> getPermissionsForUser(ConfluenceUser user, Space space) Get all permissions for the given user in the specified space- Parameters:
user
- the user to look upspace
- the space entity- Returns:
- a list of space permissions granted to the user in the given space
- Since:
- 9.1.0
-
getPermissionsForGroup
@Transactional(readOnly=true) List<SpacePermission> getPermissionsForGroup(String group, Space space) Get all permissions for the given group in the specified space- Parameters:
group
- the name of the groupspace
- the space entity- Returns:
- a list of space permissions granted to the group in the given space
- Since:
- 9.1.0
-
getPermissionsForAnonymousUsers
Get all permissions granted to the anonymous users in the given space- Parameters:
space
- the space entity- Returns:
- a list of space permissions granted to anonymous users in the given space
- Since:
- 9.1.0
-
groupInheritsPermission
Checks 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.
- Parameters:
group
- The group to look up the permission forspace
- The space the permission applies to (can be null for global permissions)permissionType
- The permission type to look up- Returns:
- true only if the group inherits the required permission and not has it directly, false otherwise
-
hasAllPermissions(List, Space, ConfluenceUser)