cmu.jspsurveymanager.data
Class Survey.Permission

java.lang.Object
  extended by cmu.jspsurveymanager.data.Survey.Permission
Enclosing class:
Survey

public class Survey.Permission
extends java.lang.Object

A utility class used to determine and set permissions relating to specific Admins and surveys.


Field Summary
static int DATA
          Data access permission constant
static int DELETE
          Delete survey permission constant
static char DENIED
          Character that represents a denied permission.
static int EDIT
          Edit permission constant
static int GRANT
          Grant permission constant
static char GRANTED
          Character that represents a granted permission.
static int STATUS
          Status change permission constant
static int USERS
          User management permission constant
 
Method Summary
 Admin[] adminsWithPermission()
           
 void clear(Admin admin)
          Method clearPermissions
 boolean get(Admin admin, int perm)
          Queries a permission for this survey for a particular user.
 void set(Admin admin)
          Sets ALL permission values for this survey for a particular user.
 void set(Admin admin, int perm, char granted)
          Sets a permission value for this survey for a particular user.
 void set(int admin, int perm, char granted)
          Sets a permission value for this survey for a particular user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRANT

public static final int GRANT
Grant permission constant

See Also:
Constant Field Values

STATUS

public static final int STATUS
Status change permission constant

See Also:
Constant Field Values

EDIT

public static final int EDIT
Edit permission constant

See Also:
Constant Field Values

USERS

public static final int USERS
User management permission constant

See Also:
Constant Field Values

DATA

public static final int DATA
Data access permission constant

See Also:
Constant Field Values

DELETE

public static final int DELETE
Delete survey permission constant

See Also:
Constant Field Values

GRANTED

public static final char GRANTED
Character that represents a granted permission.

See Also:
Constant Field Values

DENIED

public static final char DENIED
Character that represents a denied permission.

See Also:
Constant Field Values
Method Detail

get

public boolean get(Admin admin,
                   int perm)
Queries a permission for this survey for a particular user.

Parameters:
admin - the admin whose permissions are being checked
perm - a constant representing a particular permission
Returns:
true if the permission has been granted

set

public void set(Admin admin,
                int perm,
                char granted)
Sets a permission value for this survey for a particular user.

Parameters:
admin - the admin whose permission is being set
perm - a constant representing a particular permission
granted - a boolean: true to grant and false to deny

set

public void set(int admin,
                int perm,
                char granted)
Sets a permission value for this survey for a particular user.

Parameters:
admin - the ID of the admin whose permission is being set
perm - a constant representing a particular permission
granted - a boolean: true to grant and false to deny

set

public void set(Admin admin)
Sets ALL permission values for this survey for a particular user.

Parameters:
admin - the ID of the admin whose permission is being set

clear

public void clear(Admin admin)
Method clearPermissions

Parameters:
admin - The Admin to clear permissions for.

adminsWithPermission

public Admin[] adminsWithPermission()