Top Description Fields Constructors Methods
org.hsqldb.rights

public final Class UserManager

extends Object
Class Inheritance
Imports
org.hsqldb.Database, .HsqlException, .HsqlNameManager.HsqlName, .Routine, .Schema, .SchemaObject, .Session, .SqlInvariants, .Tokens, org.hsqldb.error.Error, .ErrorCode, org.hsqldb.lib.HsqlArrayList, .List, .OrderedHashMap, org.hsqldb.result.Result

Manages the User objects for a Database instance. The special users PUBLIC_USER_NAME and SYSTEM_AUTHORIZATION_NAME are created and managed here. SYSTEM_AUTHORIZATION_NAME is also special in that the name is not kept in the user "list" (PUBLIC_USER_NAME is kept in the list because it's needed by MetaData routines via "listVisibleUsers(x, true)").
Authors
Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
Since
1.7.2
Version
2.7.3
See Also
User

Field Summary

Modifier and TypeField and Description
pack-priv Routine
private GranteeManager
pack-priv Routine
pwCheckFunction

The function for password complexity.

private OrderedHashMap<String, User>
userList

This object's set of User objects.

Constructor Summary

AccessConstructor and Description
public
UserManager(Database database)

Construction happens once for each Database instance.

Method Summary

Modifier and TypeMethod and Description
public boolean
checkComplexity(Session session, String password)

public void
createFirstUser(String username, String password)

public User
createUser(Session session, HsqlNameManager.HsqlName name, String password, boolean isDigest)

Creates a new User object under management of this object.

public void
dropUser(String name)

Attempts to drop a User object with the specified name from this object's set.

public boolean
exists(String name)

public User
get(String name)

Returns the User object identified by the name argument.

public List<String>
public List<String>
public User

Returns:

the SYS_AUTHORIZATION_NAME User object
getSysUser
()

Returns the specially constructed SYSTEM_AUTHORIZATION_NAME User object for the current Database object.

public User
getUser(String name, String password)

Returns the User object with the specified name and password from this object's set.

public OrderedHashMap<String, User>
getUsers()

Retrieves this object's set of User objects as an associative list.

public HsqlArrayList<User>

Returns:

a list of User objects visible to the User object contained by the session argument.
listVisibleUsers
(Session
The Session object used to determine visibility
session
)

Retrieves the User objects representing the database users that are visible to the User object represented by the session argument.

public synchronized void
public void
public void
setPassword(Session session, User user, String password, boolean isDigest)

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

extAuthenticationFunctionback to summary
pack-priv Routine extAuthenticationFunction
granteeManagerback to summary
private GranteeManager granteeManager
pwCheckFunctionback to summary
pack-priv Routine pwCheckFunction

The function for password complexity.

userListback to summary
private OrderedHashMap<String, User> userList

This object's set of User objects.

Note

The special _SYSTEM role is not included in this list but the special PUBLIC User object is kept in the list because it's needed by MetaData routines via "listVisibleUsers(x, true)".

Constructor Detail

UserManagerback to summary
public UserManager(Database database)

Construction happens once for each Database instance. Creates special users PUBLIC_USER_NAME and SYSTEM_AUTHORIZATION_NAME. Sets up association with the GranteeManager for this database.

Method Detail

checkComplexityback to summary
public boolean checkComplexity(Session session, String password)
createFirstUserback to summary
public void createFirstUser(String username, String password)
createUserback to summary
public User createUser(Session session, HsqlNameManager.HsqlName name, String password, boolean isDigest)

Creates a new User object under management of this object.

A set of constraints regarding user creation is imposed:

  1. If the specified name is null, then an ASSERTION_FAILED exception is thrown stating that the name is null.
  2. If this object's collection already contains an element whose name attribute equals the name argument, then a GRANTEE_ALREADY_EXISTS exception is thrown. (This will catch attempts to create Reserved grantee names).
dropUserback to summary
public void dropUser(String name)

Attempts to drop a User object with the specified name from this object's set.

A successful drop action consists of:

  • removing the User object with the specified name from the set.
  • revoking all rights from the removed User
    (this ensures that in case there are still references to the just dropped User object, those references cannot be used to erroneously access database objects).
existsback to summary
public boolean exists(String name)
getback to summary
public User get(String name)

Returns the User object identified by the name argument.

getAuthenticationSQLArrayback to summary
public List<String> getAuthenticationSQLArray()
getInitialSchemaSQLArrayback to summary
public List<String> getInitialSchemaSQLArray()
getSysUserback to summary
public User getSysUser()

Returns the specially constructed SYSTEM_AUTHORIZATION_NAME User object for the current Database object.

Returns:User

the SYS_AUTHORIZATION_NAME User object

getUserback to summary
public User getUser(String name, String password)

Returns the User object with the specified name and password from this object's set.

getUsersback to summary
public OrderedHashMap<String, User> getUsers()

Retrieves this object's set of User objects as an associative list.

listVisibleUsersback to summary
public HsqlArrayList<User> listVisibleUsers(Session session)

Retrieves the User objects representing the database users that are visible to the User object represented by the session argument.

If the session argument's User object attribute has isAdmin() true (directly or by virtue of a Role), then all of the User objects in this collection are considered visible. Otherwise, only this object's special PUBLIC User object attribute and the session User object, if it exists in this collection, are considered visible.

Parameters
session:Session

The Session object used to determine visibility

Returns:HsqlArrayList<User>

a list of User objects visible to the User object contained by the session argument.

removeSchemaReferenceback to summary
public synchronized void removeSchemaReference(HsqlNameManager.HsqlName schemaName)
setExtAuthenticationFunctionback to summary
public void setExtAuthenticationFunction(Routine function)
setPasswordback to summary
public void setPassword(Session session, User user, String password, boolean isDigest)
setPasswordCheckFunctionback to summary
public void setPasswordCheckFunction(Routine function)