Class ReadOnlySpacePermissionManager
- java.lang.Object
-
- com.atlassian.confluence.security.ReadOnlySpacePermissionManager
-
- All Implemented Interfaces:
SpacePermissionManagerInternal
,SpacePermissionSaverInternal
,SpacePermissionManager
,SpacePermissionSaver
@ParametersAreNonnullByDefault public class ReadOnlySpacePermissionManager extends Object implements SpacePermissionManagerInternal
-
-
Constructor Summary
Constructors Constructor Description ReadOnlySpacePermissionManager(SpacePermissionManager spacePermissionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
createDefaultSpacePermissions(Space space)
void
createPrivateSpacePermissions(Space space)
void
flushCaches()
List<SpacePermission>
getAllPermissionsForGroup(String arg0)
Set<SpacePermission>
getDefaultGlobalPermissions()
Returns the default global permissions that are created when Confluence is set up.List<SpacePermission>
getGlobalPermissions()
List<SpacePermission>
getGlobalPermissions(String arg0)
Map<String,Long>
getGroupsForPermissionType(String arg0, Space arg1)
Collection<com.atlassian.user.Group>
getGroupsWithPermissions(@Nullable Space arg0)
Returns all groups which have permissions in a space or on a global level.Map<String,Long>
getUsersForPermissionType(String arg0, Space arg1)
Collection<com.atlassian.user.User>
getUsersWithPermissions(@Nullable Space arg0)
Returns a collection of user objects with VIEWSPACE_PERMISSION in the space.boolean
groupHasPermission(String arg0, @Nullable Space arg1, String arg2)
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 arg0, @Nullable Space arg1, @Nullable com.atlassian.user.User arg2)
Determines if remoteUser has the given permission in spaceboolean
hasPermissionForSpace(@Nullable com.atlassian.user.User arg0, List arg1, @Nullable Space arg2)
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 arg0)
Check whether the given SpacePermission exists.void
removeAllPermissions(Space space)
Deprecated.void
removeAllPermissions(Space space, SpacePermissionContext context)
Removes all permissions belonging to spacevoid
removeAllPermissionsForGroup(String group)
Deprecated.void
removeAllPermissionsForGroup(String group, SpacePermissionContext context)
Removes all permissions for the given group.void
removeAllUserPermissions(@NonNull ConfluenceUser user)
Deprecated.void
removeAllUserPermissions(ConfluenceUser user, SpacePermissionContext context)
Removes all permissions for the given user.void
removeGlobalPermissionForUser(ConfluenceUser user, String permissionType)
Deprecated.void
removeGlobalPermissionForUser(ConfluenceUser user, String permissionType, SpacePermissionContext context)
Removes global permission of specified type that is directly associated with a user.void
removePermission(SpacePermission permission)
Deprecated.void
removePermission(SpacePermission permission, SpacePermissionContext context)
Removes the given permission.void
savePermission(SpacePermission permission)
Deprecated.void
savePermission(SpacePermission permission, SpacePermissionContext context)
Saves the permission.
-
-
-
Constructor Detail
-
ReadOnlySpacePermissionManager
public ReadOnlySpacePermissionManager(SpacePermissionManager spacePermissionManager)
-
-
Method Detail
-
createDefaultSpacePermissions
public void createDefaultSpacePermissions(Space space)
- Specified by:
createDefaultSpacePermissions
in interfaceSpacePermissionManager
-
createPrivateSpacePermissions
public void createPrivateSpacePermissions(Space space)
- Specified by:
createPrivateSpacePermissions
in interfaceSpacePermissionManager
-
flushCaches
public void flushCaches()
- Specified by:
flushCaches
in interfaceSpacePermissionManager
-
getAllPermissionsForGroup
public List<SpacePermission> getAllPermissionsForGroup(String arg0)
- Specified by:
getAllPermissionsForGroup
in interfaceSpacePermissionManager
-
getGlobalPermissions
public List<SpacePermission> getGlobalPermissions()
- Specified by:
getGlobalPermissions
in interfaceSpacePermissionManager
-
getGlobalPermissions
public List<SpacePermission> getGlobalPermissions(String arg0)
- Specified by:
getGlobalPermissions
in interfaceSpacePermissionManager
-
getGroupsForPermissionType
public Map<String,Long> getGroupsForPermissionType(String arg0, Space arg1)
- Specified by:
getGroupsForPermissionType
in interfaceSpacePermissionManager
-
getGroupsWithPermissions
public Collection<com.atlassian.user.Group> getGroupsWithPermissions(@Nullable Space arg0)
Description copied from interface:SpacePermissionManager
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.- Specified by:
getGroupsWithPermissions
in interfaceSpacePermissionManager
- Parameters:
arg0
- - space to query, if null global permissions returned- Returns:
- Collection of groups with permissions
-
getUsersForPermissionType
public Map<String,Long> getUsersForPermissionType(String arg0, Space arg1)
- Specified by:
getUsersForPermissionType
in interfaceSpacePermissionManager
-
getUsersWithPermissions
public Collection<com.atlassian.user.User> getUsersWithPermissions(@Nullable Space arg0)
Description copied from interface:SpacePermissionManager
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- Specified by:
getUsersWithPermissions
in interfaceSpacePermissionManager
- Parameters:
arg0
- - space to query, if null global permissions returned- Returns:
- Collection of User objects
-
groupHasPermission
public boolean groupHasPermission(String arg0, @Nullable Space arg1, String arg2)
Description copied from interface:SpacePermissionManager
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.
- Specified by:
groupHasPermission
in interfaceSpacePermissionManager
- Parameters:
arg0
- The permission type to look uparg1
- The space the permission applies to (can be null for global permissions)arg2
- The group to look up the permission for- Returns:
- true if the group has the required permission, false otherwise
-
hasPermission
public boolean hasPermission(String arg0, @Nullable Space arg1, @Nullable com.atlassian.user.User arg2)
Description copied from interface:SpacePermissionManager
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.- Specified by:
hasPermission
in interfaceSpacePermissionManager
- Parameters:
arg0
- The permission type to look uparg1
- The space the permission applies to (can be null for global permissions)arg2
- The user to look up (can be null for the anonymous user)- Returns:
- true if remoteUser has the permission, false otherwise
-
hasPermissionNoExemptions
public boolean hasPermissionNoExemptions(String permissionType, @Nullable Space space, @Nullable com.atlassian.user.User remoteUser)
Description copied from interface:SpacePermissionManager
Returns 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:
hasPermissionNoExemptions
in interfaceSpacePermissionManager
-
hasAllPermissions
public boolean hasAllPermissions(List<String> permissionTypes, @Nullable Space space, @Nullable com.atlassian.user.User user)
Description copied from interface:SpacePermissionManager
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.- Specified by:
hasAllPermissions
in 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
-
hasPermissionForSpace
public boolean hasPermissionForSpace(@Nullable com.atlassian.user.User arg0, List arg1, @Nullable Space arg2)
- Specified by:
hasPermissionForSpace
in interfaceSpacePermissionManager
-
permissionExists
public boolean permissionExists(SpacePermission arg0)
Description copied from interface:SpacePermissionManager
Check whether the given SpacePermission exists. Checks by attribute equality rather than by id.- Specified by:
permissionExists
in interfaceSpacePermissionManager
- Parameters:
arg0
- the permission to look for.- Returns:
- true if the permission is recognised by the manager as existing.
-
getDefaultGlobalPermissions
public Set<SpacePermission> getDefaultGlobalPermissions()
Description copied from interface:SpacePermissionManager
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.
- Specified by:
getDefaultGlobalPermissions
in interfaceSpacePermissionManager
- Returns:
- a collection of
SpacePermission
s.
-
isPermittedInReadOnlyAccessMode
public boolean isPermittedInReadOnlyAccessMode(String permissionType)
Description copied from interface:SpacePermissionManager
Check if the permission type is permitted in read only access mode- Specified by:
isPermittedInReadOnlyAccessMode
in interfaceSpacePermissionManager
- Parameters:
permissionType
- the permission type to be checked- Returns:
- true if the permission type is permitted in read only access mode
-
removeAllPermissions
@Deprecated public void removeAllPermissions(Space space)
Deprecated.Description copied from interface:SpacePermissionManager
Removes all permissions belonging to space- Specified by:
removeAllPermissions
in interfaceSpacePermissionManager
- Parameters:
space
- The space to remove the permissions for
-
removeAllPermissions
public void removeAllPermissions(Space space, SpacePermissionContext context)
Description copied from interface:SpacePermissionManagerInternal
Removes all permissions belonging to space- Specified by:
removeAllPermissions
in interfaceSpacePermissionManagerInternal
- Parameters:
space
- The space to remove the permissions forcontext
- The context for this removal
-
removeAllPermissionsForGroup
@Deprecated public void removeAllPermissionsForGroup(String group)
Deprecated.Description copied from interface:SpacePermissionManager
Removes all permissions for the given group, and generates aSpacePermissionsRemoveForGroupEvent
in the process.- Specified by:
removeAllPermissionsForGroup
in interfaceSpacePermissionManager
- Parameters:
group
- the group to remove
-
removeAllPermissionsForGroup
public void removeAllPermissionsForGroup(String group, SpacePermissionContext context)
Description copied from interface:SpacePermissionManagerInternal
Removes all permissions for the given group.May generate a
SpacePermissionsRemoveForGroupEvent
in the process, depending on the context.- Specified by:
removeAllPermissionsForGroup
in interfaceSpacePermissionManagerInternal
- Parameters:
group
- the group to remove
-
removeAllUserPermissions
@Deprecated public void removeAllUserPermissions(@NonNull ConfluenceUser user)
Deprecated.Description copied from interface:SpacePermissionManager
Removes all permissions for the given user, and generates aSpacePermissionsRemoveForUserEvent
in the process.- Specified by:
removeAllUserPermissions
in interfaceSpacePermissionManager
-
removeAllUserPermissions
public void removeAllUserPermissions(ConfluenceUser user, SpacePermissionContext context)
Description copied from interface:SpacePermissionManagerInternal
Removes all permissions for the given user.May generate a
SpacePermissionsRemoveForUserEvent
in the process, depending on the context.- Specified by:
removeAllUserPermissions
in interfaceSpacePermissionManagerInternal
- Parameters:
user
- the user to remove permissions forcontext
- the context for the removal
-
removeGlobalPermissionForUser
@Deprecated public void removeGlobalPermissionForUser(ConfluenceUser user, String permissionType)
Deprecated.Description copied from interface:SpacePermissionManager
Removes global permission of specified type that is directly associated with a user, and generates aSpacePermissionsRemoveForUserEvent
in the process.- Specified by:
removeGlobalPermissionForUser
in interfaceSpacePermissionManager
- Parameters:
user
- the user to look uppermissionType
- the permission type to remove
-
removeGlobalPermissionForUser
public void removeGlobalPermissionForUser(ConfluenceUser user, String permissionType, SpacePermissionContext context)
Description copied from interface:SpacePermissionManagerInternal
Removes global permission of specified type that is directly associated with a user.May generate a
SpacePermissionsRemoveForUserEvent
in the process, depending on the context.- Specified by:
removeGlobalPermissionForUser
in interfaceSpacePermissionManagerInternal
- Parameters:
user
- the user to look uppermissionType
- the permission type to removecontext
- the context for the removal
-
removePermission
@Deprecated public void removePermission(SpacePermission permission)
Deprecated.Description copied from interface:SpacePermissionManager
Removes the given permission, and generates aSpacePermissionRemoveEvent
in the process.- Specified by:
removePermission
in interfaceSpacePermissionManager
- Parameters:
permission
- the permission to remove
-
removePermission
public void removePermission(SpacePermission permission, SpacePermissionContext context)
Description copied from interface:SpacePermissionManagerInternal
Removes the given permission.May generate a
SpacePermissionRemoveEvent
in the process, depending on the context.- Specified by:
removePermission
in interfaceSpacePermissionManagerInternal
- Parameters:
permission
- the permission to removecontext
- the context for the removal
-
savePermission
@Deprecated public void savePermission(SpacePermission permission)
Deprecated.Description copied from interface:SpacePermissionSaver
Saves the permission, and generates aSpacePermissionSaveEvent
in the process.- Specified by:
savePermission
in interfaceSpacePermissionSaver
-
savePermission
public void savePermission(SpacePermission permission, SpacePermissionContext context)
Description copied from interface:SpacePermissionSaverInternal
Saves the permission.May generate a
SpacePermissionSaveEvent
in the process, depending on the context.- Specified by:
savePermission
in interfaceSpacePermissionSaverInternal
- Parameters:
permission
- the permission to savecontext
- the context for the save
-
-