org.glite.security.voms.database
Class DBAdmin

java.lang.Object
  extended byorg.glite.security.voms.database.DBAdmin
All Implemented Interfaces:
Cacheable, java.lang.Cloneable

public final class DBAdmin
extends java.lang.Object
implements Cacheable

A class representing VO administrators. Essentially, a wrapper class for the admin table. Administrators are entities that can appear in ACLs. There are two kinds of admin entries: aggregate admins and individual admins. Aggregate admins are special aliases for groups/roles or other sets of individuals in this or another VO -- they help with privilege maintenance. CreatedBy fields are always filled in with (automatically created) individual admin values, not the aggregate admin that the client got authorized with. The CA of an aggregate admin is always the internal virtual CA, but an admin with the internal CA is not necessarily an aggregate admin.

It is not necessary for an admin to be a member of the VO served by this VOMS instance. The mere fact that someone appears in the admins table does not grant any privileges to that user, it only means that the user has previously changed the database or has had the rights to do so. (Admins are mostly for auditing and less for authorizing.)

Currently there are no provisions for deleting an admin from the database, but if the need arises, it would be straightforward to implement an expiration mechanism.

This class is somewhat special in that its methods may be used with both ClientTransactions and DirectUpdates.

Author:
Karoly Lorentey

Method Summary
 java.lang.Object clone()
          Return a copy of this instance.
static DBAdmin create(java.lang.String dn, DBCA ca)
           
static DBAdmin createSelf(Update u, java.lang.String dn, DBCA ca)
           
 boolean equals(java.lang.Object o)
           
 DBUser getAsDBUser()
           
 User getAsUser()
          Return this as a User.
 DBCA getCA()
          Return the CA of this admin.
 java.lang.String getCADN()
          Return the name of this admin's CA.
 int getCAId()
          Return the id of the CA of this admin.
 DBAdmin getCreatedBy()
          Return the admin who created this admin.
 long getCreatedById()
          Return the id of the admin who last modified this admin.
 long getCreatedSerial()
          Return the serial number of the transaction that last modified this admin.
 java.lang.String getDN()
          Return the DN of this admin.
 long getId()
          Return the id of this admin.
static DBAdmin getInstance(long id)
          Return the DBAdmin instance with the given id.
static DBAdmin getInstance(java.lang.String name, DBCA ca)
          Return the DBAdmin instance identified by name and CA.
static DBAdmin getInstance(Transaction t, long id)
          Return the DBAdmin instance with the given id.
static DBAdmin getInstance(Transaction t, java.lang.String name, DBCA ca)
          Return the DBAdmin instance identified by name and CA.
static DBAdmin getInstanceFromAttribute(java.lang.String attribute)
           
static DBAdmin getInstanceFromCapability(java.lang.String groupname, java.lang.String rolename, java.lang.String capability)
           
static DBAdmin getInstanceFromGroup(java.lang.String groupname)
           
static DBAdmin getInstanceFromRole(java.lang.String qualifiedRole)
           
 java.lang.Object[] getKeys()
          Return the keys that are used to refer to this instance in RowCache.
 boolean needsRefresh()
          Return true if it is time to refresh this row.
 void refresh()
          Refresh this row, i.e. retrieve it again from the database.
 java.lang.String toString()
          Convert to a human-readable string representation.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static DBAdmin getInstance(Transaction t,
                                  java.lang.String name,
                                  DBCA ca)
                           throws GeneralDatabaseException,
                                  NotInDatabase,
                                  ArgumentException
Return the DBAdmin instance identified by name and CA. Use the supplied Transaction instance for database access.

Throws:
GeneralDatabaseException
NotInDatabase
ArgumentException

getInstance

public static DBAdmin getInstance(Transaction t,
                                  long id)
                           throws GeneralDatabaseException,
                                  NotInDatabase
Return the DBAdmin instance with the given id. Use the supplied Transaction instance for database access.

Throws:
GeneralDatabaseException
NotInDatabase

getInstance

