com.atlassian.confluence.security
Interface SpacePermissionManager

All Superinterfaces:
SpacePermissionSaver
All Known Implementing Classes:
AbstractSpacePermissionManager, CachingSpacePermissionManager, DefaultSpacePermissionManager, ReadOnlySpacePermissionManager, SpacePermissionCheckDispatcherCoordinator, SpacePermissionCoordinator

public interface SpacePermissionManager
extends SpacePermissionSaver

Responsible for the addition, modification and removal of space permissions. This interface is not for checking whether a user has permission to do something; for that see PermissionManager.

See Also:
PermissionManager

Method Summary
 void createDefaultSpacePermissions(Space space)
           
 void createInitialSpacePermissions(Space space)
          Deprecated. Use createDefaultSpacePermissions(com.atlassian.confluence.spaces.Space) or createPrivateSpacePermissions(com.atlassian.confluence.spaces.Space) instead. Since v4.2.6.
 void createPrivateSpacePermissions(Space space)
           
 void flushCaches()
           
 java.util.List<SpacePermission> getAllPermissionsForGroup(java.lang.String group)
           
 java.util.Set<SpacePermission> getDefaultGlobalPermissions()
          Returns the default global permissions that are created when Confluence is set up.
 java.util.List<SpacePermission> getGlobalPermissions()
           
 java.util.List<SpacePermission> getGlobalPermissions(java.lang.String permissionType)
           
 java.util.Map getGroupsForPermissionType(java.lang.String permissionType, Space space)
           
 java.util.Collection getGroupsWithPermissions(Space space)
          Returns all groups wich have permissions in a space or on a global level.
 java.util.Map getUsersForPermissionType(java.lang.String permissionType, Space space)
           
 java.util.Collection getUsersWithPermissions(Space space)
          Returns a collection of user objects with VIEWSPACE_PERMISSION in the space.
 boolean groupHasPermission(java.lang.String permissionType, Space space, java.lang.String group)
          Checks whether the given group has the given permission

If 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.

 boolean hasAllPermissions(java.util.List<java.lang.String> permissionTypes, Space space, com.atlassian.user.User user)
          Determines if remoteUser has all of the given permissions in space

If remoteUser lacks any of the given permissions, false is returned.

 boolean hasPermission(java.util.List permissionTypes, Space space, com.atlassian.user.User remoteUser)
          Deprecated. Since 5.0. Use hasAllPermissions(java.util.List, com.atlassian.confluence.spaces.Space, com.atlassian.user.User)
 boolean hasPermission(java.lang.String permissionType, Space space, com.atlassian.user.User remoteUser)
          Determines if remoteUser has the given permission in space Unless you're writing code that is part of the permission checking implementation, or you're changing space permissions, you should be using PermissionManager instead.
 boolean hasPermissionForSpace(com.atlassian.user.User user, java.util.List permissionTypes, Space space)
           
 boolean permissionExists(SpacePermission permission)
          Check whether the given SpacePermission exists.
 void removeAllPermissions(Space space)
          Removes all permissions belonging to space
 void removeAllPermissionsForGroup(java.lang.String group)
           
 void removeAllUserPermissions(ConfluenceUser user)
           
 void removeAllUserPermissions(java.lang.String username)
          Deprecated. since 5.3. Use removeAllUserPermissions(com.atlassian.confluence.user.ConfluenceUser) instead.
 void removeGlobalPermissionForUser(ConfluenceUser user, java.lang.String permissionType)
          Removes global permission of specified type that is directly associated with a user
 void removePermission(SpacePermission permission)
           
 
Methods inherited from interface com.atlassian.confluence.security.SpacePermissionSaver
savePermission
 

Method Detail

removeAllPermissions

void removeAllPermissions(Space space)
Removes all permissions belonging to space

Parameters:
space - The space to remove the permissions for

removePermission

void removePermission(SpacePermission permission)

hasPermission

boolean hasPermission(java.lang.String permissionType,
                      Space space,
                      com.atlassian.user.User remoteUser)
Determines if remoteUser has the given permission in space Unless you're writing code that is part of the permission checking implementation, or you're changing space permissions, you should be using PermissionManager instead.

