Interface SpacePermissionManager
-
- All Superinterfaces:
SpacePermissionSaver
- All Known Subinterfaces:
SpacePermissionManagerInternal
- All Known Implementing Classes:
AbstractSpacePermissionManager
,AbstractSpacePermissionManager
,CachingSpacePermissionManager
,CoarseGrainedCachingSpacePermissionManager
,DefaultSpacePermissionManager
,DefaultSpacePermissionManager
,ReadOnlySpacePermissionManager
,RecoveryAwareCachingSpacePermissionManager
,RecoveryAwareCGCachingSpacePermissionManager
,SpacePermissionCoordinator
@ParametersAreNonnullByDefault @Transactional public interface SpacePermissionManager extends SpacePermissionSaver
Responsible for the addition, modification and removal of space permissions. This interface is not for checking whether a user has permission to do something; for that seePermissionManager
.- See Also:
PermissionManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
createDefaultSpacePermissions(Space space)
void
createPrivateSpacePermissions(Space space)
void
flushCaches()
List<SpacePermission>
getAllPermissionsForGroup(String group)
Set<SpacePermission>
getDefaultGlobalPermissions()
Returns the default global permissions that are created when Confluence is set up.List<SpacePermission>
getGlobalPermissions()
List<SpacePermission>
getGlobalPermissions(String permissionType)
Map<String,Long>
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.Map<String,Long>
getUsersForPermissionType(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
hasAllPermissions(List<String> permissionTypes, @Nullable Space space, @Nullable com.atlassian.user.User user)
Determines if remoteUser has all of the given permissions in spaceboolean
hasPermission(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser)
Determines if remoteUser has the given permission in spaceboolean
hasPermissionForSpace(@Nullable com.atlassian.user.User user, List permissionTypes, @Nullable Space space)
boolean
hasPermissionNoExemptions(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser)
Returns true if the user has the specified permission on the target space.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
removeAllPermissionsForGroup(String group)
Deprecated.since 5.8.void
removeAllUserPermissions(ConfluenceUser user)
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 Detail
-
removeAllPermissions
@Deprecated void removeAllPermissions(Space space)
Deprecated.Removes all permissions belonging to space- Parameters:
space
- The space to remove the permissions for
-
removePermission
@Deprecated void removePermission(SpacePermission permission)
Deprecated.Removes the given permission, and generates aSpacePermissionRemoveEvent
in the process.- Parameters:
permission
- the permission to remove
-
hasPermission
boolean hasPermission(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser)
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 com.atlassian.user.User 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)
.
-
hasAllPermissions
boolean hasAllPermissions(List<String> permissionTypes, @Nullable Space space, @Nullable com.atlassian.user.User 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
-
removeAllUserPermissions
@Deprecated void removeAllUserPermissions(ConfluenceUser user)
Deprecated.Removes all permissions for the given user, and generates aSpacePermissionsRemoveForUserEvent
in the process.- Since:
- 5.3
-
removeGlobalPermissionForUser
@Deprecated void removeGlobalPermissionForUser(ConfluenceUser user, String permissionType)
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 void removeAllPermissionsForGroup(String group)
Deprecated.Removes all permissions for the given group, and generates aSpacePermissionsRemoveForGroupEvent
in the process.- Parameters:
group
- the group to remove
-
getAllPermissionsForGroup
@Transactional(readOnly=true) List<SpacePermission> getAllPermissionsForGroup(String group)
-
getGlobalPermissions
@Transactional(readOnly=true) List<SpacePermission> getGlobalPermissions()
-
getGlobalPermissions
@Transactional(readOnly=true) List<SpacePermission> getGlobalPermissions(String permissionType)
-
flushCaches
void flushCaches()
-
groupHasPermission
boolean groupHasPermission(String permissionType, @Nullable Space space, String group)
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
void createDefaultSpacePermissions(Space space)
-
createPrivateSpacePermissions
void createPrivateSpacePermissions(Space space)
-
hasPermissionForSpace
boolean hasPermissionForSpace(@Nullable com.atlassian.user.User user, List permissionTypes, @Nullable Space 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
@Transactional(readOnly=true) Map<String,Long> getGroupsForPermissionType(String permissionType, Space space)
-
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
@Transactional(readOnly=true) Map<String,Long> getUsersForPermissionType(String permissionType, Space space)
-
permissionExists
boolean permissionExists(SpacePermission permission)
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
@Transactional(readOnly=true) Set<SpacePermission> 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
boolean isPermittedInReadOnlyAccessMode(String permissionType)
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
-
-