public static DBAdmin getInstance(java.lang.String name,
                                  DBCA ca)
                           throws GeneralDatabaseException,
                                  NotInDatabase,
                                  ArgumentException
Return the DBAdmin instance identified by name and CA.

Throws:
GeneralDatabaseException
NotInDatabase
ArgumentException

getInstance

public static DBAdmin getInstance(long id)
                           throws GeneralDatabaseException,
                                  NotInDatabase
Return the DBAdmin instance with the given id.

Throws:
GeneralDatabaseException
NotInDatabase

getInstanceFromAttribute

public static DBAdmin getInstanceFromAttribute(java.lang.String attribute)
                                        throws GeneralDatabaseException,
                                               NotInDatabase,
                                               ArgumentException
Throws:
GeneralDatabaseException
NotInDatabase
ArgumentException

getInstanceFromGroup

public static DBAdmin getInstanceFromGroup(java.lang.String groupname)
                                    throws GeneralDatabaseException,
                                           NotInDatabase,
                                           ArgumentException
Throws:
GeneralDatabaseException
NotInDatabase
ArgumentException

getInstanceFromRole

public static DBAdmin getInstanceFromRole(java.lang.String qualifiedRole)
                                   throws GeneralDatabaseException,
                                          NotInDatabase,
                                          ArgumentException
Throws:
GeneralDatabaseException
NotInDatabase
ArgumentException

getInstanceFromCapability

public static DBAdmin getInstanceFromCapability(java.lang.String groupname,
                                                java.lang.String rolename,
                                                java.lang.String capability)
                                         throws DatabaseError,
                                                NotInDatabase,
                                                InconsistentDatabase,
                                                ArgumentException
Throws:
DatabaseError
NotInDatabase
InconsistentDatabase
ArgumentException

needsRefresh

public boolean needsRefresh()
Description copied from interface: Cacheable
Return true if it is time to refresh this row.

Specified by:
needsRefresh in interface Cacheable

refresh

public void refresh()
Description copied from interface: Cacheable
Refresh this row, i.e. retrieve it again from the database.

Specified by:
refresh in interface Cacheable

getKeys

public java.lang.Object[] getKeys()
Description copied from interface: Cacheable
Return the keys that are used to refer to this instance in RowCache.

Specified by:
getKeys in interface Cacheable

clone

public java.lang.Object clone()
Description copied from interface: Cacheable
Return a copy of this instance. The copy must not share mutable data with the original instance.

Specified by:
clone in interface Cacheable

equals

public boolean equals(java.lang.Object o)

getId

public long getId()
Return the id of this admin.


getCAId

public int getCAId()
Return the id of the CA of this admin. Please consider using getCA instead of this method.

See Also:
getCA()

getDN

public java.lang.String getDN()
Return the DN of this admin.


toString

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


getCreatedById

public long getCreatedById()
Return the id of the admin who last modified this admin. Please consider using getCreatedBy instead of this method.

See Also:
getCreatedBy()

getCreatedSerial

public long getCreatedSerial()
Return the serial number of the transaction that last modified this admin.


getCA

public DBCA getCA()
           throws GeneralDatabaseException
Return the CA of this admin.

Throws:
GeneralDatabaseException

getCreatedBy

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

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

getCADN

public java.lang.String getCADN()
                         throws GeneralDatabaseException
Return the name of this admin's CA.

Throws:
GeneralDatabaseException

create

public static DBAdmin create(java.lang.String dn,
                             DBCA ca)
                      throws ArgumentException,
                             GeneralDatabaseException
Throws:
ArgumentException
GeneralDatabaseException

createSelf

public static DBAdmin createSelf(Update u,
                                 java.lang.String dn,
                                 DBCA ca)
                          throws ArgumentException,
                                 GeneralDatabaseException
Throws:
ArgumentException
GeneralDatabaseException

getAsUser

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

Throws:
GeneralDatabaseException
NotInDatabase

getAsDBUser

public DBUser getAsDBUser()
                   throws GeneralDatabaseException,
                          NotInDatabase
Throws:
GeneralDatabaseException
NotInDatabase