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 voidcreateDefaultSpacePermissions(Space space)voidcreatePrivateSpacePermissions(Space space)voidflushCaches()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.booleangroupHasPermission(String arg0, @Nullable Space arg1, String arg2)Checks whether the given group has the given permissionbooleanhasAllPermissions(List<String> permissionTypes, @Nullable Space space, @Nullable ConfluenceUser user)Determines if remoteUser has all of the given permissions in spacebooleanhasPermission(String arg0, @Nullable Space arg1, @Nullable ConfluenceUser arg2)Determines if remoteUser has the given permission in spacebooleanhasPermissionForSpace(@Nullable ConfluenceUser arg0, List arg1, @Nullable Space arg2)booleanhasPermissionNoExemptions(String permissionType, @Nullable Space space, @Nullable ConfluenceUser remoteUser)Returns true if the user has the specified permission on the target space.booleanisPermittedInReadOnlyAccessMode(String permissionType)Check if the permission type is permitted in read only access modebooleanpermissionExists(SpacePermission arg0)Check whether the given SpacePermission exists.voidremoveAllPermissions(Space space)Deprecated.voidremoveAllPermissions(Space space, SpacePermissionContext context)Removes all permissions belonging to spacevoidremoveAllPermissionsForGroup(String group)Deprecated.voidremoveAllPermissionsForGroup(String group, SpacePermissionContext context)Removes all permissions for the given group.voidremoveAllUserPermissions(@NonNull ConfluenceUser user)Deprecated.voidremoveAllUserPermissions(ConfluenceUser user, SpacePermissionContext context)Removes all permissions for the given user.voidremoveGlobalPermissionForUser(ConfluenceUser user, String permissionType)Deprecated.voidremoveGlobalPermissionForUser(ConfluenceUser user, String permissionType, SpacePermissionContext context)Removes global permission of specified type that is directly associated with a user.voidremovePermission(SpacePermission permission)Deprecated.voidremovePermission(SpacePermission permission, SpacePermissionContext context)Removes the given permission.voidsavePermission(SpacePermission permission)Deprecated.voidsavePermission(SpacePermission permission, SpacePermissionContext context)Saves the permission.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.security.SpacePermissionManager
hasAllPermissions, hasPermission, hasPermissionForSpace, hasPermissionNoExemptions
-
-
-
-
Constructor Detail
-
ReadOnlySpacePermissionManager
public ReadOnlySpacePermissionManager(SpacePermissionManager spacePermissionManager)
-
-
Method Detail
-
createDefaultSpacePermissions
public void createDefaultSpacePermissions(Space space)
- Specified by:
createDefaultSpacePermissionsin interfaceSpacePermissionManager
-
createPrivateSpacePermissions
public void createPrivateSpacePermissions(Space space)
- Specified by:
createPrivateSpacePermissionsin interfaceSpacePermissionManager
-
flushCaches
public void flushCaches()
- Specified by:
flushCachesin interfaceSpacePermissionManager
-
getAllPermissionsForGroup
public List<SpacePermission> getAllPermissionsForGroup(String arg0)
- Specified by:
getAllPermissionsForGroupin interfaceSpacePermissionManager
-
getGlobalPermissions
public List<SpacePermission> getGlobalPermissions()
- Specified by:
getGlobalPermissionsin interfaceSpacePermissionManager
-
getGlobalPermissions
public List<SpacePermission> getGlobalPermissions(String arg0)
- Specified by:
getGlobalPermissionsin interfaceSpacePermissionManager
-
getGroupsForPermissionType
public Map<String,Long> getGroupsForPermissionType(String arg0, Space arg1)
- Specified by:
getGroupsForPermissionTypein interfaceSpacePermissionManager
-
getGroupsWithPermissions
public Collection<com.atlassian.user.Group> getGroupsWithPermissions(@Nullable Space arg0)
Description copied from interface:SpacePermissionManagerReturns 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:
getGroupsWithPermissionsin 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:
getUsersForPermissionTypein interfaceSpacePermissionManager
-
getUsersWithPermissions
public Collection<com.atlassian.user.User> getUsersWithPermissions(@Nullable Space arg0)
Description copied from interface:SpacePermissionManagerReturns 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:
getUsersWithPermissionsin 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: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:
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 ConfluenceUser arg2)
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:
arg0- The permission type to look uparg1- 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
-
hasAllPermissions
public 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
-
hasPermissionForSpace
public boolean hasPermissionForSpace(@Nullable ConfluenceUser arg0, List arg1, @Nullable Space arg2)
- Specified by:
hasPermissionForSpacein interfaceSpacePermissionManager
-
permissionExists
public boolean permissionExists(SpacePermission arg0)
Description copied from interface:SpacePermissionManagerCheck whether the given SpacePermission exists. Checks by attribute equality rather than by id.- Specified by:
permissionExistsin 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: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
public boolean isPermittedInReadOnlyAccessMode(String permissionType)
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
-
removeAllPermissions
@Deprecated public void removeAllPermissions(Space space)
Deprecated.Description copied from interface:SpacePermissionManagerRemoves all permissions belonging to space- Specified by:
removeAllPermissionsin interfaceSpacePermissionManager- Parameters:
space- The space to remove the permissions for
-
removeAllPermissions
public void removeAllPermissions(Space space, SpacePermissionContext context)
Description copied from interface:SpacePermissionManagerInternalRemoves all permissions belonging to space- Specified by:
removeAllPermissionsin 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:SpacePermissionManagerRemoves all permissions for the given group, and generates aSpacePermissionsRemoveForGroupEventin the process.- Specified by:
removeAllPermissionsForGroupin interfaceSpacePermissionManager- Parameters:
group- the group to remove
-
removeAllPermissionsForGroup
public void removeAllPermissionsForGroup(String group, SpacePermissionContext context)
Description copied from interface:SpacePermissionManagerInternalRemoves all permissions for the given group.May generate a
SpacePermissionsRemoveForGroupEventin the process, depending on the context.- Specified by:
removeAllPermissionsForGroupin interfaceSpacePermissionManagerInternal- Parameters:
group- the group to remove
-
removeAllUserPermissions
@Deprecated public void removeAllUserPermissions(@NonNull ConfluenceUser user)
Deprecated.Description copied from interface:SpacePermissionManagerRemoves all permissions for the given user, and generates aSpacePermissionsRemoveForUserEventin the process.- Specified by:
removeAllUserPermissionsin interfaceSpacePermissionManager
-
removeAllUserPermissions
public void removeAllUserPermissions(ConfluenceUser user, SpacePermissionContext context)
Description copied from interface:SpacePermissionManagerInternalRemoves all permissions for the given user.May generate a
SpacePermissionsRemoveForUserEventin the process, depending on the context.- Specified by:
removeAllUserPermissionsin 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:SpacePermissionManagerRemoves global permission of specified type that is directly associated with a user, and generates aSpacePermissionsRemoveForUserEventin the process.- Specified by:
removeGlobalPermissionForUserin 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:SpacePermissionManagerInternalRemoves global permission of specified type that is directly associated with a user.May generate a
SpacePermissionsRemoveForUserEventin the process, depending on the context.- Specified by:
removeGlobalPermissionForUserin 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:SpacePermissionManagerRemoves the given permission, and generates aSpacePermissionRemoveEventin the process.- Specified by:
removePermissionin interfaceSpacePermissionManager- Parameters:
permission- the permission to remove
-
removePermission
public void removePermission(SpacePermission permission, SpacePermissionContext context)
Description copied from interface:SpacePermissionManagerInternalRemoves the given permission.May generate a
SpacePermissionRemoveEventin the process, depending on the context.- Specified by:
removePermissionin interfaceSpacePermissionManagerInternal- Parameters:
permission- the permission to removecontext- the context for the removal
-
savePermission
@Deprecated public void savePermission(SpacePermission permission)
Deprecated.Description copied from interface:SpacePermissionSaverSaves the permission, and generates aSpacePermissionSaveEventin the process.- Specified by:
savePermissionin interfaceSpacePermissionSaver
-
savePermission
public void savePermission(SpacePermission permission, SpacePermissionContext context)
Description copied from interface:SpacePermissionSaverInternalSaves the permission.May generate a
SpacePermissionSaveEventin the process, depending on the context.- Specified by:
savePermissionin interfaceSpacePermissionSaverInternal- Parameters:
permission- the permission to savecontext- the context for the save
-
-