com.arsdigita.acs
Class UserInfo

java.lang.Object
  |
  +--com.arsdigita.acs.UserInfo
Direct Known Subclasses:
GroupMember

public class UserInfo
extends Object

Class to abstract information about a user of the web service.


Constructor Summary
  UserInfo(int userId)
           
(package private) UserInfo(ResultSet rs)
           
  UserInfo(String userId)
           
  UserInfo(String email, String passwd)
          Validates a user login attempt.
 
Method Summary
 String getEmail()
           
 String getFirstNames()
           
 String getFullName()
           
 String getLastName()
           
 Integer getUserId()
           
 String getUserState()
           
 boolean isAdministrationGroupMember(String module, String sub)
          Verifies that this user is a member of administration group for the given module and submodule.
 boolean isGroupAdmin(Object groupId)
          Verifies that this user is an administrator of groupId.
 boolean isGroupMember(Object groupId)
          Verifies that this user is a member of groupId.
 boolean isSiteWideAdmin()
          returns true if a user is a site-wide admin.
 String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserInfo

public UserInfo(String email,
                String passwd)
         throws SQLException,
                ACSException
Validates a user login attempt. If successful, returns a new UserInfo instance. Otherwise, throws ACSException with a detail message, either "password incorrect" or "user not found".
Parameters:
email - The user's email address
passwd - The user's supplied password, to validate
Throws:
ACSException -  

UserInfo

public UserInfo(String userId)
         throws SQLException,
                ACSException

UserInfo

public UserInfo(int userId)
         throws SQLException,
                ACSException

UserInfo

UserInfo(ResultSet rs)
   throws SQLException,
          ACSException
Method Detail

getUserId

public Integer getUserId()
Returns:
The user's user ID.

getFirstNames

public String getFirstNames()
Returns:
The user's first name.

getLastName

public String getLastName()
Returns:
The user's last name.

getFullName

public String getFullName()
Returns:
The user's full (first + last) name.

getEmail

public String getEmail()
Returns:
The user's email address.

getUserState

public String getUserState()
Returns:
The user's registration state

toString

public String toString()
Overrides:
toString in class Object

isGroupMember

public boolean isGroupMember(Object groupId)
                      throws SQLException,
                             ACSException
Verifies that this user is a member of groupId.
Returns:
true if the user is a member of groupId; otherwise false

isGroupAdmin

public boolean isGroupAdmin(Object groupId)
                     throws SQLException,
                            ACSException
Verifies that this user is an administrator of groupId.
Returns:
true if the user is a member of groupId; otherwise false

isAdministrationGroupMember

public boolean isAdministrationGroupMember(String module,
                                           String sub)
                                    throws SQLException,
                                           ACSException
Verifies that this user is a member of administration group for the given module and submodule.
Parameters:
module - The module
submodule - The submodule (or null/empty if none)
Returns:
true if the user is a member of the module admin group; otherwise false

isSiteWideAdmin

public boolean isSiteWideAdmin()
returns true if a user is a site-wide admin.