org.glite.security.voms.database
Class DBUser

java.lang.Object
  extended byorg.glite.security.voms.database.DBUser

public final class DBUser
extends java.lang.Object

A class representing the users in a VO. Essentially, a database wrapper class for the users table.

Author:
Karoly Lorentey, Akos Frohner

Method Summary
 int countCapabilities()
          Return the number of capabilities that this user has.
 int countGroups()
          Return the number of groups that this user is a member of, including the VO group.
 int countRoles()
          Return the number of role-group pairs that this user has.
static DBUser createUser(java.lang.String dn, java.lang.String cn, DBCA ca, java.lang.String certUri, java.lang.String mail)
          Creates a new user in the database.
 void deleteUser()
          Deletes a user from the database.
static java.util.List getAllUsernames()
           
 User getAsUser()
          Return this as a User.
 DBCA getCA()
          Return the CA of this user.
 java.lang.String[] getCapabilityNames()
          Return the names of all capabilities that this user has.
 java.lang.String getCertUri()
          Return the URI to the user's certificate.
 java.lang.String getCN()
          Return the common name of this user.
 DBAdmin getCreatedBy()
          Return the admin who created this user.
 long getCreatedSerial()
          Return the serial number of the transaction that committed this user.
 java.lang.String getDN()
          Return the distinguished name of this user.
 java.lang.String[] getGroupnames()
          Return the names of all groups that this user is a member of, including the VO group, in an unspecified order.
static DBUser getInstance(java.lang.String name, DBCA ca)
           
static DBUser getInstance(User user)
           
static DBUser getInstanceFromSecurityContext()
          Returns the user object associated with the current client.
 java.lang.String getMail()
          Return the email address of this user.
 java.lang.String[] getRolenames()
          Return the names of all role-group pairs that this user has.
 void setAttributes(java.lang.String cn, java.lang.String mail, java.lang.String certUri)
          Set auxiliary attributes.
 java.lang.String toString()
          Convert to a human-readable string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static DBUser getInstance(java.lang.String name,
                                 DBCA ca)
                          throws GeneralDatabaseException,
                                 NotInDatabase,
                                 ArgumentException
Throws:
GeneralDatabaseException
NotInDatabase
ArgumentException

getInstance

public static DBUser getInstance(User user)
                          throws GeneralDatabaseException,
                                 NotInDatabase,
                                 ArgumentException
Throws:
GeneralDatabaseException
NotInDatabase
ArgumentException

getInstanceFromSecurityContext

public static DBUser getInstanceFromSecurityContext()
                                             throws GeneralDatabaseException,
                                                    NotInDatabase,
                                                    VOMSSecurityException
Returns the user object associated with the current client.

Throws:
VOMSSecurityException - if the client's credentials could not be determined or if the client is not a user in the database.
GeneralDatabaseException
NotInDatabase

getDN

public java.lang.String getDN()
Return the distinguished name of this user.


toString

public java.lang.String toString()
Convert to a human-readable string representation.


getCN

public java.lang.String getCN()
Return the common name of this user.


getMail

public java.lang.String getMail()
Return the email address of this user.


getCertUri

public java.lang.String getCertUri()
Return the URI to the user's certificate.


getCreatedSerial

public long getCreatedSerial()
Return the serial number of the transaction that committed this user.


getCA

public DBCA getCA()
           throws GeneralDatabaseException,
                  NotInDatabase
Return the CA of this user.

Throws:
GeneralDatabaseException
NotInDatabase

getCreatedBy

public DBAdmin getCreatedBy()
                     throws GeneralDatabaseException,
                            NotInDatabase
Return the admin who created this user.

Returns:
the creator of this user if she is still in the database.
Throws:
NotInDatabase - if the creator has been deleted from the database.
GeneralDatabaseException

getAsUser

public User getAsUser()
               throws GeneralDatabaseException,
                      NotInDatabase
Return this as a User.

Throws:
GeneralDatabaseException
NotInDatabase

setAttributes

public void setAttributes(java.lang.String cn,
                          java.lang.String mail,
                          java.lang.String certUri)
                   throws GeneralDatabaseException
Set auxiliary attributes.

Throws:
GeneralDatabaseException

createUser

public static DBUser createUser(java.lang.String dn,
                                java.lang.String cn,
                                DBCA ca,
                                java.lang.String certUri,
                                java.lang.String mail)
                         throws GeneralDatabaseException,
                                ArgumentException
Creates a new user in the database.

Throws:
GeneralDatabaseException
ArgumentException

deleteUser

public void deleteUser()
                throws GeneralDatabaseException,
                       NotInDatabase
Deletes a user from the database.

Throws:
GeneralDatabaseException
NotInDatabase

getAllUsernames

public static java.util.List getAllUsernames()
                                      throws GeneralDatabaseException
Throws:
GeneralDatabaseException

countGroups

public int countGroups()
                throws GeneralDatabaseException
Return the number of groups that this user is a member of, including the VO group.

Throws:
GeneralDatabaseException

getGroupnames

public java.lang.String[] getGroupnames()
                                 throws GeneralDatabaseException
Return the names of all groups that this user is a member of, including the VO group, in an unspecified order.

Throws:
GeneralDatabaseException

countRoles

public int countRoles()
               throws GeneralDatabaseException
Return the number of role-group pairs that this user has.

Throws:
GeneralDatabaseException

getRolenames

public java.lang.String[] getRolenames()
                                throws GeneralDatabaseException
Return the names of all role-group pairs that this user has.

Throws:
GeneralDatabaseException

countCapabilities

public int countCapabilities()
                      throws GeneralDatabaseException
Return the number of capabilities that this user has.

Throws:
GeneralDatabaseException

getCapabilityNames

public java.lang.String[] getCapabilityNames()
                                      throws GeneralDatabaseException
Return the names of all capabilities that this user has.

Throws:
GeneralDatabaseException