@ParametersAreNonnullByDefault public class SpacePermissionCoordinator extends Object implements SpacePermissionManagerInternal
PermissionManager
and SetSpacePermissionChecker
before forwarding the call to the underlying space permission manager.Constructor and Description |
---|
SpacePermissionCoordinator() |
Modifier and Type | Method and 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 permission
|
boolean |
hasAllPermissions(List<String> permissionTypes,
@Nullable Space space,
@Nullable com.atlassian.user.User remoteUser)
Determines if remoteUser has all of the given permissions in space
|
boolean |
hasPermission(String permissionType,
@Nullable Space space,
@Nullable com.atlassian.user.User remoteUser)
Determines if remoteUser has the given permission in space
|
boolean |
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 mode
|
boolean |
permissionExists(SpacePermission permission)
Check whether the given SpacePermission exists.
|
void |
removeAllPermissions(Space space)
Deprecated.
|
void |
removeAllPermissions(Space space,
SpacePermissionContext context)
Removes all
SpacePermission 's from the specified space. |
void |
removeAllPermissionsForGroup(String groupName)
Removes all the
SpacePermission 's for the specified group. |
void |
removeAllPermissionsForGroup(String groupName,
SpacePermissionContext context)
Removes all permissions for the given group.
|
void |
removeAllUserPermissions(@NonNull ConfluenceUser user)
Removes all the
SpacePermission 's for the specified user. |
void |
removeAllUserPermissions(ConfluenceUser user,
SpacePermissionContext context)
Removes all the
SpacePermission 's for the specified user. |
void |
removeGlobalPermissionForUser(ConfluenceUser user,
String permissionType)
Removes the specified Global Permissions of type 'permissionType' from the user
|
void |
removeGlobalPermissionForUser(ConfluenceUser user,
String permissionType,
SpacePermissionContext context)
Removes the specified Global Permissions of type 'permissionType' from the user
|
void |
removePermission(SpacePermission permission)
Deprecated.
|
void |
removePermission(SpacePermission permission,
SpacePermissionContext context)
Removes the specified permission.
|
void |
savePermission(SpacePermission permission)
Deprecated.
|
void |
savePermission(SpacePermission permission,
SpacePermissionContext context)
Saves the permission.
|
void |
setGroupManager(com.atlassian.user.GroupManager groupManager) |
void |
setPermissionManager(PermissionManager permissionManager) |
void |
setSetSpacePermissionChecker(SetSpacePermissionChecker setSpacePermissionChecker) |
void |
setSpacePermissionManager(SpacePermissionManagerInternal spacePermissionManager) |
void |
setUserManager(com.atlassian.user.UserManager userManager) |
@Deprecated public void savePermission(SpacePermission permission)
savePermission
in interface SpacePermissionSaver
InsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check SetSpacePermissionChecker.canSetPermission(User, SpacePermission)
first.public void savePermission(SpacePermission permission, SpacePermissionContext context)
SpacePermissionSaverInternal
May generate a SpacePermissionSaveEvent
in the process,
depending on the context.
savePermission
in interface SpacePermissionSaverInternal
permission
- the permission to savecontext
- the context for the save@Deprecated public void removeAllPermissions(Space space)
SpacePermission
's from the specified space.removeAllPermissions
in interface SpacePermissionManager
space
- The space to remove the permissions forInsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check Permission.SET_PERMISSIONS
on PermissionManager
first.public void removeAllPermissions(Space space, SpacePermissionContext context)
SpacePermission
's from the specified space.removeAllPermissions
in interface SpacePermissionManagerInternal
space
- The space to remove the permissions forcontext
- The context for this removalInsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check Permission.SET_PERMISSIONS
on PermissionManager
first.@Deprecated public void removePermission(SpacePermission permission)
removePermission
in interface SpacePermissionManager
permission
- the permission to removeInsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check SetSpacePermissionChecker.canSetPermission(User, SpacePermission)
first.public void removePermission(SpacePermission permission, SpacePermissionContext context)
removePermission
in interface SpacePermissionManagerInternal
permission
- the permission to removecontext
- the context for the removalInsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check SetSpacePermissionChecker.canSetPermission(User, SpacePermission)
first.public void createDefaultSpacePermissions(Space space)
createDefaultSpacePermissions
in interface SpacePermissionManager
public void createPrivateSpacePermissions(Space space)
createPrivateSpacePermissions
in interface SpacePermissionManager
public void removeAllUserPermissions(@NonNull ConfluenceUser user)
SpacePermission
's for the specified user.removeAllUserPermissions
in interface SpacePermissionManager
InsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check Permission.SET_PERMISSIONS
using PermissionManager
first.public void removeAllUserPermissions(ConfluenceUser user, SpacePermissionContext context)
SpacePermission
's for the specified user.removeAllUserPermissions
in interface SpacePermissionManagerInternal
user
- the user to remove permissions forcontext
- the context for the removalInsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check Permission.SET_PERMISSIONS
using PermissionManager
first.public void removeGlobalPermissionForUser(ConfluenceUser user, String permissionType)
removeGlobalPermissionForUser
in interface SpacePermissionManager
user
- the user to look uppermissionType
- the permission type to removeInsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check Permission.SET_PERMISSIONS
using PermissionManager
first.public void removeGlobalPermissionForUser(ConfluenceUser user, String permissionType, SpacePermissionContext context)
removeGlobalPermissionForUser
in interface SpacePermissionManagerInternal
user
- the user to look uppermissionType
- the permission type to removecontext
- the context for the removalInsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check Permission.SET_PERMISSIONS
using PermissionManager
first.public void removeAllPermissionsForGroup(String groupName)
SpacePermission
's for the specified group.removeAllPermissionsForGroup
in interface SpacePermissionManager
groupName
- the group to removeInsufficientPrivilegeException
- if the current logged in user does not have sufficient permissions to do this. Check Permission.SET_PERMISSIONS
using PermissionManager
first.EntityRuntimeException
- if there is an error retrieving the group with the specified group namepublic void removeAllPermissionsForGroup(String groupName, SpacePermissionContext context)
SpacePermissionManagerInternal
May generate a SpacePermissionsRemoveForGroupEvent
in
the process, depending on the context.
removeAllPermissionsForGroup
in interface SpacePermissionManagerInternal
groupName
- the group to removepublic boolean hasPermission(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser)
SpacePermissionManager
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.
hasPermission
in interface SpacePermissionManager
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)public boolean hasPermissionNoExemptions(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser)
SpacePermissionManager
SpacePermissionManager.hasPermission(String, Space, User)
does.
For parameter and return value information, see SpacePermissionManager.hasPermission(String, Space, User)
.
hasPermissionNoExemptions
in interface SpacePermissionManager
public boolean hasAllPermissions(List<String> permissionTypes, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser)
SpacePermissionManager
If 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.
hasAllPermissions
in interface SpacePermissionManager
permissionTypes
- A List of permission types (see SpacePermission) to checkspace
- The space the permissions apply toremoteUser
- The user to look uppublic List<SpacePermission> getAllPermissionsForGroup(String group)
getAllPermissionsForGroup
in interface SpacePermissionManager
public List<SpacePermission> getGlobalPermissions()
getGlobalPermissions
in interface SpacePermissionManager
public List<SpacePermission> getGlobalPermissions(String permissionType)
getGlobalPermissions
in interface SpacePermissionManager
public void flushCaches()
flushCaches
in interface SpacePermissionManager
public boolean groupHasPermission(String permissionType, @Nullable Space space, String group)
SpacePermissionManager
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.
groupHasPermission
in interface SpacePermissionManager
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 forpublic boolean hasPermissionForSpace(@Nullable com.atlassian.user.User user, List permissionTypes, @Nullable Space space)
hasPermissionForSpace
in interface SpacePermissionManager
public Collection<com.atlassian.user.Group> getGroupsWithPermissions(@Nullable Space space)
SpacePermissionManager
getGroupsWithPermissions
in interface SpacePermissionManager
space
- - space to query, if null global permissions returnedpublic Map<String,Long> getGroupsForPermissionType(String permissionType, Space space)
getGroupsForPermissionType
in interface SpacePermissionManager
public Collection<com.atlassian.user.User> getUsersWithPermissions(@Nullable Space space)
SpacePermissionManager
getUsersWithPermissions
in interface SpacePermissionManager
space
- - space to query, if null global permissions returnedpublic Map<String,Long> getUsersForPermissionType(String permissionType, Space space)
getUsersForPermissionType
in interface SpacePermissionManager
public boolean permissionExists(SpacePermission permission)
SpacePermissionManager
permissionExists
in interface SpacePermissionManager
permission
- the permission to look for.public Set<SpacePermission> getDefaultGlobalPermissions()
SpacePermissionManager
By default, confluence-administrators group has admin access, the default confluence users group can view the system and anonymous access is disabled.
getDefaultGlobalPermissions
in interface SpacePermissionManager
SpacePermission
s.public boolean isPermittedInReadOnlyAccessMode(String permissionType)
SpacePermissionManager
isPermittedInReadOnlyAccessMode
in interface SpacePermissionManager
permissionType
- the permission type to be checkedpublic void setPermissionManager(PermissionManager permissionManager)
public void setSpacePermissionManager(SpacePermissionManagerInternal spacePermissionManager)
public void setSetSpacePermissionChecker(SetSpacePermissionChecker setSpacePermissionChecker)
public void setUserManager(com.atlassian.user.UserManager userManager)
public void setGroupManager(com.atlassian.user.GroupManager groupManager)
Copyright © 2003–2020 Atlassian. All rights reserved.