org.hsqldb.rights
Class UserManager
- java.lang.Object
-
- org.hsqldb.rights.UserManager
-
public final class UserManager extends java.lang.ObjectManages 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)").- Since:
- 1.7.2
- See Also:
User
-
-
Constructor Summary
Constructors Constructor and Description UserManager(Database database)Construction happens once for each Database instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleancheckComplexity(Session session, java.lang.String password)voidcreateFirstUser(java.lang.String username, java.lang.String password)UsercreateUser(Session session, HsqlNameManager.HsqlName name, java.lang.String password, boolean isDigest)Creates a new User object under management of this object.voiddropUser(java.lang.String name)Attempts to drop a User object with the specified name from this object's set.booleanexists(java.lang.String name)Userget(java.lang.String name)Returns the User object identified by the name argument.java.lang.String[]getAuthenticationSQL()java.lang.String[]getInitialSchemaSQL()UsergetSysUser()Returns the specially constructedSYSTEM_AUTHORIZATION_NAMEUserobject for the currentDatabaseobject.UsergetUser(java.lang.String name, java.lang.String password)Returns the User object with the specified name and password from this object's set.HashMappedListgetUsers()Retrieves this object's set of User objects as an associative list.HsqlArrayListlistVisibleUsers(Session session)Retrieves theUserobjects representing the database users that are visible to theUserobject represented by thesessionargument.voidremoveSchemaReference(java.lang.String schemaName)voidsetExtAuthenticationFunction(Routine function)voidsetPassword(Session session, User user, java.lang.String password, boolean isDigest)voidsetPasswordCheckFunction(Routine function)
-
-
-
Constructor Detail
-
UserManager
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
-
createUser
public User createUser(Session session, HsqlNameManager.HsqlName name, java.lang.String password, boolean isDigest)
Creates a new User object under management of this object.A set of constraints regarding user creation is imposed:
- If the specified name is null, then an ASSERTION_FAILED exception is thrown stating that the name is null.
- 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).
-
setPassword
public void setPassword(Session session, User user, java.lang.String password, boolean isDigest)
-
checkComplexity
public boolean checkComplexity(Session session, java.lang.String password)
-
dropUser
public void dropUser(java.lang.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 erronously access database objects).
-
createFirstUser
public void createFirstUser(java.lang.String username, java.lang.String password)
-
getUser
public User getUser(java.lang.String name, java.lang.String password)
Returns the User object with the specified name and password from this object's set.
-
getUsers
public HashMappedList getUsers()
Retrieves this object's set of User objects as an associative list.
-
exists
public boolean exists(java.lang.String name)
-
get
public User get(java.lang.String name)
Returns the User object identified by the name argument.
-
listVisibleUsers
public HsqlArrayList listVisibleUsers(Session session)
Retrieves theUserobjects representing the database users that are visible to theUserobject represented by thesessionargument.If the
sessionargument'sUserobject attribute has isAdmin() true (directly or by virtue of a Role), then all of theUserobjects in this collection are considered visible. Otherwise, only this object's specialPUBLICUserobject attribute and the sessionUserobject, if it exists in this collection, are considered visible.- Parameters:
session- TheSessionobject used to determine visibility- Returns:
- a list of
Userobjects visible to theUserobject contained by thesessionargument.
-
getSysUser
public User getSysUser()
Returns the specially constructedSYSTEM_AUTHORIZATION_NAMEUserobject for the currentDatabaseobject.- Returns:
- the
SYS_AUTHORIZATION_NAMEUserobject
-
removeSchemaReference
public void removeSchemaReference(java.lang.String schemaName)
-
setPasswordCheckFunction
public void setPasswordCheckFunction(Routine function)
-
setExtAuthenticationFunction
public void setExtAuthenticationFunction(Routine function)
-
getInitialSchemaSQL
public java.lang.String[] getInitialSchemaSQL()
-
getAuthenticationSQL
public java.lang.String[] getAuthenticationSQL()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG