Top Description Fields Constructors Methods
org.h2.engine

public abstract Class RightOwner

extends DbObject
Class Inheritance
Known Direct Subclasses
org.h2.engine.Role, org.h2.engine.User
Imports
java.util.ArrayList, .HashMap, .List, .Map.Entry, org.h2.api.ErrorCode, org.h2.message.DbException, org.h2.schema.Schema, org.h2.table.Table, org.h2.util.StringUtils

A right owner (sometimes called principal).

Field Summary

Modifier and TypeField and Description
private HashMap<DbObject, Right>
grantedRights

The map of granted rights.

private HashMap<Role, Right>
grantedRoles

The map of granted roles.

Inherited from org.h2.engine.DbObject:
AGGREGATECOMMENTcommentCONSTANTCONSTRAINTdatabaseDOMAINFUNCTION_ALIASINDEXRIGHTROLESCHEMASEQUENCESETTINGSYNONYMTABLE_OR_VIEWtraceTRIGGERUSER

Constructor Summary

AccessConstructor and Description
protected
RightOwner(Database database, int id, String name, int traceModuleId)

Method Summary

Modifier and TypeMethod and Description
public final void
checkOwnsNoSchemas()

Check that this right owner does not own any schema.

public Right

Returns:

the right or null if the right has not been granted
getRightForObject
(DbObject
the granted object (table or schema)
object
)

Get the 'grant schema' right of this object.

public Right

Returns:

the right or null if the right has not been granted
getRightForRole
(Role
the granted role
role
)

Get the 'grant role' right of this object.

public void
grantRight(DbObject
the object (table or schema)
object
,
Right
the right
right
)

Grant a right for the given table.

public void
grantRole(Role
the role
role
,
Right
the right to grant
right
)

Grant a role to this object.

public boolean

Returns:

true if the role has been granted
isRoleGranted
(Role
the role
grantedRole
)

Check if a role has been granted for this right owner.

pack-priv final boolean

Returns:

true if the right was already granted
isSchemaRightGrantedRecursive
(Schema
the schema to check, or null to check for ALTER ANY SCHEMA right only
schema
)

Checks if a schema owner right is already granted to this object or to objects that were granted to this object.

pack-priv final boolean

Returns:

true if the right was already granted
isTableRightGrantedRecursive
(Table
the table to check
table
,
int
the right mask to check
rightMask
)

Checks if a right is already granted to this object or to objects that were granted to this object.

public void
rename(String
the new name
newName
)

Overrides org.h2.engine.DbObject.rename.

Rename the object.

pack-priv void
revokeRight(DbObject
the object
object
)

Revoke the right for the given object (table or schema).

pack-priv void
revokeRole(Role
the role to revoke
role
)

Remove the right for the given role.

public void
revokeTemporaryRightsOnRoles()

Remove all the temporary rights granted on roles

Inherited from org.h2.engine.DbObject:
checkRenamegetChildrengetCommentgetCreateSQLgetCreateSQLForCopygetCreateSQLForMetagetDatabasegetDropSQLgetIdgetModificationIdgetNamegetSQLgetSQLgetTypeinvalidateisTemporaryisValidremoveChildrenAndResourcessetCommentsetModifiedsetObjectNamesetTemporarytoString

Field Detail

grantedRightsback to summary
private HashMap<DbObject, Right> grantedRights

The map of granted rights.

grantedRolesback to summary
private HashMap<Role, Right> grantedRoles

The map of granted roles.

Constructor Detail

RightOwnerback to summary
protected RightOwner(Database database, int id, String name, int traceModuleId)

Method Detail

checkOwnsNoSchemasback to summary
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.

Exceptions
DbException:
if this right owner owns a schema
getRightForObjectback to summary
public Right getRightForObject(DbObject object)

Get the 'grant schema' right of this object.

Parameters
object:DbObject

the granted object (table or schema)

Returns:Right

the right or null if the right has not been granted

getRightForRoleback to summary
public Right getRightForRole(Role role)

Get the 'grant role' right of this object.

Parameters
role:Role

the granted role

Returns:Right

the right or null if the right has not been granted

grantRightback to summary
public void grantRight(DbObject object, Right right)

Grant a right for the given table. Only one right object per table is supported.

Parameters
object:DbObject

the object (table or schema)

right:Right

the right

grantRoleback to summary
public void grantRole(Role role, Right right)

Grant a role to this object.

Parameters
role:Role

the role

right:Right

the right to grant

isRoleGrantedback to summary
public boolean isRoleGranted(Role grantedRole)

Check if a role has been granted for this right owner.

Parameters
grantedRole:Role

the role

Returns:boolean

true if the role has been granted

isSchemaRightGrantedRecursiveback to summary
pack-priv final boolean isSchemaRightGrantedRecursive(Schema schema)

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:Schema

the schema to check, or null to check for ALTER ANY SCHEMA right only

Returns:boolean

true if the right was already granted

isTableRightGrantedRecursiveback to summary
pack-priv final boolean isTableRightGrantedRecursive(Table table, int rightMask)

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:Table

the table to check

rightMask:int

the right mask to check

Returns:boolean

true if the right was already granted

renameback to summary
public void rename(String newName)

Overrides org.h2.engine.DbObject.rename.

Doc from org.h2.engine.DbObject.rename.

Rename the object.

Parameters
newName:String

the new name

Annotations
@Override
revokeRightback to summary
pack-priv void revokeRight(DbObject object)

Revoke the right for the given object (table or schema).

Parameters
object:DbObject

the object

revokeRoleback to summary
pack-priv void revokeRole(Role role)

Remove the right for the given role.

Parameters
role:Role

the role to revoke

revokeTemporaryRightsOnRolesback to summary
public void revokeTemporaryRightsOnRoles()

Remove all the temporary rights granted on roles