Top Description Fields Constructors Methods
org.hsqldb.rights

public Class GranteeManager

extends Object
Class Inheritance
Imports
java.security.MessageDigest, .NoSuchAlgorithmException, org.hsqldb.Database, .HsqlNameManager, .HsqlNameManager.HsqlName, .Routine, .RoutineSchema, .SchemaObject, .Session, .SqlInvariants, .Tokens, org.hsqldb.error.Error, .ErrorCode, org.hsqldb.lib.Collection, .HsqlArrayList, .IntValueHashMap, .Iterator, .List, .OrderedHashMap, .OrderedHashSet, .Set, .StringConverter, org.hsqldb.lib.java.JavaSystem

Contains a set of Grantee objects, and supports operations for creating, finding, modifying and deleting Grantee objects for a Database; plus Administrative privileges.
Authors
Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net), Blaine Simpson (blaine dot simpson at admc dot com)
Since
1.8.0
Version
2.7.3
See Also
Grantee

Field Summary

Modifier and TypeField and Description
pack-priv Grantee
changeAuthRole

The role for changing authorization rights.

pack-priv Database
database

Used only to pass the SchemaManager to Grantees for checking schema authorizations.

pack-priv Grantee
dbaRole

The DBA role.

private String
digestAlgo

MessageDigest algorithm

private MessageDigest
digester

MessageDigest instance for database

private OrderedHashMap<String, Grantee>
map

Map of grantee-String-to-Grantee-objects.

pack-priv Grantee
publicRole

The PUBLIC role.

pack-priv static final IntValueHashMap<String>
private OrderedHashMap<String, Grantee>
roleMap

Map of role-Strings-to-Grantee-object.

pack-priv Grantee
schemaRole

The role for schema creation rights.

pack-priv Grantee
scriptOpsRole

The role for script operations rights.

pack-priv static User
systemAuthorisation

The grantee object for the _SYSTEM role.

Constructor Summary

AccessConstructor and Description
public
GranteeManager(Database
Only needed to link to the RoleManager later on.
database
)

Construct the GranteeManager for a Database.

Method Summary

Modifier and TypeMethod and Description
public Grantee
addRole(HsqlNameManager.HsqlName name)

Creates a new Role object.

public User
public void
public void
checkRoleList(String granteeName, OrderedHashSet<String> roleList, Grantee grantor, boolean grant)

pack-priv String
digest(String string)

public void
dropRole(String name)

Attempts to drop a Role with the specified name from this object's set.

public Grantee
get(String name)

public static int
public Grantee
public String
pack-priv synchronized MessageDigest
public Collection<Grantee>
public static int
getRight(String token)

Translate a string representation or token(s) into its numeric form.

public List<String>
public Grantee
getRole(String name)

Returns Grantee for the named Role

public Set<String>
public Collection<Grantee>
public List<String>
public static Grantee
public void
grant(Session session, OrderedHashSet<String> granteeList, SchemaObject dbObject, Right right, Grantee grantor, boolean withGrantOption)

Grants the rights represented by the Right object on dbObject to the Grantee objects in granteeList.

public void
grant(Session session, OrderedHashSet<String> granteeList, SchemaObject[] routines, Right right, Grantee grantor, boolean withGrantOption)

public void
grant(String granteeName, String roleName, Grantee grantor)

Grant a role to this Grantee.

public void
pack-priv boolean
isGrantee(String name)

Returns true if named Grantee object exists.

public static boolean
public static boolean
public boolean
isRole(String name)

public void
removeDbObject(HsqlNameManager.HsqlName name)

Removes all rights mappings for the database object identified by the name argument from all Grantee objects in the database.

public void
pack-priv void
removeEmptyRole(Grantee role)

Removes a role without any privileges from all grantees

public boolean
public void
removeNewUser(HsqlNameManager.HsqlName name)

Only used for a recently added user with no dependencies

public void
revoke(String granteeName, String roleName, Grantee grantor)

Revoke a role from a Grantee

public void
revoke(OrderedHashSet<String> granteeList, SchemaObject dbObject, Right rights, Grantee grantor, boolean grantOption, boolean cascade)

Revokes the rights represented by the Right object on dbObject from the Grantee objects in granteeList.

public void
revoke(OrderedHashSet<String> granteeList, SchemaObject[] routines, Right rights, Grantee grantor, boolean grantOption, boolean cascade)

public void
pack-priv void
updateAllRights(Grantee role)

First updates all ROLE Grantee objects.

public static boolean
validRightString(String rightString)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

changeAuthRoleback to summary
pack-priv Grantee changeAuthRole

The role for changing authorization rights.

databaseback to summary
pack-priv Database database

Used only to pass the SchemaManager to Grantees for checking schema authorizations.

dbaRoleback to summary
pack-priv Grantee dbaRole

The DBA role.

digestAlgoback to summary
private String digestAlgo

MessageDigest algorithm

digesterback to summary
private MessageDigest digester

MessageDigest instance for database

mapback to summary
private OrderedHashMap<String, Grantee> map

Map of grantee-String-to-Grantee-objects.

Keys include all USER and ROLE names

publicRoleback to summary
pack-priv Grantee publicRole

The PUBLIC role.

