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
ConstructorsModifierConstructorDescriptionprotectedDefaultSpacePermissionManager(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 TypeMethodDescriptionvoidvoidvoidgetAllPermissionsForGroup(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.booleanpermissionExists(SpacePermission permission) Determines if permission exists in the SpacePermissionDaovoidremoveAllPermissions(Space space) Removes all permissions belonging to spacevoidremoveAllPermissions(Space space, SpacePermissionContext context) Removes all permissions belonging to spacevoidRemoves all permissions for the given group, and generates aSpacePermissionsRemoveForGroupEventin the process.voidremoveAllPermissionsForGroup(String group, SpacePermissionContext context) Removes all permissions for the given group.protected voidremoveAllPermissionsFromDao(Space space, SpacePermissionContext context) voidRemoves all permissions for the given user, and generates aSpacePermissionsRemoveForUserEventin the process.voidremoveAllUserPermissions(ConfluenceUser user, SpacePermissionContext context) Removes all permissions for the given user.voidremoveGlobalPermissionForUser(ConfluenceUser user, String permissionType) Removes global permission of specified type that is directly associated with a user, and generates aSpacePermissionsRemoveForUserEventin the process.voidremoveGlobalPermissionForUser(ConfluenceUser user, String permissionType, SpacePermissionContext context) Removes global permission of specified type that is directly associated with a user.voidremovePermission(SpacePermission permission) Removes the specified permission.voidremovePermission(SpacePermission permission, SpacePermissionContext context) Removes the given permission.protected voidremovePermissionFromDao(SpacePermission realPermission) Removes the permission from the data storevoidremovePermissions(Collection<SpacePermission> permissionsToRemove, SpacePermissionContext context) Removes the given permissions.voidsaveGlobalPermissions(Collection<SpacePermission> spacePermissions, SpacePermissionContext context) Adds global permissionsvoidsavePermission(SpacePermission permission) Saves the permission, and generates aSpacePermissionSaveEventin the process.voidsavePermission(SpacePermission permission, SpacePermissionContext context) Saves the permission.protected voidsavePermissionToDao(SpacePermission permission) Saves the permission to the data storevoidsaveSpacePermissions(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, isPermittedInReadOnlyAccessModeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.confluence.security.access.DefaultConfluenceAccessManager.AccessManagerPermissionChecker
hasGlobalPermissionViaGroupsMethods 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:SpacePermissionSaverSaves the permission, and generates aSpacePermissionSaveEventin the process.- Throws:
IllegalArgumentException- if the permission is a disallowed anonymous permission (CONF-4155)
-
savePermission
Description copied from interface:SpacePermissionSaverInternalSaves the permission.May generate a
SpacePermissionSaveEventin 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:SpacePermissionSaverInternalAdds 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:SpacePermissionSaverInternalAdds 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:SpacePermissionManagerInternalRemoves the given permission.May generate a
SpacePermissionRemoveEventin 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:SpacePermissionManagerInternalRemoves the given permissions.May generate a
SpacePermissionRemoveEventin the process, depending on the context.- Parameters:
permissionsToRemove- the permissions to removecontext- the context for the removal
-
getGlobalPermissions
-
getGlobalPermissions
-
removeAllUserPermissions
Description copied from interface:SpacePermissionManagerRemoves all permissions for the given user, and generates aSpacePermissionsRemoveForUserEventin the process. -
removeAllUserPermissions
Description copied from interface:SpacePermissionManagerInternalRemoves all permissions for the given user.May generate a
SpacePermissionsRemoveForUserEventin the process, depending on the context.- Parameters:
user- the user to remove permissions forcontext- the context for the removal
-
removeGlobalPermissionForUser
Description copied from interface:SpacePermissionManagerRemoves global permission of specified type that is directly associated with a user, and generates aSpacePermissionsRemoveForUserEventin 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:SpacePermissionManagerInternalRemoves global permission of specified type that is directly associated with a user.May generate a
SpacePermissionsRemoveForUserEventin 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:SpacePermissionManagerRemoves all permissions for the given group, and generates aSpacePermissionsRemoveForGroupEventin the process.- Parameters:
group- the group to remove
-
removeAllPermissionsForGroup
Description copied from interface:SpacePermissionManagerInternalRemoves all permissions for the given group.May generate a
SpacePermissionsRemoveForGroupEventin the process, depending on the context.- Parameters:
group- the group to remove
-
getAllPermissionsForGroup
-
getAllPermissionsForUser
-
removeAllPermissions
Description copied from interface:SpacePermissionManagerRemoves all permissions belonging to space- Parameters:
space- The space to remove the permissions for
-
removeAllPermissions
Description copied from interface:SpacePermissionManagerInternalRemoves 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: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- Parameters:
space- - space to query, if null global permissions returned- Returns:
- Collection of User objects
-
getGroupsWithPermissions
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.- 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
StringgroupNames and values that areLongGroup permissionId. The keys in the Map are not case sensitive.
-
getGroupNamesWithPermission
protected Set<String> getGroupNamesWithPermission(@Nullable Space targetSpace, String permissionType) - Specified by:
getGroupNamesWithPermissionin 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:SpacePermissionManagerGet 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:SpacePermissionManagerGet 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:SpacePermissionManagerGet 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
-