com.taggercat
Class PermissonContext

java.lang.Object
  extended by com.taggercat.PermissonContext

public class PermissonContext
extends java.lang.Object

A PermissonContext attached to the current thread ( a ThreadLocal ).

The Tagger Cat filter creates an instance on each in-bound request and clears it upon completion.

The context contains the currently checked permissions on the current request cycle.

Therefore, this is a thread local cache of checked permissions for the current user. For performance reasons, you should use the PermissonContext to check permissions, rather than directly from the permission reader.

 

Method Summary
static PermissonContext getCurrent()
           
 java.lang.Integer getEntityPermissions(java.lang.String entityName)
           
 java.lang.String getGroupIds()
           
 PermissionReader getPermissionReader()
           
 java.lang.Integer getPropertyPermissions(java.lang.String entityName, java.lang.String propertyName)
           
 org.hibernate.SessionFactory getSessionFactory()
           
 boolean hasEntityPermissions(java.lang.String entityName, int permissionType)
           
 boolean hasPropertyPermissions(java.lang.String entityName, java.lang.String propertyName, int permissionType)
           
static PermissonContext init(org.hibernate.SessionFactory sessionFactory, PermissionReader permissionReader, LoginInfo loginInfo)
           
 boolean isAdminUser()
           
 boolean isInRhinoCall()
           
static void remove()
           
 void setAdminUser(boolean isAdminUser)
           
 void setInRhinoCall(boolean inRhinoCall)
           
 void setPermissionReader(PermissionReader permissionReader)
           
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCurrent

public static PermissonContext getCurrent()

init

public static PermissonContext init(org.hibernate.SessionFactory sessionFactory,
                                    PermissionReader permissionReader,
                                    LoginInfo loginInfo)

remove

public static void remove()

hasEntityPermissions

public boolean hasEntityPermissions(java.lang.String entityName,
                                    int permissionType)
                             throws java.lang.Exception
Throws:
java.lang.Exception

hasPropertyPermissions

public boolean hasPropertyPermissions(java.lang.String entityName,
                                      java.lang.String propertyName,
                                      int permissionType)
                               throws java.lang.Exception
Throws:
java.lang.Exception

getPropertyPermissions

public java.lang.Integer getPropertyPermissions(java.lang.String entityName,
                                                java.lang.String propertyName)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

getEntityPermissions

public java.lang.Integer getEntityPermissions(java.lang.String entityName)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

getPermissionReader

public PermissionReader getPermissionReader()

setPermissionReader

public void setPermissionReader(PermissionReader permissionReader)

getSessionFactory

public org.hibernate.SessionFactory getSessionFactory()

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)

getGroupIds

public java.lang.String getGroupIds()

isAdminUser

public boolean isAdminUser()

setAdminUser

public void setAdminUser(boolean isAdminUser)

isInRhinoCall

public boolean isInRhinoCall()
Returns:
the inRhinoCall

setInRhinoCall

public void setInRhinoCall(boolean inRhinoCall)
Parameters:
inRhinoCall - the inRhinoCall to set