net.sf.farrago.db
Class FarragoDbSessionPrivilegeChecker

java.lang.Object
  extended by net.sf.farrago.db.FarragoDbSessionPrivilegeChecker
All Implemented Interfaces:
FarragoSessionPrivilegeChecker

public class FarragoDbSessionPrivilegeChecker
extends Object
implements FarragoSessionPrivilegeChecker

Implements the FarragoSessionPrivilegeChecker interface in the context of a FarragoDbSession.

An instance of this class must be created per statement i.e. it can't be shared between statements.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/db/FarragoDbSessionPrivilegeChecker.java#14 $
Author:
Tai Tran

Field Summary
private  Map<List<FemAuthId>,Set<FemAuthId>> authMap
           
private  FemRole publicRole
           
private  FarragoSession session
           
 
Constructor Summary
FarragoDbSessionPrivilegeChecker(FarragoSession session)
           
 
Method Summary
 void checkAccess()
          Checks access for all requests that have been submitted, and clears the request list.
private  FemRole getPublicRole()
           
private  void inheritRoles(FemRole role, Set<FemAuthId> inheritedRoles)
           
 void requestAccess(CwmModelElement obj, FemUser user, FemRole role, String action)
          Submits a request for access to a catalog object.
private  boolean testAccess(CwmModelElement obj, Set<FemAuthId> authSet, String action)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

private final FarragoSession session

authMap

private final Map<List<FemAuthId>,Set<FemAuthId>> authMap

publicRole

private FemRole publicRole
Constructor Detail

FarragoDbSessionPrivilegeChecker

public FarragoDbSessionPrivilegeChecker(FarragoSession session)
Method Detail

requestAccess

public void requestAccess(CwmModelElement obj,
                          FemUser user,
                          FemRole role,
                          String action)
Description copied from interface: FarragoSessionPrivilegeChecker
Submits a request for access to a catalog object. Actual checking of the request may be deferred until the next call to checkAccess. It is legal to specify neither, one, or both of user and role; even when both are null, privileges granted to PUBLIC still apply.

Specified by:
requestAccess in interface FarragoSessionPrivilegeChecker
Parameters:
obj - object to be accessed
user - the requesting user, or null for none
role - the requesting role, or null for none
action - the action to be performed on obj (see PrivilegedActionEnum for base set)

getPublicRole

private FemRole getPublicRole()

checkAccess

public void checkAccess()
Description copied from interface: FarragoSessionPrivilegeChecker
Checks access for all requests that have been submitted, and clears the request list.

Specified by:
checkAccess in interface FarragoSessionPrivilegeChecker

inheritRoles

private void inheritRoles(FemRole role,
                          Set<FemAuthId> inheritedRoles)

testAccess

private boolean testAccess(CwmModelElement obj,
                           Set<FemAuthId> authSet,
                           String action)