| java.lang.Object org.hsqldb.GranteeManager
GranteeManager | class GranteeManager implements GrantConstants(Code) | | Contains a set of Grantee objects, and supports operations for creating,
finding, modifying and deleting Grantee objects for a Database; plus
Administrative privileges.
author: boucherb@users author: fredt@users author: unsaved@users version: 1.8.0 since: 1.8.0 See Also: Grantee |
Method Summary | |
public Grantee | addGrantee(String name) We don't have to worry about anything manually creating a reserved
account, because the reserved accounts are created upon DB
initialization. | String | addRole(String name) Creates a new Role object under management of this object. | void | dropRole(String name) Attempts to drop a Role with the specified name
from this object's set. | public Grantee | get(String name) | static int | getCheckRight(String right) | HashSet | getGrantedClassNames() Retrieves the set of distinct, fully qualified Java Class
names upon which any grants currently exist to elements in
this collection. | public Collection | getGrantees() | static int | getRight(String right) Translate a string representation or right(s) into its numeric form. | static String[] | getRightsArray(int rights) Retrieves the list of right names represented by the right flags
set in the specified Integer object's int
value. | static String | getRightsList(int rights) Returns a comma separated list of right names corresponding to the
right flags set in the right argument. | Grantee | getRole(String name) | public Set | getRoleNames() | void | grant(String name, Object dbobject, int rights) Grants the rights represented by the rights argument on
the database object identified by the dbobject argument
to the Grantee object identified by name argument.
Note: For the dbobject argument, Java Class objects are identified
using a String object whose value is the fully qualified name
of the Class, while Table and other objects are
identified by an HsqlName object. | void | grant(String name, String role) Grant a role to this Grantee. | boolean | isGrantee(String name) Returns true if named Grantee object exists. | public static boolean | isImmutable(String name) | public static boolean | isReserved(String name) | boolean | isRole(String name) | void | removeDbObject(Object dbobject) Removes all rights mappings for the database object identified by
the dbobject argument from all Grantee objects in the set. | void | removeEmptyRole(Grantee role) | public boolean | removeGrantee(String name) | void | revoke(String name, String role) | void | revoke(String name, Object dbobject, int rights) | void | updateAllRights(Grantee role) First updates all ROLE Grantee objects. | public static boolean | validRightString(String rightString) |
DBA_ADMIN_ROLE_NAME | final static String DBA_ADMIN_ROLE_NAME(Code) | | The role name reserved for ADMIN users.
|
PUBLIC_ROLE_NAME | final static String PUBLIC_ROLE_NAME(Code) | | The role name reserved for the special PUBLIC pseudo-user.
|
SYSTEM_AUTHORIZATION_NAME | final static String SYSTEM_AUTHORIZATION_NAME(Code) | | The role name reserved for authorization of INFORMATION_SCHEMA and
system objects.
|
emptyRightsList | final static String[] emptyRightsList(Code) | | An empty list that is returned from
GranteeManager.listTablePrivileges listTablePrivileges when
it is detected that neither this User object or
its PUBLIC User object attribute have been
granted any rights on the Table object identified by
the specified HsqlName object.
|
hRightsLists | final static IntKeyHashMap hRightsLists(Code) | | MAP: int => HsqlArrayList.
This map caches the lists of String objects naming the rights
corresponding to each valid set of rights flags, as returned by
GranteeManager.listRightNames listRightNames |
GranteeManager | public GranteeManager(Database inDatabase) throws HsqlException(Code) | | Construct the GranteeManager for a Database.
Construct special Grantee objects for PUBLIC and SYS, and add them
to the Grantee map.
We depend on the corresponding User accounts being created
independently so as to remove a dependency to the UserManager class.
Parameters: inDatabase - Only needed to link to the RoleManager later on. |
addGrantee | public Grantee addGrantee(String name) throws HsqlException(Code) | | We don't have to worry about anything manually creating a reserved
account, because the reserved accounts are created upon DB
initialization. If somebody tries to create one of these accounts
after that, it will fail because the account will already exist.
(We do prevent them from being removed, elsewhere!)
|
addRole | String addRole(String name) throws HsqlException(Code) | | Creates a new Role object under management of this object.
A set of constraints regarding user creation is imposed:
- Can't create a role with name same as any right.
- If the specified name is null, then an
ASSERTION_FAILED exception is thrown stating that
the name is null.
- 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).
|
dropRole | void dropRole(String name) throws HsqlException(Code) | | 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.
- revoking all rights from the removed object
(this ensures that in case there are still references to the
just dropped Grantee object, those references
cannot be used to erronously access database objects).
|
getGrantedClassNames | HashSet getGrantedClassNames() throws HsqlException(Code) | | Retrieves the set of distinct, fully qualified Java Class
names upon which any grants currently exist to elements in
this collection.
the set of distinct, fully qualified Java Class names, asString objects, upon which grants currently existto the elements of this collection |
getRight | static int getRight(String right)(Code) | | Translate a string representation or right(s) into its numeric form.
|
getRightsArray | static String[] getRightsArray(int rights)(Code) | | Retrieves the list of right names represented by the right flags
set in the specified Integer object's int
value.
Parameters: rights - An Integer representing a set of right flags an empty list if the specified Integer object isnull, else a list of rights, as String objects,represented by the rights flag bits set in the specifiedInteger object's int value. |
getRightsList | static String getRightsList(int rights)(Code) | | Returns a comma separated list of right names corresponding to the
right flags set in the right argument.
|
grant | void grant(String name, Object dbobject, int rights) throws HsqlException(Code) | | Grants the rights represented by the rights argument on
the database object identified by the dbobject argument
to the Grantee object identified by name argument.
Note: For the dbobject argument, Java Class objects are identified
using a String object whose value is the fully qualified name
of the Class, while Table and other objects are
identified by an HsqlName object. A Table
object identifier must be precisely the one obtained by calling
table.getName(); if a different HsqlName
object with an identical name attribute is specified, then
rights checks and tests will fail, since the HsqlName
class implements its
HsqlName.hashCode hashCode and
HsqlName.equals equals methods based on pure object
identity, rather than on attribute values.
|
isGrantee | boolean isGrantee(String name)(Code) | | Returns true if named Grantee object exists.
This will return true for reserved Grantees
SYSTEM_AUTHORIZATION_NAME, ADMIN_ROLE_NAME, PUBLIC_USER_NAME.
|
isImmutable | public static boolean isImmutable(String name)(Code) | | |
isReserved | public static boolean isReserved(String name)(Code) | | |
removeDbObject | void removeDbObject(Object dbobject)(Code) | | Removes all rights mappings for the database object identified by
the dbobject argument from all Grantee objects in the set.
|
removeEmptyRole | void removeEmptyRole(Grantee role)(Code) | | Removes a role without any privileges from all grantees
|
removeGrantee | public boolean removeGrantee(String name)(Code) | | |
revoke | void revoke(String name, Object dbobject, int rights) throws HsqlException(Code) | | Revokes the rights represented by the rights argument on
the database object identified by the dbobject argument
from the User object identified by the name
argument.
See Also: GranteeManager.grant |
updateAllRights | void updateAllRights(Grantee role)(Code) | | First updates all ROLE Grantee objects. Then updates all USER Grantee
Objects.
|
validRightString | public static boolean validRightString(String rightString)(Code) | | |
|
|