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 Details

  • Method Details

    • flushCaches

      public void flushCaches()
    • savePermission

      public void savePermission(SpacePermission permission)
      Description copied from interface: SpacePermissionSaver
      Saves the permission, and generates a SpacePermissionSaveEvent 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 save
      context - 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 remove
      context - 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 a SpacePermissionsRemoveForUserEvent 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 for
      context - 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 a SpacePermissionsRemoveForUserEvent in the process.
      Parameters:
      user - the user to look up
      permissionType - 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 up
      permissionType - the permission type to remove
      context - 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 a SpacePermissionsRemoveForGroupEvent 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 for
      context - 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 are Long 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 class AbstractSpacePermissionManager
    • 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 store

      This 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 store

      This may be overridden to provide caching, where applicable

      Parameters:
      realPermission - the SpacePermission to be removed