com.arsdigita.acs
Class Permissions

java.lang.Object
  |
  +--com.arsdigita.acs.Permissions

public class Permissions
extends java.lang.Object

Methods for checking permissions on ACS objects.


Field Summary
static java.lang.String cvsId
           
 
Constructor Summary
Permissions()
           
 
Method Summary
static boolean hasPermission(java.math.BigDecimal objectId, java.math.BigDecimal userId, java.lang.String privilege)
          Checks to see if a user has a permission on an ACS Object.
static boolean hasPermission(java.math.BigDecimal objectId, java.lang.String privilige)
          Cache for recently-requested permissions.
static void requirePermission(java.math.BigDecimal objectId, java.lang.String privilege)
          Requires that the user has the specified privilege on the ACS object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cvsId

public static java.lang.String cvsId
Constructor Detail

Permissions

public Permissions()
Method Detail

hasPermission

public static boolean hasPermission(java.math.BigDecimal objectId,
                                    java.lang.String privilige)
                             throws java.sql.SQLException
Cache for recently-requested permissions. Cache for up to 15 minutes. private static com.arsdigita.util.Cache cache = new com.arsdigita.util.Cache(10000L, (long)60*1000L*15);

hasPermission

public static boolean hasPermission(java.math.BigDecimal objectId,
                                    java.math.BigDecimal userId,
                                    java.lang.String privilege)
                             throws java.sql.SQLException
Checks to see if a user has a permission on an ACS Object.
Parameters:
objectId - the object ID
userId - the user who's logged in or null for the current user
privilige - the type of permission we're asking for; e.g., read, write, admin
Returns:
true if user has permission, false otherwise

requirePermission

public static void requirePermission(java.math.BigDecimal objectId,
                                     java.lang.String privilege)
                              throws java.sql.SQLException,
                                     ACSException
Requires that the user has the specified privilege on the ACS object. Does nothing if the user has the permission. Otherwise, throws ACSException to terminate the calling page.
Throws:
ACSException - if the user doesn't have the specified permission, or is not logged in and the object requires a log-in.