org.h2.engine

## Class RightOwner

- java.lang.Object
- - org.h2.engine.DbObjectBase
  - - org.h2.engine.RightOwner

All Implemented Interfaces:
  DbObject

Direct Known Subclasses:
  Role, User

    public abstract class RightOwner
    extends DbObjectBase

A right owner (sometimes called principal).

### Field Summary

### Fields inherited from class org.h2.engine.DbObjectBase

`comment, database, trace`

### Fields inherited from interface org.h2.engine.DbObject

`AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, TRIGGER, USER`

### Constructor Summary

Constructors
`protected` `RightOwner(Database database, int id, java.lang.String name, int traceModuleId)`

### Method Summary

Methods
`Right` `getRightForObject(DbObject object)` Get the 'grant schema' right of this object.
`Right` `getRightForRole(Role role)` Get the 'grant role' right of this object.
`void` `grantRight(DbObject object, Right right)` Grant a right for the given table.
`void` `grantRole(Role role, Right right)` Grant a role to this object.
`boolean` `isRoleGranted(Role grantedRole)` Check if a role has been granted for this right owner.
`void` `rename(java.lang.String newName)` Rename the object.
`void` `revokeTemporaryRightsOnRoles()` Remove all the temporary rights granted on roles

### Methods inherited from class org.h2.engine.DbObjectBase

`checkRename, getChildren, getComment, getCreateSQL, getDatabase, getDropSQL, getId, getModificationId, getName, getSQL, getSQL, invalidate, isTemporary, isValid, removeChildrenAndResources, setComment, setModified, setObjectName, setTemporary, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.h2.engine.DbObject

`getCreateSQLForCopy, getType`

### Constructor Detail

#### RightOwner

    protected RightOwner(Database database,
              int id,
              java.lang.String name,
              int traceModuleId)

### Method Detail

#### rename

    public void rename(java.lang.String newName)

Description copied from interface: `DbObject`
Rename the object.

Specified by:
  `rename` in interface `DbObject`
Overrides:
  `rename` in class `DbObjectBase`
Parameters:
  `newName` - the new name

#### isRoleGranted

    public boolean isRoleGranted(Role grantedRole)

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

Parameters:
  `grantedRole` - the role
Returns:
  true if the role has been granted

#### grantRight

    public void grantRight(DbObject object,
                  Right right)

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

Parameters:
  `object` - the object (table or schema)
  `right` - the right

#### grantRole

    public void grantRole(Role role,
                 Right right)

Grant a role to this object.

Parameters:
  `role` - the role
  `right` - the right to grant

#### revokeTemporaryRightsOnRoles

    public void revokeTemporaryRightsOnRoles()

Remove all the temporary rights granted on roles

#### getRightForObject

    public Right getRightForObject(DbObject object)

Get the 'grant schema' right of this object.

Parameters:
  `object` - the granted object (table or schema)
Returns:
  the right or null if the right has not been granted

#### getRightForRole

    public Right getRightForRole(Role role)

Get the 'grant role' right of this object.

Parameters:
  `role` - the granted role
Returns:
  the right or null if the right has not been granted