com.atlassian.confluence.security
Class SpacePermissionCheckDispatcherCoordinator

java.lang.Object
  extended by com.atlassian.confluence.security.SpacePermissionCheckDispatcherCoordinator
All Implemented Interfaces:
SpacePermissionManager

public class SpacePermissionCheckDispatcherCoordinator
extends Object
implements SpacePermissionManager

Space permission manager wrapper that updates the permission check dispatcher cache on operations that add or remove permissions.


Constructor Summary
SpacePermissionCheckDispatcherCoordinator()
           
 
Method Summary
 void createDefaultSpacePermissions(Space space)
           
 void createInitialSpacePermissions(Space space)
          Creates all the initial permissions (in this list SpacePermission.GENERIC_SPACE_PERMISSIONS) in the specified space.
 void createPrivateSpacePermissions(Space space)
           
 void fixPermissions()
           
 void flushCaches()
           
 List getAllPermissionsForGroup(String group)
           
 List getGlobalPermissions()
           
 List 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.
 void setPermissionCheckDispatcherResultCache(PermissionCheckDispatcherResultCache permissionCheckDispatcherResultCache)
           
 void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpacePermissionCheckDispatcherCoordinator

public SpacePermissionCheckDispatcherCoordinator()
Method Detail

savePermission

public void savePermission(SpacePermission permission)
Description copied from interface: SpacePermissionManager
Saves the permission.

Specified by:
savePermission in interface SpacePermissionManager

removeAllPermissions

public void removeAllPermissions(Space space)
Description copied from interface: SpacePermissionManager
Removes all permissions belonging to space

Specified by:
removeAllPermissions in interface SpacePermissionManager
Parameters:
space - The space to remove the permissions for

removePermission

public void removePermission(SpacePermission permission)
Specified by:
removePermission in interface SpacePermissionManager

hasPermission

public boolean hasPermission(String permissionType,
                             Space space,
                             com.atlassian.user.User remoteUser)
Description copied from interface: SpacePermissionManager
Determines if remoteUser has the given permission in space

Specified by:
hasPermission in interface SpacePermissionManager
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

public boolean hasPermission(List permissionTypes,
                             Space space,
                             com.atlassian.user.User remoteUser)
Description copied from interface: SpacePermissionManager
Determines if remoteUser has the given permissions in space

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

Specified by:
hasPermission in interface SpacePermissionManager
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

public void removeAllUserPermissions(String username)
Specified by:
removeAllUserPermissions in interface SpacePermissionManager

removeAllPermissionsForGroup

public void removeAllPermissionsForGroup(String group)
Specified by:
removeAllPermissionsForGroup in interface SpacePermissionManager

getAllPermissionsForGroup

public List getAllPermissionsForGroup(String group)
Specified by:
getAllPermissionsForGroup in interface SpacePermissionManager

getGlobalPermissions

public List getGlobalPermissions()
Specified by:
getGlobalPermissions in interface SpacePermissionManager

getGlobalPermissions

public List getGlobalPermissions(String permissionType)
Specified by:
getGlobalPermissions in interface SpacePermissionManager

fixPermissions

public void fixPermissions()
Specified by:
fixPermissions in interface SpacePermissionManager

flushCaches

public void flushCaches()
Specified by:
flushCaches in interface SpacePermissionManager

groupHasPermission

public boolean groupHasPermission(String permissionType,
                                  Space space,
                                  String group)
Description copied from interface: SpacePermissionManager
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.

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

createInitialSpacePermissions

public void createInitialSpacePermissions(Space space)
Description copied from interface: SpacePermissionManager
Creates all the initial permissions (in this list SpacePermission.GENERIC_SPACE_PERMISSIONS) in the specified space.

Specified by:
createInitialSpacePermissions in interface SpacePermissionManager

createDefaultSpacePermissions

public void createDefaultSpacePermissions(Space space)
Specified by:
createDefaultSpacePermissions in interface SpacePermissionManager

createPrivateSpacePermissions

public void createPrivateSpacePermissions(Space space)
Specified by:
createPrivateSpacePermissions in interface SpacePermissionManager

hasPermissionForSpace

public boolean hasPermissionForSpace(com.atlassian.user.User user,
                                     List permissionTypes,
                                     Space space)
Specified by:
hasPermissionForSpace in interface SpacePermissionManager

getGroupsWithPermissions

public Collection getGroupsWithPermissions(Space space)
Description copied from interface: SpacePermissionManager
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.

Specified by:
getGroupsWithPermissions in interface SpacePermissionManager
Parameters:
space - - space to query, if null global permissions returned
Returns:
Collection of groups with permissions

getGroupsForPermissionType

public Map getGroupsForPermissionType(String permissionType,
                                      Space space)
Specified by:
getGroupsForPermissionType in interface SpacePermissionManager

getUsersWithPermissions

public Collection getUsersWithPermissions(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

Specified by:
getUsersWithPermissions in interface SpacePermissionManager
Parameters:
space - - space to query, if null global permissions returned
Returns:
Collection of User objects

getUsersForPermissionType

public Map getUsersForPermissionType(String permissionType,
                                     Space space)
Specified by:
getUsersForPermissionType in interface SpacePermissionManager

permissionExists

public boolean permissionExists(SpacePermission permission)
Description copied from interface: SpacePermissionManager
Check whether the given SpacePermission exists. Checks by attribute equality rather than by id.

Specified by:
permissionExists in interface SpacePermissionManager
Parameters:
permission - the permission to look for.
Returns:
true if the permission is recognised by the manager as existing.

setPermissionCheckDispatcherResultCache

public void setPermissionCheckDispatcherResultCache(PermissionCheckDispatcherResultCache permissionCheckDispatcherResultCache)

setSpacePermissionManager

public void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)


Copyright © 2003-2012 Atlassian. All Rights Reserved.