com.atlassian.confluence.security
Class SpacePermissionCheckDispatcherCoordinator

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

public class SpacePermissionCheckDispatcherCoordinator
extends java.lang.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 flushCaches()
           
 java.util.List 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 getGlobalPermissions()
           
 java.util.List 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 remoteUser)
          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)
          Determines if remoteUser has the given permissions in space

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

 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. 
 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)
           
 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: SpacePermissionSaver
Saves the permission.

Specified by:
savePermission in interface SpacePermissionSaver

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(java.lang.String permissionType,
                             Space space,
                             com.atlassian.user.User remoteUser)
Description copied from interface: SpacePermissionManager
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.

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(java.util.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.

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.

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

hasAllPermissions

public boolean hasAllPermissions(java.util.List<java.lang.String> permissionTypes,
                                 Space space,
                                 com.atlassian.user.User remoteUser)
Description copied from interface: SpacePermissionManager
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.

Specified by:
hasAllPermissions in interface SpacePermissionManager
Parameters:
permissionTypes - A List of permission types (see SpacePermission) to check
space - The space the permissions apply to
Returns:
true if remoteUser has the permission, false otherwise

removeAllUserPermissions

public void removeAllUserPermissions(ConfluenceUser user)
Specified by:
removeAllUserPermissions in interface SpacePermissionManager

removeAllUserPermissions

@Deprecated
public void removeAllUserPermissions(java.lang.String username)
Deprecated. 

Specified by:
removeAllUserPermissions in interface SpacePermissionManager

removeGlobalPermissionForUser

public void removeGlobalPermissionForUser(ConfluenceUser user,
                                          java.lang.String permissionType)
Description copied from interface: SpacePermissionManager
Removes global permission of specified type that is directly associated with a user

Specified by:
removeGlobalPermissionForUser in interface SpacePermissionManager
Parameters:
user - the user to look up
permissionType - the permission type to remove

removeAllPermissionsForGroup

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

getAllPermissionsForGroup

public java.util.List getAllPermissionsForGroup(java.lang.String group)
Specified by:
getAllPermissionsForGroup in interface SpacePermissionManager

getGlobalPermissions

public java.util.List getGlobalPermissions()
Specified by:
getGlobalPermissions in interface SpacePermissionManager

getGlobalPermissions

public java.util.List getGlobalPermissions(java.lang.String permissionType)
Specified by:
getGlobalPermissions in interface SpacePermissionManager

flushCaches

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

groupHasPermission

public boolean groupHasPermission(java.lang.String permissionType,
                                  Space space,
                                  java.lang.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,
                                     java.util.List permissionTypes,
                                     Space space)
Specified by:
hasPermissionForSpace in interface SpacePermissionManager

getGroupsWithPermissions

public java.util.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 java.util.Map getGroupsForPermissionType(java.lang.String permissionType,
                                                Space space)
Specified by:
getGroupsForPermissionType in interface SpacePermissionManager

getUsersWithPermissions

public java.util.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 java.util.Map getUsersForPermissionType(java.lang.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.

getDefaultGlobalPermissions

public java.util.Set<SpacePermission> getDefaultGlobalPermissions()
Description copied from interface: SpacePermissionManager
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.

Specified by:
getDefaultGlobalPermissions in interface SpacePermissionManager
Returns:
a collection of SpacePermissions.

setPermissionCheckDispatcherResultCache

public void setPermissionCheckDispatcherResultCache(PermissionCheckDispatcherResultCache permissionCheckDispatcherResultCache)

setSpacePermissionManager

public void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)


Copyright © 2003-2014 Atlassian. All Rights Reserved.