Interface IPrivilege
- All Superinterfaces:
IHashable
- All Known Implementing Classes:
AbstractPrivilege,ChPrivilege,MsPrivilege,PgPrivilege
Represents a database privilege (GRANT/REVOKE) for a database object.
Handles privilege operations including creation, dropping, and SQL generation.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendPrivileges(Collection<IPrivilege> privileges, SQLScript script) Appends multiple privileges to a SQL script.Generates the SQL statement for this privilege.Generates the SQL statement to drop this privilege.getName()getRole()booleanisRevoke()Checks if this privilege represents a REVOKE operation.Methods inherited from interface org.pgcodekeeper.core.hasher.IHashable
computeHash
-
Field Details
-
WITH_GRANT_OPTION
- See Also:
-
GRANT
- See Also:
-
REVOKE
- See Also:
-
-
Method Details
-
isRevoke
boolean isRevoke()Checks if this privilege represents a REVOKE operation.- Returns:
- true if this is a REVOKE privilege, false if GRANT
-
getCreationSQL
String getCreationSQL()Generates the SQL statement for this privilege.- Returns:
- the GRANT or REVOKE SQL statement
-
getDropSQL
String getDropSQL()Generates the SQL statement to drop this privilege.- Returns:
- the REVOKE SQL statement, or null if this is already a REVOKE
-
getPermission
String getPermission()- Returns:
- the permission type (e.g., SELECT, INSERT, ALL)
-
getRole
String getRole()- Returns:
- role the role receiving or losing the privilege
-
getName
String getName()- Returns:
- the object name the privilege applies to
-
appendPrivileges
Appends multiple privileges to a SQL script.- Parameters:
privileges- the collection of privileges to appendscript- the script to append to
-