Class RightOwner
java.lang.Object
org.h2.engine.DbObject
org.h2.engine.RightOwner
- All Implemented Interfaces:
HasSQL
A right owner (sometimes called principal).
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe map of granted rights.The map of granted roles.Fields inherited from class DbObject
AGGREGATE, comment, COMMENT, CONSTANT, CONSTRAINT, database, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, trace, TRIGGER, USERFields inherited from interface HasSQL
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRightOwner(Database database, int id, String name, int traceModuleId) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidCheck that this right owner does not own any schema.getRightForObject(DbObject object) Get the 'grant schema' right of this object.getRightForRole(Role role) Get the 'grant role' right of this object.voidgrantRight(DbObject object, Right right) Grant a right for the given table.voidGrant a role to this object.booleanisRoleGranted(Role grantedRole) Check if a role has been granted for this right owner.(package private) final booleanisSchemaRightGrantedRecursive(Schema schema) Checks if a schema owner right is already granted to this object or to objects that were granted to this object.(package private) final booleanisTableRightGrantedRecursive(Table table, int rightMask) Checks if a right is already granted to this object or to objects that were granted to this object.voidRename the object.(package private) voidrevokeRight(DbObject object) Revoke the right for the given object (table or schema).(package private) voidrevokeRole(Role role) Remove the right for the given role.voidRemove all the temporary rights granted on rolesMethods inherited from class DbObject
checkRename, getChildren, getComment, getCreateSQL, getCreateSQLForCopy, getCreateSQLForMeta, getDatabase, getDropSQL, getId, getModificationId, getName, getSQL, getSQL, getType, invalidate, isTemporary, isValid, removeChildrenAndResources, setComment, setModified, setObjectName, setTemporary, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface HasSQL
getTraceSQL
-
Field Details
-
grantedRoles
-
grantedRights
-
-
Constructor Details
-
RightOwner
-
-
Method Details
-
rename
-
isRoleGranted
Check if a role has been granted for this right owner.- Parameters:
grantedRole- the role- Returns:
- true if the role has been granted
-
isTableRightGrantedRecursive
Checks if a right is already granted to this object or to objects that were granted to this object. The rights of schemas will be valid for every each table in the related schema. The ALTER ANY SCHEMA right gives all rights to all tables.- Parameters:
table- the table to checkrightMask- the right mask to check- Returns:
- true if the right was already granted
-
isSchemaRightGrantedRecursive
Checks if a schema owner right is already granted to this object or to objects that were granted to this object. The ALTER ANY SCHEMA right gives rights to all schemas.- Parameters:
schema- the schema to check, ornullto check for ALTER ANY SCHEMA right only- Returns:
- true if the right was already granted
-
grantRight
-
revokeRight
Revoke the right for the given object (table or schema).- Parameters:
object- the object
-
grantRole
-
revokeRole
Remove the right for the given role.- Parameters:
role- the role to revoke
-
revokeTemporaryRightsOnRoles
public void revokeTemporaryRightsOnRoles()Remove all the temporary rights granted on roles -
getRightForObject
-
getRightForRole
-
checkOwnsNoSchemas
public final void checkOwnsNoSchemas()Check that this right owner does not own any schema. An exception is thrown if it owns one or more schemas.- Throws:
DbException- if this right owner owns a schema
-