ca.sqlpower.wabit.enterprise.client.security
Class WabitAccessManager

java.lang.Object
  extended by ca.sqlpower.wabit.enterprise.client.security.WabitAccessManager
All Implemented Interfaces:
ca.sqlpower.enterprise.client.security.SPAccessManager
Direct Known Subclasses:
CachingWabitAccessManager

public class WabitAccessManager
extends java.lang.Object
implements ca.sqlpower.enterprise.client.security.SPAccessManager


Nested Class Summary
 
Nested classes/interfaces inherited from interface ca.sqlpower.enterprise.client.security.SPAccessManager
ca.sqlpower.enterprise.client.security.SPAccessManager.Permission
 
Constructor Summary
WabitAccessManager()
           
 
Method Summary
 boolean doSystemGrantsPermit(java.lang.String type, java.util.List<ca.sqlpower.enterprise.client.Grant> grants, java.util.Collection<ca.sqlpower.object.SPObject> dependantObjects, java.util.Set<ca.sqlpower.enterprise.client.security.SPAccessManager.Permission> permissions)
          Checks if the given grants give permission to perform the action represented by permissions on the given type of object.
 ca.sqlpower.util.SPSession getCurrentSession()
           
 ca.sqlpower.enterprise.client.User getCurrentUser()
           
 ca.sqlpower.util.SPSession getSystemSession()
           
 void init(ca.sqlpower.enterprise.client.User currentUser, ca.sqlpower.util.SPSession currentSession, ca.sqlpower.util.SPSession systemSession)
          Initializes this Access Manager.
 void init(ca.sqlpower.enterprise.client.User currentUser, WabitSession systemSession)
          Initializes this Access Manager.
 boolean isGranted(java.lang.String type, java.util.Set<ca.sqlpower.enterprise.client.security.SPAccessManager.Permission> permissions)
          Checks if the current user has permission to perform the action represented by the given set of Permissions on objects of class type
 boolean isGranted(java.lang.String subject, java.lang.String type, java.util.Set<ca.sqlpower.enterprise.client.security.SPAccessManager.Permission> permissions)
          Checks if the current user has permission to perform the action represented by the given set of Permissions on the object with UUID subject.
 boolean isGrantGranted(ca.sqlpower.enterprise.client.Grant newGrant)
          Checks if the current user has sufficient privilege to create the given Grant.
 boolean isWorkspaceGranted(java.util.Set<ca.sqlpower.enterprise.client.security.SPAccessManager.Permission> permissions)
          Checks if the current user has permission to perform the action represented by the given set of Permissions on the current workspace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WabitAccessManager

public WabitAccessManager()
Method Detail

init

public void init(@Nonnull
                 ca.sqlpower.enterprise.client.User currentUser,
                 @Nullable
                 ca.sqlpower.util.SPSession currentSession,
                 @Nonnull
                 ca.sqlpower.util.SPSession systemSession)
Initializes this Access Manager.

Parameters:
currentUser - The user to determine access for.
currentSession - The session that contains all objects in question. It will be used to look up dependencies.
systemSession - The system session that contains currentUser, as well as all groups and grants that apply

init

public void init(@Nonnull
                 ca.sqlpower.enterprise.client.User currentUser,
                 @Nonnull
                 WabitSession systemSession)
Initializes this Access Manager. It will not resolve dependencies when checking access to an object.

Parameters:
currentUser - The user to determine access for.
systemSession - The system session that contains currentUser, as well as all groups and grants that apply.

isGranted

public boolean isGranted(@Nonnull
                         java.lang.String subject,
                         @Nullable
                         java.lang.String type,
                         @Nonnull
                         java.util.Set<ca.sqlpower.enterprise.client.security.SPAccessManager.Permission> permissions)
Checks if the current user has permission to perform the action represented by the given set of Permissions on the object with UUID subject.

Specified by:
isGranted in interface ca.sqlpower.enterprise.client.security.SPAccessManager
Parameters:
subject - The UUID of the object in question.
type - The simple name of the class of the object in question. If null, system level permissions will not be checked.
permissions - A Set of Permissions that represent the action in question. If empty, this method returns true.

isGranted

public boolean isGranted(@Nonnull
                         java.lang.String type,
                         @Nonnull
                         java.util.Set<ca.sqlpower.enterprise.client.security.SPAccessManager.Permission> permissions)
Checks if the current user has permission to perform the action represented by the given set of Permissions on objects of class type

Specified by:
isGranted in interface ca.sqlpower.enterprise.client.security.SPAccessManager
Parameters:
type - The simple name of the class of object in question.
permissions - A Set of Permissions that represent the action in question. If empty, this method returns true.

isWorkspaceGranted

public boolean isWorkspaceGranted(@Nonnull
                                  java.util.Set<ca.sqlpower.enterprise.client.security.SPAccessManager.Permission> permissions)
Checks if the current user has permission to perform the action represented by the given set of Permissions on the current workspace.

Parameters:
permissions - A Set of Permissions that represent the action in question. If empty, this method returns true.

doSystemGrantsPermit

public boolean doSystemGrantsPermit(@Nullable
                                    java.lang.String type,
                                    java.util.List<ca.sqlpower.enterprise.client.Grant> grants,
                                    java.util.Collection<ca.sqlpower.object.SPObject> dependantObjects,
                                    java.util.Set<ca.sqlpower.enterprise.client.security.SPAccessManager.Permission> permissions)
Checks if the given grants give permission to perform the action represented by permissions on the given type of object. Note that this method will not necessarily represent whether the current User can perform the action, only whether a User with the given grants can.

Parameters:
type - The simple name of the class of object in question.
grants - A Collection of grants to check for the given permissions.
dependantObjects - A List of all objects that are dependant on an object in question. If the purpose of this call is to check if system level permissions apply to a specific object, this should be its dependant objects. Else, if the purpose is to check permissions on all objects of the type, this should be empty.
permissions - A Set of Permissions that represent the action in question. If empty, this method returns true.

isGrantGranted

public boolean isGrantGranted(ca.sqlpower.enterprise.client.Grant newGrant)
Checks if the current user has sufficient privilege to create the given Grant.


getCurrentSession

public ca.sqlpower.util.SPSession getCurrentSession()

getSystemSession

public ca.sqlpower.util.SPSession getSystemSession()

getCurrentUser

public ca.sqlpower.enterprise.client.User getCurrentUser()


Copyright © 2009. All Rights Reserved.