Class GranteeManager
- java.lang.Object
-
- org.hsqldb.rights.GranteeManager
-
public class GranteeManager extends java.lang.ObjectContains a set of Grantee objects, and supports operations for creating, finding, modifying and deleting Grantee objects for a Database; plus Administrative privileges.- Since:
- 1.8.0
- See Also:
Grantee
-
-
Constructor Summary
Constructors Constructor and Description GranteeManager(Database database)Construct the GranteeManager for a Database.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description GranteeaddRole(HsqlNameManager.HsqlName name)Creates a new Role object under management of this object.UseraddUser(HsqlNameManager.HsqlName name)voidcheckGranteeList(OrderedHashSet granteeList)voidcheckRoleList(java.lang.String granteeName, OrderedHashSet roleList, Grantee grantor, boolean grant)voiddropRole(java.lang.String name)Attempts to drop a Role with the specified name from this object's set.Granteeget(java.lang.String name)static intgetCheckSingleRight(java.lang.String right)GranteegetDBARole()CollectiongetGrantees()static intgetRight(java.lang.String right)Translate a string representation or right(s) into its numeric form.java.lang.String[]getRightstSQL()GranteegetRole(java.lang.String name)Returns Grantee for the named RoleSetgetRoleNames()CollectiongetRoles()java.lang.String[]getSQL()static GranteegetSystemRole()voidgrant(OrderedHashSet granteeList, SchemaObject[] routines, Right right, Grantee grantor, boolean withGrantOption)voidgrant(OrderedHashSet granteeList, SchemaObject dbObject, Right right, Grantee grantor, boolean withGrantOption)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.voidgrant(java.lang.String granteeName, java.lang.String roleName, Grantee grantor)Grant a role to this Grantee.voidgrantSystemToPublic(SchemaObject object, Right right)static booleanisImmutable(java.lang.String name)static booleanisReserved(java.lang.String name)booleanisRole(java.lang.String name)voidremoveDbObject(HsqlNameManager.HsqlName name)Removes all rights mappings for the database object identified by the dbobject argument from all Grantee objects in the set.voidremoveDbObjects(OrderedHashSet nameSet)booleanremoveGrantee(java.lang.String name)voidremoveNewUser(HsqlNameManager.HsqlName name)Only used for a recently added user with no dependenciesvoidrevoke(OrderedHashSet granteeList, SchemaObject[] routines, Right rights, Grantee grantor, boolean grantOption, boolean cascade)voidrevoke(OrderedHashSet granteeList, SchemaObject dbObject, Right rights, Grantee grantor, boolean grantOption, boolean cascade)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.voidrevoke(java.lang.String granteeName, java.lang.String roleName, Grantee grantor)Revoke a role from a Granteestatic booleanvalidRightString(java.lang.String rightString)
-
-
-
Constructor Detail
-
GranteeManager
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- Only needed to link to the RoleManager later on.
-
-
Method Detail
-
getDBARole
public Grantee getDBARole()
-
getSystemRole
public static Grantee getSystemRole()
-
grant
public void grant(OrderedHashSet granteeList, SchemaObject dbObject, Right right, Grantee grantor, boolean withGrantOption)
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
hashCodeandequalsmethods based on pure object identity, rather than on attribute values.
-
grant
public void grant(OrderedHashSet granteeList, SchemaObject[] routines, Right right, Grantee grantor, boolean withGrantOption)
-
checkGranteeList
public void checkGranteeList(OrderedHashSet granteeList)
-
grant
public void grant(java.lang.String granteeName, java.lang.String roleName, Grantee grantor)Grant a role to this Grantee.
-
checkRoleList
public void checkRoleList(java.lang.String granteeName, OrderedHashSet roleList, Grantee grantor, boolean grant)
-
grantSystemToPublic
public void grantSystemToPublic(SchemaObject object, Right right)
-
revoke
public void revoke(java.lang.String granteeName, java.lang.String roleName, Grantee grantor)Revoke a role from a Grantee
-
revoke
public void revoke(OrderedHashSet granteeList, SchemaObject dbObject, Right rights, Grantee grantor, boolean grantOption, boolean cascade)
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.
-
revoke
public void revoke(OrderedHashSet granteeList, SchemaObject[] routines, Right rights, Grantee grantor, boolean grantOption, boolean cascade)
-
removeDbObject
public void removeDbObject(HsqlNameManager.HsqlName name)
Removes all rights mappings for the database object identified by the dbobject argument from all Grantee objects in the set.
-
removeDbObjects
public void removeDbObjects(OrderedHashSet nameSet)
-
removeGrantee
public boolean removeGrantee(java.lang.String name)
-
addRole
public Grantee addRole(HsqlNameManager.HsqlName name)
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 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).
-
addUser
public User addUser(HsqlNameManager.HsqlName name)
-
removeNewUser
public void removeNewUser(HsqlNameManager.HsqlName name)
Only used for a recently added user with no dependencies
-
getCheckSingleRight
public static int getCheckSingleRight(java.lang.String right)
-
getRight
public static int getRight(java.lang.String right)
Translate a string representation or right(s) into its numeric form.
-
get
public Grantee get(java.lang.String name)
-
getGrantees
public Collection getGrantees()
-
validRightString
public static boolean validRightString(java.lang.String rightString)
-
isImmutable
public static boolean isImmutable(java.lang.String name)
-
isReserved
public static boolean isReserved(java.lang.String name)
-
dropRole
public void dropRole(java.lang.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.
-
getRoleNames
public Set getRoleNames()
-
getRoles
public Collection getRoles()
-
getRole
public Grantee getRole(java.lang.String name)
Returns Grantee for the named Role
-
isRole
public boolean isRole(java.lang.String name)
-
getSQL
public java.lang.String[] getSQL()
-
getRightstSQL
public java.lang.String[] getRightstSQL()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG