Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.acs.damsel.srvr.auth
Class AuthMgr  view AuthMgr download AuthMgr.java

java.lang.Object
  extended byorg.acs.damsel.srvr.auth.AuthMgr

public class AuthMgr
extends java.lang.Object

Class Name: AuthMgr

Description: The Authorization Manager (AuthMgr for short) is a manager-level class that facilitates communication between the server layer and the presentation layer. It provides support for all things related to authorization, including methods for asking whether a specific user has permission to perform a specific action, retrieving permission names from the database, authenticating a user based on username and password, and verifying whether a user is in an administrator.

Version:
1.0

Field Summary
private static org.apache.log4j.Logger log
           
 
Constructor Summary
AuthMgr()
           
 
Method Summary
 boolean can(java.lang.String username, java.lang.String action, java.lang.String target)
          Method to validate high level permissions associated with a specified user in the GroupsTable in the database.
 boolean can(java.lang.String username, java.lang.String action, java.lang.String targetType, java.lang.String keyName, java.lang.String keyValue)
          Method validates low level permissions associated with a specified user in the PermissionsTable table in the database.
 java.lang.String getAllPermissions(int permissionID)
          This method takes in an int and returns the permissions string that the int will represent in the database.
 int getAllPermissions(java.lang.String perm)
          This method takes in a string and returns the int that would be stored in the database.
 int getAllPermissions(java.util.Vector fields, java.util.Vector values)
          This method takes a vector of fieldNames and a vector of values and returns the corresponding permissionID.
 java.util.Vector getPermissionNamesFromID(java.lang.String permissionID)
          This method takes in the permission ID and returns a vector of strings for all the permissions that ID entails.
 java.util.Vector getPermissionsList()
          Method that gets a vector of strings listing all possible permissions in the db.
 org.acs.damsel.srvr.user.User getUser(java.lang.String username, java.lang.String password)
          Method returns a validated user, returns null if user is not valid, or password for user is incorrect.
 boolean isAdministrator(org.acs.damsel.srvr.user.User user)
          Determines if the specified user is an administrator.
 boolean isUserInGroup(java.lang.String userName, java.lang.String groupName)
          Determines whether the specified user belongs to the specified group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Logger log
Constructor Detail

AuthMgr

public AuthMgr()
Method Detail

can

public boolean can(java.lang.String username,
                   java.lang.String action,
                   java.lang.String target)
            throws java.sql.SQLException
Method to validate high level permissions associated with a specified user in the GroupsTable in the database.


can

public boolean can(java.lang.String username,
                   java.lang.String action,
                   java.lang.String targetType,
                   java.lang.String keyName,
                   java.lang.String keyValue)
            throws java.sql.SQLException
Method validates low level permissions associated with a specified user in the PermissionsTable table in the database.


getUser

public org.acs.damsel.srvr.user.User getUser(java.lang.String username,
                                             java.lang.String password)
Method returns a validated user, returns null if user is not valid, or password for user is incorrect.


isAdministrator

public boolean isAdministrator(org.acs.damsel.srvr.user.User user)
Determines if the specified user is an administrator.


getAllPermissions

public int getAllPermissions(java.util.Vector fields,
                             java.util.Vector values)
This method takes a vector of fieldNames and a vector of values and returns the corresponding permissionID. Note that each vector will ALWAYS have ONLY nine elements.


getAllPermissions

public int getAllPermissions(java.lang.String perm)
This method takes in a string and returns the int that would be stored in the database.


getAllPermissions

public java.lang.String getAllPermissions(int permissionID)
This method takes in an int and returns the permissions string that the int will represent in the database.


getPermissionsList

public java.util.Vector getPermissionsList()
Method that gets a vector of strings listing all possible permissions in the db.


isUserInGroup

public boolean isUserInGroup(java.lang.String userName,
                             java.lang.String groupName)
Determines whether the specified user belongs to the specified group.


getPermissionNamesFromID

public java.util.Vector getPermissionNamesFromID(java.lang.String permissionID)
This method takes in the permission ID and returns a vector of strings for all the permissions that ID entails.