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
Constructors Modifier Constructor Description 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, ScopesRequestCacheDelegate scopesRequestCacheDelegate, GlobalSettingsManager settingsManager, GroupResolver groupResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createDefaultSpacePermissions(Space space)
void
createPrivateSpacePermissions(Space space)
void
flushCaches()
List<SpacePermission>
getAllPermissionsForGroup(String group)
protected List<SpacePermission>
getAllPermissionsForUser(ConfluenceUser user)
List<SpacePermission>
getGlobalPermissions()
List<SpacePermission>
getGlobalPermissions(String permissionType)
protected Set<String>
getGroupNamesWithPermission(@Nullable Space targetSpace, String permissionType)
Map<String,Long>
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.Map<String,Long>
getUsersForPermissionType(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
removeAllPermissionsForGroup(String group)
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)
void
removeAllUserPermissions(ConfluenceUser user)
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
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 store-
Methods inherited from class com.atlassian.confluence.impl.security.AbstractSpacePermissionManager
getDefaultGlobalPermissions, groupHasPermission, hasAllPermissions, hasGlobalPermissionViaGroups, hasPermission, hasPermissionForSpace, hasPermissionNoExemptions, 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 Detail
-
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, ScopesRequestCacheDelegate scopesRequestCacheDelegate, GlobalSettingsManager settingsManager, GroupResolver groupResolver)
-
-
Method Detail
-
flushCaches
public void flushCaches()
-
savePermission
public void savePermission(SpacePermission permission)
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
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.- Parameters:
permission
- the permission to savecontext
- the context for the save
-
removePermission
public void removePermission(SpacePermission permission)
Removes the specified permission.- 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.- Parameters:
permission
- the permission to removecontext
- the context for the removal
-
getGlobalPermissions
public List<SpacePermission> getGlobalPermissions()
-
getGlobalPermissions
public List<SpacePermission> getGlobalPermissions(String permissionType)
-
removeAllUserPermissions
public void removeAllUserPermissions(ConfluenceUser user)
Description copied from interface:SpacePermissionManager
Removes all permissions for the given user, and generates aSpacePermissionsRemoveForUserEvent
in the process.
-
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.- Parameters:
user
- the user to remove permissions forcontext
- the context for the removal
-
removeGlobalPermissionForUser
public void removeGlobalPermissionForUser(ConfluenceUser user, String permissionType)
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
public void removeAllPermissionsForGroup(String group)
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
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.- Parameters:
group
- the group to remove
-
getAllPermissionsForGroup
public List<SpacePermission> getAllPermissionsForGroup(String group)
-
getAllPermissionsForUser
protected List<SpacePermission> getAllPermissionsForUser(ConfluenceUser user)
-
removeAllPermissions
public void removeAllPermissions(Space space)
Description copied from interface:SpacePermissionManager
Removes all permissions belonging to space- 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- Parameters:
space
- The space to remove the permissions forcontext
- The context for this removal
-
removeAllPermissionsFromDao
protected void removeAllPermissionsFromDao(Space space)
-
createPrivateSpacePermissions
public void createPrivateSpacePermissions(Space space)
-
createDefaultSpacePermissions
public void createDefaultSpacePermissions(Space space)
-
getUsersWithPermissions
public Collection<com.atlassian.user.User> getUsersWithPermissions(@Nullable Space space)
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
public Collection<com.atlassian.user.Group> getGroupsWithPermissions(@Nullable Space space)
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
public Map<String,Long> getUsersForPermissionType(String permissionType, @Nullable Space space)
-
getGroupsForPermissionType
public Map<String,Long> getGroupsForPermissionType(String permissionType, @Nullable Space space)
- 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
public boolean permissionExists(SpacePermission permission)
Determines if permission exists in the SpacePermissionDao- Parameters:
permission
- The SpacePermission object to look up- Returns:
- true if present, false otherwise
-
savePermissionToDao
protected void savePermissionToDao(SpacePermission permission)
Saves the permission to the data storeThis may be overridden to provide caching, where applicable.
- Parameters:
permission
- the SpacePermission to be saved
-
removePermissionFromDao
protected void removePermissionFromDao(SpacePermission realPermission)
Removes the permission from the data storeThis may be overridden to provide caching, where applicable
- Parameters:
realPermission
- the SpacePermission to be removed
-
-