Parameters:
permissionType - The permission type to look up
space - The space the permission applies to (can be null for global permissions)
remoteUser - The user to look up (can be null for the anonymous user)
Returns:
true if remoteUser has the permission, false otherwise

hasPermission

boolean hasPermission(java.util.List permissionTypes,
                      Space space,
                      com.atlassian.user.User remoteUser)
Deprecated. Since 5.0. Use hasAllPermissions(java.util.List, com.atlassian.confluence.spaces.Space, com.atlassian.user.User)

Determines if remoteUser has the given permissions in space

If 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 PermissionManager instead.

Parameters:
permissionTypes - A List of permission types (see SpacePermission) to check
space - The space the permissions apply to
remoteUser - The user to look up
Returns:
true if remoteUser has the permission, false otherwise

hasAllPermissions

boolean hasAllPermissions(java.util.List<java.lang.String> permissionTypes,
                          Space space,
                          com.atlassian.user.User user)
Determines if remoteUser has all of the given permissions in space

If 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 PermissionManager instead.

Parameters:
permissionTypes - A List of permission types (see SpacePermission) to check
space - The space the permissions apply to
remoteUser - The user to look up
Returns:
true if remoteUser has the permission, false otherwise

removeAllUserPermissions

void removeAllUserPermissions(ConfluenceUser user)
Since:
5.3

removeAllUserPermissions

@Deprecated
void removeAllUserPermissions(java.lang.String username)
Deprecated. since 5.3. Use removeAllUserPermissions(com.atlassian.confluence.user.ConfluenceUser) instead.


removeGlobalPermissionForUser

void removeGlobalPermissionForUser(ConfluenceUser user,
                                   java.lang.String permissionType)
Removes global permission of specified type that is directly associated with a user

Parameters:
user - the user to look up
permissionType - the permission type to remove
Since:
5.4

removeAllPermissionsForGroup

void removeAllPermissionsForGroup(java.lang.String group)

getAllPermissionsForGroup

java.util.List<SpacePermission> getAllPermissionsForGroup(java.lang.String group)

getGlobalPermissions

java.util.List<SpacePermission> getGlobalPermissions()

getGlobalPermissions

java.util.List<SpacePermission> getGlobalPermissions(java.lang.String permissionType)

flushCaches

void flushCaches()

groupHasPermission

boolean groupHasPermission(java.lang.String permissionType,
                           Space space,
                           java.lang.String group)
Checks whether the given group has the given permission

If 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.

Parameters:
group - The group to look up the permission for
space - The space the permission applies to (can be null for global permissions)
permissionType - The permission type to look up
Returns:
true if the group has the required permission, false otherwise

createInitialSpacePermissions

void createInitialSpacePermissions(Space space)
Deprecated. Use createDefaultSpacePermissions(com.atlassian.confluence.spaces.Space) or createPrivateSpacePermissions(com.atlassian.confluence.spaces.Space) instead. Since v4.2.6.

Creates all the initial permissions (in this list SpacePermission.GENERIC_SPACE_PERMISSIONS) in the specified space.


createDefaultSpacePermissions

void createDefaultSpacePermissions(Space space)

createPrivateSpacePermissions

void createPrivateSpacePermissions(Space space)

hasPermissionForSpace

boolean hasPermissionForSpace(com.atlassian.user.User user,
                              java.util.List permissionTypes,
                              Space space)

getGroupsWithPermissions

java.util.Collection getGroupsWithPermissions(Space space)
Returns all groups wich 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

getGroupsForPermissionType

java.util.Map getGroupsForPermissionType(java.lang.String permissionType,
                                         Space space)

getUsersWithPermissions

java.util.Collection getUsersWithPermissions(Space space)
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

getUsersForPermissionType

java.util.Map getUsersForPermissionType(java.lang.String permissionType,
                                        Space space)

permissionExists

boolean permissionExists(SpacePermission permission)
Check whether the given SpacePermission exists. Checks by attribute equality rather than by id.

Parameters:
permission - the permission to look for.
Returns:
true if the permission is recognised by the manager as existing.

getDefaultGlobalPermissions

java.util.Set<SpacePermission> getDefaultGlobalPermissions()
Returns 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.

Returns:
a collection of SpacePermissions.


Copyright © 2003-2014 Atlassian. All Rights Reserved.