rightsStringLookupback to summary
pack-priv static final IntValueHashMap<String> rightsStringLookup
roleMapback to summary
private OrderedHashMap<String, Grantee> roleMap

Map of role-Strings-to-Grantee-object.

Keys include all ROLES names

schemaRoleback to summary
pack-priv Grantee schemaRole

The role for schema creation rights.

scriptOpsRoleback to summary
pack-priv Grantee scriptOpsRole

The role for script operations rights.

systemAuthorisationback to summary
pack-priv static User systemAuthorisation

The grantee object for the _SYSTEM role.

Constructor Detail

GranteeManagerback to summary
public GranteeManager(Database database)

Construct the GranteeManager for a Database. Construct special Grantee objects for _SYSTEM, PUBLIC and DBA, and add them to the Grantee map.

Parameters
database:Database

Only needed to link to the RoleManager later on.

Method Detail

addRoleback to summary
public Grantee addRole(HsqlNameManager.HsqlName name)

Creates a new Role object.

A set of constraints regarding user creation is imposed:

  1. Can't create a role with name same as any right.
  2. If this object's collection already contains an element whose name attribute equals the name argument, then a GRANTEE_ALREADY_EXISTS or ROLE_ALREADY_EXISTS Trace is thrown. (This will catch attempts to create Reserved grantee names).
addUserback to summary
public User addUser(HsqlNameManager.HsqlName name)
checkGranteeListback to summary
public void checkGranteeList(OrderedHashSet<String> granteeList)
checkRoleListback to summary
public void checkRoleList(String granteeName, OrderedHashSet<String> roleList, Grantee grantor, boolean grant)
digestback to summary
pack-priv String digest(String string) throws RuntimeException
dropRoleback to summary
public void dropRole(String name)

Attempts to drop a Role with the specified name from this object's set.

A successful drop action consists of:

  • removing the Grantee object with the specified name from the set.
getback to summary
public Grantee get(String name)
getCheckSingleRightback to summary
public static int getCheckSingleRight(String token)
getDBARoleback to summary
public Grantee getDBARole()
getDigestAlgoback to summary
public String getDigestAlgo()
getDigesterback to summary
pack-priv synchronized MessageDigest getDigester()
getGranteesback to summary
public Collection<Grantee> getGrantees()
getRightback to summary
public static int getRight(String token)

Translate a string representation or token(s) into its numeric form.

getRightsSQLArrayback to summary
public List<String> getRightsSQLArray()
getRoleback to summary
public Grantee getRole(String name)

Returns Grantee for the named Role

getRoleNamesback to summary
public Set<String> getRoleNames()
getRolesback to summary
public Collection<Grantee> getRoles()
getSQLArrayback to summary
public List<String> getSQLArray()
getSystemRoleback to summary
public static Grantee getSystemRole()
grantback to summary
public void grant(Session session, OrderedHashSet<String> granteeList, SchemaObject dbObject, Right right, Grantee grantor, boolean withGrantOption)

Grants the rights represented by the Right object on dbObject to the Grantee objects in granteeList.

grantback to summary
public void grant(Session session, OrderedHashSet<String> granteeList, SchemaObject[] routines, Right right, Grantee grantor, boolean withGrantOption)
grantback to summary
public void grant(String granteeName, String roleName, Grantee grantor)

Grant a role to this Grantee.

grantSystemToPublicback to summary
public void grantSystemToPublic(SchemaObject object, Right right)
isGranteeback to summary
pack-priv boolean isGrantee(String name)

Returns true if named Grantee object exists. This will return true for reserved Grantees SYSTEM_AUTHORIZATION_NAME, ADMIN_ROLE_NAME, PUBLIC_USER_NAME.

isImmutableback to summary
public static boolean isImmutable(String name)
isReservedback to summary
public static boolean isReserved(String name)
isRoleback to summary
public boolean isRole(String name)
removeDbObjectback to summary
public void removeDbObject(HsqlNameManager.HsqlName name)

Removes all rights mappings for the database object identified by the name argument from all Grantee objects in the database.

removeDbObjectsback to summary
public void removeDbObjects(OrderedHashSet<HsqlNameManager.HsqlName> nameSet)
removeEmptyRoleback to summary
pack-priv void removeEmptyRole(Grantee role)

Removes a role without any privileges from all grantees

removeGranteeback to summary
public boolean removeGrantee(String name)
removeNewUserback to summary
public void removeNewUser(HsqlNameManager.HsqlName name)

Only used for a recently added user with no dependencies

revokeback to summary
public void revoke(String granteeName, String roleName, Grantee grantor)

Revoke a role from a Grantee

revokeback to summary
public void revoke(OrderedHashSet<String> granteeList, SchemaObject dbObject, Right rights, Grantee grantor, boolean grantOption, boolean cascade)

Revokes the rights represented by the Right object on dbObject from the Grantee objects in granteeList.

See Also
grant
revokeback to summary
public void revoke(OrderedHashSet<String> granteeList, SchemaObject[] routines, Right rights, Grantee grantor, boolean grantOption, boolean cascade)
setDigestAlgoback to summary
public void setDigestAlgo(String algo)
updateAllRightsback to summary
pack-priv void updateAllRights(Grantee role)

First updates all ROLE Grantee objects. Then updates all USER Grantee Objects.

validRightStringback to summary
public static boolean validRightString(String rightString)