Class DefaultSpacePermissionManager
java.lang.Object
com.atlassian.confluence.impl.security.AbstractSpacePermissionManager
com.atlassian.confluence.impl.security.DefaultSpacePermissionManager
- All Implemented Interfaces:
SpacePermissionManagerInternal
,SpacePermissionSaverInternal
,DefaultConfluenceAccessManager.AccessManagerPermissionChecker
,SpacePermissionManager
,SpacePermissionSaver
- Direct Known Subclasses:
CachingSpacePermissionManager
@ParametersAreNonnullByDefault
public class DefaultSpacePermissionManager
extends AbstractSpacePermissionManager
- Since:
- 7.16
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DefaultSpacePermissionManager
(SpacePermissionDao spacePermissionDao, PermissionCheckExemptions permissionCheckExemptions, SpacePermissionDefaultsStoreFactory spacePermissionDefaultsStoreFactory, com.atlassian.event.api.EventPublisher eventPublisher, ConfluenceAccessManager confluenceAccessManager, SpacePermissionAccessMapper spacePermissionAccessMapper, com.atlassian.crowd.embedded.api.CrowdService crowdService, ConfluenceUserResolver userResolver, AccessModeManager accessModeManager, GlobalSettingsManager settingsManager, GroupResolver groupResolver, SpaceDaoInternal spaceDao) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
getAllPermissionsForGroup
(String group) protected List<SpacePermission>
getGlobalPermissions
(String permissionType) getGroupNamesWithPermission
(@Nullable Space targetSpace, String permissionType) getGroupsForPermissionType
(String permissionType, @Nullable 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.getPermissionsForAnonymousUsers
(Space spaceEntity) 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, @Nullable Space space) Collection<com.atlassian.user.User>
getUsersWithPermissions
(@Nullable Space space) Returns a collection of user objects with VIEWSPACE_PERMISSION in the space.boolean
permissionExists
(SpacePermission permission) Determines if permission exists in the SpacePermissionDaovoid
removeAllPermissions
(Space space) Removes all permissions belonging to spacevoid
removeAllPermissions
(Space space, SpacePermissionContext context) Removes all permissions belonging to spacevoid
Removes all permissions for the given group, and generates aSpacePermissionsRemoveForGroupEvent
in the process.void
removeAllPermissionsForGroup
(String group, SpacePermissionContext context) Removes all permissions for the given group.protected void
removeAllPermissionsFromDao
(Space space, SpacePermissionContext context) void
Removes all permissions for the given user, and generates aSpacePermissionsRemoveForUserEvent
in the process.void
removeAllUserPermissions
(ConfluenceUser user, SpacePermissionContext context) Removes all permissions for the given user.void
removeGlobalPermissionForUser
(ConfluenceUser user, String permissionType) Removes global permission of specified type that is directly associated with a user, and generates aSpacePermissionsRemoveForUserEvent
in the process.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) Removes the specified permission.void
removePermission
(SpacePermission permission, SpacePermissionContext context) Removes the given permission.protected void
removePermissionFromDao
(SpacePermission realPermission) Removes the permission from the data storevoid
removePermissions
(Collection<SpacePermission> permissionsToRemove, SpacePermissionContext context) Removes the given permissions.void
saveGlobalPermissions
(Collection<SpacePermission> spacePermissions, SpacePermissionContext context) Adds global permissionsvoid
savePermission
(SpacePermission permission) Saves the permission, and generates aSpacePermissionSaveEvent
in the process.void
savePermission
(SpacePermission permission, SpacePermissionContext context) Saves the permission.protected void
savePermissionToDao
(SpacePermission permission) Saves the permission to the data storevoid
saveSpacePermissions
(Space space, Collection<SpacePermission> spacePermissions, SpacePermissionContext context) Adds space permissions to the spaceMethods inherited from class com.atlassian.confluence.impl.security.AbstractSpacePermissionManager
getDefaultGlobalPermissions, groupHasPermission, groupInheritsPermission, hasAllPermissions, hasGlobalPermissionViaGroups, hasPermission, hasPermissionForSpace, hasPermissionNoExemptions, hasPermissionNoExemptionsExceptViaNestedGroups, isPermittedInReadOnlyAccessMode
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.access.DefaultConfluenceAccessManager.AccessManagerPermissionChecker
hasGlobalPermissionViaGroups
Methods inherited from interface com.atlassian.confluence.security.SpacePermissionManager
hasAllPermissions, hasPermission, hasPermissionForSpace, hasPermissionNoExemptions
-
Constructor Details
-
DefaultSpacePermissionManager
protected DefaultSpacePermissionManager(SpacePermissionDao spacePermissionDao, PermissionCheckExemptions permissionCheckExemptions, SpacePermissionDefaultsStoreFactory spacePermissionDefaultsStoreFactory, com.atlassian.event.api.EventPublisher eventPublisher, ConfluenceAccessManager confluenceAccessManager, SpacePermissionAccessMapper spacePermissionAccessMapper, com.atlassian.crowd.embedded.api.CrowdService crowdService, ConfluenceUserResolver userResolver, AccessModeManager accessModeManager, GlobalSettingsManager settingsManager, GroupResolver groupResolver, SpaceDaoInternal spaceDao)
-
-
Method Details
-
flushCaches
public void flushCaches() -
savePermission
Description copied from interface:SpacePermissionSaver
Saves the permission, and generates aSpacePermissionSaveEvent
in the process.- Throws:
IllegalArgumentException
- if the permission is a disallowed anonymous permission (CONF-4155)
-
savePermission
Description copied from interface:SpacePermissionSaverInternal
Saves the permission.May generate a
SpacePermissionSaveEvent
in the process, depending on the context.- Parameters:
permission
- the permission to savecontext
- the context for the save
-
saveSpacePermissions
public void saveSpacePermissions(Space space, Collection<SpacePermission> spacePermissions, SpacePermissionContext context) Description copied from interface:SpacePermissionSaverInternal
Adds space permissions to the space- Parameters:
space
- Space to which permissions should be grantedspacePermissions
- Collection of space permissions. They should all belong to the same space.context
- the context of the save
-
saveGlobalPermissions
public void saveGlobalPermissions(Collection<SpacePermission> spacePermissions, SpacePermissionContext context) Description copied from interface:SpacePermissionSaverInternal
Adds global permissions- Parameters:
spacePermissions
- Collection of global permissions.context
- the context of the save
-
removePermission
Removes the specified permission.- Parameters:
permission
- the permission to remove
-
removePermission
Description copied from interface:SpacePermissionManagerInternal
Removes the given permission.May generate a
SpacePermissionRemoveEvent
in the process, depending on the context.- Parameters:
permission
- the permission to removecontext
- the context for the removal
-
removePermissions
public void removePermissions(Collection<SpacePermission> permissionsToRemove, SpacePermissionContext context) Description copied from interface:SpacePermissionManagerInternal
Removes the given permissions.May generate a
SpacePermissionRemoveEvent
in the process, depending on the context.- Parameters:
permissionsToRemove
- the permissions to removecontext
- the context for the removal
-
getGlobalPermissions
-
getGlobalPermissions
-
removeAllUserPermissions
Description copied from interface:SpacePermissionManager
Removes all permissions for the given user, and generates aSpacePermissionsRemoveForUserEvent
in the process. -
removeAllUserPermissions
Description copied from interface:SpacePermissionManagerInternal
Removes all permissions for the given user.May generate a
SpacePermissionsRemoveForUserEvent
in the process, depending on the context.- Parameters:
user
- the user to remove permissions forcontext
- the context for the removal
-
removeGlobalPermissionForUser
Description copied from interface:SpacePermissionManager
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
-
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.- Parameters:
user
- the user to look uppermissionType
- the permission type to removecontext
- the context for the removal
-
removeAllPermissionsForGroup
Description copied from interface:SpacePermissionManager
Removes all permissions for the given group, and generates aSpacePermissionsRemoveForGroupEvent
in the process.- Parameters:
group
- the group to remove
-
removeAllPermissionsForGroup
Description copied from interface:SpacePermissionManagerInternal
Removes all permissions for the given group.May generate a
SpacePermissionsRemoveForGroupEvent
in the process, depending on the context.- Parameters:
group
- the group to remove
-
getAllPermissionsForGroup
-
getAllPermissionsForUser
-
removeAllPermissions
Description copied from interface:SpacePermissionManager
Removes all permissions belonging to space- Parameters:
space
- The space to remove the permissions for
-
removeAllPermissions
Description copied from interface:SpacePermissionManagerInternal
Removes all permissions belonging to space- Parameters:
space
- The space to remove the permissions forcontext
- The context for this removal
-
removeAllPermissionsFromDao
-
createPrivateSpacePermissions
-
createDefaultSpacePermissions
-
getUsersWithPermissions
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- Parameters:
space
- - space to query, if null global permissions returned- Returns:
- Collection of User objects
-
getGroupsWithPermissions
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.- Parameters:
space
- - space to query, if null global permissions returned- Returns:
- Collection of groups with permissions
-
getUsersForPermissionType
-
getGroupsForPermissionType
- Returns:
- a map with keys that are
String
groupNames and values that areLong
Group permissionId. The keys in the Map are not case sensitive.
-
getGroupNamesWithPermission
protected Set<String> getGroupNamesWithPermission(@Nullable Space targetSpace, String permissionType) - Specified by:
getGroupNamesWithPermission
in classAbstractSpacePermissionManager
-
permissionExists
Determines if permission exists in the SpacePermissionDao- Parameters:
permission
- The SpacePermission object to look up- Returns:
- true if present, false otherwise
-
getPermissionsForUser
Description copied from interface:SpacePermissionManager
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
-
getPermissionsForGroup
Description copied from interface:SpacePermissionManager
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
-
getPermissionsForAnonymousUsers
Description copied from interface:SpacePermissionManager
Get all permissions granted to the anonymous users in the given space- Parameters:
spaceEntity
- the space entity- Returns:
- a list of space permissions granted to anonymous users in the given space
-
savePermissionToDao
Saves the permission to the data storeThis may be overridden to provide caching, where applicable.
- Parameters:
permission
- the SpacePermission to be saved
-
removePermissionFromDao
Removes the permission from the data storeThis may be overridden to provide caching, where applicable
- Parameters:
realPermission
- the SpacePermission to be removed
-