com.taggercat.security
Class DefaultPermissionReader

java.lang.Object
  extended by com.taggercat.security.DefaultPermissionReader
All Implemented Interfaces:
PermissionReader

public class DefaultPermissionReader
extends java.lang.Object
implements PermissionReader

This class is used to read the entity and property permissions from the metadata system tables. The permission queries are cached in Hibernate's second level cache.

 

Constructor Summary
DefaultPermissionReader()
           
 
Method Summary
 int getEntityPermissions(org.hibernate.SessionFactory sessionFactory, java.lang.String entityName, java.lang.String groupIds)
          Returns a bit mask of permissions for the specified group Ids on the specified entity.
 int getExpressionBasedPermission(java.lang.String expression)
           
 int getPropertyPermissions(org.hibernate.SessionFactory sessionFactory, java.lang.String entityName, java.lang.String propertyName, java.lang.String groupIds)
          Returns the bit mask of permission on the named property for the specified group Ids.
 boolean hasEntityPermission(org.hibernate.SessionFactory sessionFactory, java.lang.String entityName, java.lang.String groupIds, int permission)
           
 boolean hasPropertyPermission(org.hibernate.SessionFactory sessionFactory, java.lang.String entityName, java.lang.String propertyName, java.lang.String groupIds, int permission)
          Returns true if the user has the specified permission.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPermissionReader

public DefaultPermissionReader()
Method Detail

hasPropertyPermission

public boolean hasPropertyPermission(org.hibernate.SessionFactory sessionFactory,
                                     java.lang.String entityName,
                                     java.lang.String propertyName,
                                     java.lang.String groupIds,
                                     int permission)
                              throws java.lang.Exception
Description copied from interface: PermissionReader
Returns true if the user has the specified permission.

Specified by:
hasPropertyPermission in interface PermissionReader
Throws:
java.lang.Exception
Parameters:
sessionFactory - the session factory to use
entityName - the entity name
propertyName - the property name
groupIds - the group names
permission - the permission to test for
Returns:
true if the permission is granted

getPropertyPermissions

public int getPropertyPermissions(org.hibernate.SessionFactory sessionFactory,
                                  java.lang.String entityName,
                                  java.lang.String propertyName,
                                  java.lang.String groupIds)
                           throws java.lang.Exception
Returns the bit mask of permission on the named property for the specified group Ids.

Specified by:
getPropertyPermissions in interface PermissionReader
Throws:
java.lang.Exception
Parameters:
sessionFactory - the session factory to use
entityName - the entity name
propertyName - the property name
groupIds - the group names
Returns:
the bit mask of permissions

hasEntityPermission

public boolean hasEntityPermission(org.hibernate.SessionFactory sessionFactory,
                                   java.lang.String entityName,
                                   java.lang.String groupIds,
                                   int permission)
                            throws java.lang.Exception
Specified by:
hasEntityPermission in interface PermissionReader
Throws:
java.lang.Exception

getEntityPermissions

public int getEntityPermissions(org.hibernate.SessionFactory sessionFactory,
                                java.lang.String entityName,
                                java.lang.String groupIds)
                         throws java.lang.Exception
Returns a bit mask of permissions for the specified group Ids on the specified entity.

Specified by:
getEntityPermissions in interface PermissionReader
Throws:
java.lang.Exception
Parameters:
sessionFactory - the session factory to use
entityName - the entity name
groupIds - the group names to check permissions for
Returns:
bitmask of permissions

getExpressionBasedPermission

public int getExpressionBasedPermission(java.lang.String expression)
                                 throws java.lang.Exception
Throws:
java.lang.Exception