public final class User extends RightOwner
Constructor and Description |
---|
User(Database database,
int id,
java.lang.String userName,
boolean systemUser) |
Modifier and Type | Method and Description |
---|---|
void |
checkAdmin()
Checks if this user has admin rights.
|
void |
checkSchemaAdmin()
Checks if this user has schema admin rights for every schema.
|
void |
checkSchemaOwner(org.h2.schema.Schema schema)
Checks if this user has schema owner rights for the specified schema.
|
void |
checkTableRight(org.h2.table.Table table,
int rightMask)
Checks that this user has the given rights for the specified table.
|
java.util.ArrayList<DbObject> |
getChildren()
Get the list of dependent children (for tables, this includes indexes and
so on).
|
java.lang.String |
getCreateSQL()
Construct the CREATE ...
|
java.lang.String |
getCreateSQL(boolean password)
Get the CREATE SQL statement for this object.
|
int |
getType()
Get the object type.
|
boolean |
hasTableRight(org.h2.table.Table table,
int rightMask)
See if this user has the given rights for this database object.
|
boolean |
isAdmin() |
void |
removeChildrenAndResources(SessionLocal session)
Delete all dependent children objects and resources of this object.
|
void |
setAdmin(boolean admin) |
void |
setSaltAndHash(byte[] salt,
byte[] hash)
Set the salt and hash of the password for this user.
|
void |
setUserPasswordHash(byte[] userPasswordHash)
Set the user name password hash.
|
checkOwnsNoSchemas, getRightForObject, getRightForRole, grantRight, grantRole, isRoleGranted, rename, revokeTemporaryRightsOnRoles
checkRename, getComment, getCreateSQLForCopy, getCreateSQLForMeta, getDatabase, getDropSQL, getId, getModificationId, getName, getSQL, getSQL, invalidate, isTemporary, isValid, setComment, setModified, setObjectName, setTemporary, toString
public User(Database database, int id, java.lang.String userName, boolean systemUser)
public void setAdmin(boolean admin)
public boolean isAdmin()
public void setSaltAndHash(byte[] salt, byte[] hash)
salt
- the salthash
- the password hashpublic void setUserPasswordHash(byte[] userPasswordHash)
userPasswordHash
- the user name password hashpublic java.lang.String getCreateSQL()
DbObject
getCreateSQL
in class DbObject
public java.lang.String getCreateSQL(boolean password)
password
- true if the password (actually the salt and hash) should
be returnedpublic void checkAdmin()
org.h2.message.DbException
- if this user is not an adminpublic void checkSchemaAdmin()
org.h2.message.DbException
- if this user is not a schema adminpublic void checkSchemaOwner(org.h2.schema.Schema schema)
schema
- the schemaorg.h2.message.DbException
- if this user is not a schema ownerpublic void checkTableRight(org.h2.table.Table table, int rightMask)
table
- the tablerightMask
- the rights requiredorg.h2.message.DbException
- if this user does not have the required rightspublic boolean hasTableRight(org.h2.table.Table table, int rightMask)
table
- the database object, or null for schema-only checkrightMask
- the rights requiredpublic int getType()
DbObject
public java.util.ArrayList<DbObject> getChildren()
DbObject
getChildren
in class DbObject
null
public void removeChildrenAndResources(SessionLocal session)
DbObject
removeChildrenAndResources
in class DbObject
session
- the session