Package com.mckoi.database
Class Privileges
java.lang.Object
com.mckoi.database.Privileges
A set of privileges to grant a user for an object.
- Author:
- Tobias Downer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The priv to allow full access to the database object.static final int
The priv to alter objects (only applicable for SCHEMA grant objects).static final int
The priv to compact a database object.static final int
The priv to create objects (only applicable for SCHEMA grant objects).static final int
The priv to DELETE from a database object.static final int
The priv to drop objects (only applicable for SCHEMA grant objects).static final Privileges
No privileges.static final int
The priv to INSERT to a database object.static final int
The priv to view objects in a schema (only applicable for SCHEMA grant objects).static final Privileges
All access (execute/update/delete/etc) privs for a procedure object.static final Privileges
Execute access privs for a procedure object.static final int
The priv to REFERENCE a database object.static final Privileges
All access privs for a schema object.static final Privileges
Read access privs for a schema object.static final int
The priv to SELECT from a database object.static final Privileges
Enable all privs for the object.static final Privileges
Read privs for the object.static final int
The priv to UPDATE a database object.static final int
The priv to see statistics on a database object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(int priv) Adds a privilege and returns a new Privileges object with the new priv set.boolean
boolean
isEmpty()
Returns true if this Privileges object contains no priv entries.merge
(Privileges in_privs) Merges privs from the given privilege object with this set of privs.static int
parseString
(String priv) Given a string, returns the priv bit for it.boolean
permits
(int priv) Returns true if this privileges permits the given priv.remove
(int priv) Removes a privilege with a column list parameter.remove
(Privileges privs) Removes the given privileges from this privileges object and returns the new privileges object.Converts this privilege to an encoded string.int
toInt()
Returns this Privileges object as an encoded int bit array.toString()
-
Field Details
-
ALL
public static final int ALLThe priv to allow full access to the database object. If this is used, it should be the only privilege added.- See Also:
-
SELECT
public static final int SELECTThe priv to SELECT from a database object.- See Also:
-
DELETE
public static final int DELETEThe priv to DELETE from a database object.- See Also:
-
UPDATE
public static final int UPDATEThe priv to UPDATE a database object.- See Also:
-
INSERT
public static final int INSERTThe priv to INSERT to a database object.- See Also:
-
REFERENCES
public static final int REFERENCESThe priv to REFERENCE a database object.- See Also:
-
USAGE
public static final int USAGEThe priv to see statistics on a database object.- See Also:
-
COMPACT
public static final int COMPACTThe priv to compact a database object.- See Also:
-
CREATE
public static final int CREATEThe priv to create objects (only applicable for SCHEMA grant objects).- See Also:
-
ALTER
public static final int ALTERThe priv to alter objects (only applicable for SCHEMA grant objects).- See Also:
-
DROP
public static final int DROPThe priv to drop objects (only applicable for SCHEMA grant objects).- See Also:
-
LIST
public static final int LISTThe priv to view objects in a schema (only applicable for SCHEMA grant objects).- See Also:
-
EMPTY_PRIVS
No privileges. -
TABLE_ALL_PRIVS
Enable all privs for the object. -
TABLE_READ_PRIVS
Read privs for the object. -
SCHEMA_ALL_PRIVS
All access privs for a schema object. -
SCHEMA_READ_PRIVS
Read access privs for a schema object. -
PROCEDURE_ALL_PRIVS
All access (execute/update/delete/etc) privs for a procedure object. -
PROCEDURE_EXECUTE_PRIVS
Execute access privs for a procedure object.
-
-
Constructor Details
-
Privileges
public Privileges()
-
-
Method Details
-
add
Adds a privilege and returns a new Privileges object with the new priv set. -
remove
Removes a privilege with a column list parameter. -
remove
Removes the given privileges from this privileges object and returns the new privileges object. -
permits
public boolean permits(int priv) Returns true if this privileges permits the given priv. -
merge
Merges privs from the given privilege object with this set of privs. This performs an OR on all the attributes in the set. If the entry does not exist in this set then it is added. -
isEmpty
public boolean isEmpty()Returns true if this Privileges object contains no priv entries. -
parseString
Given a string, returns the priv bit for it. -
toInt
public int toInt()Returns this Privileges object as an encoded int bit array. -
toEncodedString
Converts this privilege to an encoded string. -
toString
-
equals
-