com.atlassian.confluence.security
Interface SpacePermissionManager

All Known Implementing Classes:
AbstractSpacePermissionManager, CachingSpacePermissionManager, DefaultSpacePermissionManager, SpacePermissionCheckDispatcherCoordinator, SpacePermissionCoordinator

public interface SpacePermissionManager

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 createInitialSpacePermissions(Space space)
          Creates all the initial permissions (in this list SpacePermission.GENERIC_SPACE_PERMISSIONS) in the specified space.
 void fixPermissions()
           
 void flushCaches()
           
 List<SpacePermission> getAllPermissionsForGroup(String group)
           
 List<SpacePermission> getGlobalPermissions()
           
 List<SpacePermission> getGlobalPermissions(String permissionType)
           
 Map getGroupsForPermissionType(String permissionType, Space space)
           
 Collection getGroupsWithPermissions(Space space)
          Returns all groups wich have permissions in a space or on a global level.
 Map getUsersForPermissionType(String permissionType, Space space)
           
 Collection getUsersWithPermissions(Space space)
          Returns a collection of user objects with VIEWSPACE_PERMISSION in the space.
 boolean groupHasPermission(String permissionType, Space space, 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 hasPermission(List permissionTypes, Space space, com.atlassian.user.User remoteUser)
          Determines if remoteUser has the given permissions in space

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

 boolean hasPermission(String permissionType, Space space, com.atlassian.user.User remoteUser)
          Determines if remoteUser has the given permission in space
 boolean hasPermissionForSpace(com.atlassian.user.User user, 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(String group)
           
 void removeAllUserPermissions(String username)
           
 void removePermission(SpacePermission permission)
           
 void savePermission(SpacePermission permission)
          Saves the permission.
 

Method Detail

savePermission

void savePermission(SpacePermission permission)
Saves the permission.


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(String permissionType,
                      Space space,
                      com.atlassian.user.User remoteUser)
Determines if remoteUser has the given permission in space

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(List permissionTypes,
                      Space space,
                      com.atlassian.user.User remoteUser)
Determines if remoteUser has the given permissions in space

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

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(String username)

removeAllPermissionsForGroup

void removeAllPermissionsForGroup(String group)

getAllPermissionsForGroup

List<SpacePermission> getAllPermissionsForGroup(String group)

getGlobalPermissions

List<SpacePermission> getGlobalPermissions()

getGlobalPermissions

List<SpacePermission> getGlobalPermissions(String permissionType)

fixPermissions

void fixPermissions()

flushCaches

void flushCaches()

groupHasPermission

boolean groupHasPermission(String permissionType,
                           Space space,
                           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)
Creates all the initial permissions (in this list SpacePermission.GENERIC_SPACE_PERMISSIONS) in the specified space.


hasPermissionForSpace

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

getGroupsWithPermissions

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

Map getGroupsForPermissionType(String permissionType,
                               Space space)

getUsersWithPermissions

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

Map getUsersForPermissionType(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.


Copyright © 2003-2011 Atlassian. All Rights Reserved.