|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.kernel.permissions.PermissionCache
Permissions Cache for reducing number of queries issued to the for permission checks. The data in cache stored for duration of transaction. Primary purpose of this class to reduce number of permission queries by caching all of party on object. So the subsequent calls to checkPermission don't issue queries against database even if permission check done for different PrivilegeDescriptors. The typical place to use this class is situation when UI build to show collection of objects with checks for delete, edit, etc links based on user permissions. In the following example there is only one query issued to db: Party party - current User ACSObject - some object to check permision Privilege read -read privilege Privilege write - write privilege privilege admin - admin privilege { PermissinCache permCache = PermissionCache.getInstance(); permCache.checkPermission( New PermissionDescriptor(read, obj, party)); permCache.checkPermission( New PermissionDescriptor(read, obj, party)); permCache.checkPermission( New PermissionDescriptor(write, obj, party)); permCache.checkPermission( New PermissionDescriptor(admin, obj, party)); permCache.checkPermission( New PermissionDescriptor(write, obj, party)); }
Method Summary | |
boolean |
checkPermission(PermissionDescriptor perm)
Checks the permission represented by the passed in PermissionDescriptor . |
static PermissionCache |
getInstance()
Fetches the shared instance of the security manager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static PermissionCache getInstance()
public boolean checkPermission(PermissionDescriptor perm)
PermissionDescriptor
.
First looks in cache for privileges of (party,obj) tuple , if tuple is not present
in the cache, only then issues query to get privileges for party on object.
true
if the PermissionDescriptor's base object has the
specified permission; false
otherwise.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |