Class StatementTablePermission
- java.lang.Object
-
- org.apache.derby.iapi.sql.dictionary.StatementPermission
-
- org.apache.derby.iapi.sql.dictionary.StatementTablePermission
-
- Direct Known Subclasses:
StatementColumnPermission
public class StatementTablePermission extends StatementPermission
This class describes a table permission required by a statement.
-
-
Constructor Summary
Constructors Constructor Description StatementTablePermission(UUID tableUUID, int privType)
Constructor for StatementTablePermission.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
check(LanguageConnectionContext lcc, boolean forGrant, Activation activation)
boolean
equals(java.lang.Object obj)
Routine to check if another instance of access descriptor matches this.PermissionsDescriptor
getPermissionDescriptor(java.lang.String authid, DataDictionary dd)
Get the PermissionsDescriptor for the passed authorization id for this object.java.lang.String
getPrivName()
Return privilege needed for this access as stringint
getPrivType()
Return privilege access requested for this access descriptorprotected TableDescriptor
getTableDescriptor(DataDictionary dd)
UUID
getTableUUID()
Return table UUID for this access descriptorint
hashCode()
Return hash code for this instanceprotected boolean
hasPermissionOnTable(LanguageConnectionContext lcc, Activation activation, boolean forGrant, ExecPreparedStatement ps)
Check if current session has permission on the table (current user, PUBLIC or role) and, if applicable, register a dependency of ps on the current role.protected boolean
oneAuthHasPermissionOnTable(DataDictionary dd, java.lang.String authorizationId, boolean forGrant)
java.lang.String
toString()
-
Methods inherited from class org.apache.derby.iapi.sql.dictionary.StatementPermission
genericCheck, getObjectType, getPrivilegedObject, isCorrectPermission
-
-
-
-
Field Detail
-
tableUUID
UUID tableUUID
-
privType
int privType
-
-
Constructor Detail
-
StatementTablePermission
public StatementTablePermission(UUID tableUUID, int privType)
Constructor for StatementTablePermission. Creates an instance of table permission requested for the given access.- Parameters:
tableUUID
- UUID of the tableprivType
- Access privilege requested
-
-
Method Detail
-
getPrivType
public int getPrivType()
Return privilege access requested for this access descriptor- Returns:
- Privilege access
-
getTableUUID
public UUID getTableUUID()
Return table UUID for this access descriptor- Returns:
- Table UUID
-
equals
public boolean equals(java.lang.Object obj)
Routine to check if another instance of access descriptor matches this. Used to ensure only one access descriptor for a table of given privilege is created. Otherwise, every column reference from a table may create a descriptor for that table.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- Another instance of StatementPermission- Returns:
- true if match
-
hashCode
public int hashCode()
Return hash code for this instance- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- Hashcode
-
check
public void check(LanguageConnectionContext lcc, boolean forGrant, Activation activation) throws StandardException
- Specified by:
check
in classStatementPermission
- Parameters:
lcc
- LanguageConnectionContextactivation
- activation for statement needing check- Throws:
StandardException
- if the permission has not been granted- See Also:
StatementPermission.check(org.apache.derby.iapi.sql.conn.LanguageConnectionContext, boolean, org.apache.derby.iapi.sql.Activation)
-
getTableDescriptor
protected TableDescriptor getTableDescriptor(DataDictionary dd) throws StandardException
- Throws:
StandardException
-
hasPermissionOnTable
protected boolean hasPermissionOnTable(LanguageConnectionContext lcc, Activation activation, boolean forGrant, ExecPreparedStatement ps) throws StandardException
Check if current session has permission on the table (current user, PUBLIC or role) and, if applicable, register a dependency of ps on the current role.- Parameters:
lcc
- the current language connection contextactivation
- the activation of psforGrant
- true if FOR GRANT is requiredps
- the prepared statement for which we are checking necessary privileges- Throws:
StandardException
-
oneAuthHasPermissionOnTable
protected boolean oneAuthHasPermissionOnTable(DataDictionary dd, java.lang.String authorizationId, boolean forGrant) throws StandardException
- Throws:
StandardException
-
getPermissionDescriptor
public PermissionsDescriptor getPermissionDescriptor(java.lang.String authid, DataDictionary dd) throws StandardException
Description copied from class:StatementPermission
Get the PermissionsDescriptor for the passed authorization id for this object. This method gets called during the execution phase of create view/constraint/trigger. The return value of this method is saved in dependency system to keep track of views/constraints/triggers dependencies on required permissions. This happens in execution phase after it has been established that passed authorization id has all the permissions it needs to create that view/constraint/trigger. Which means that we can only get to writing into dependency system once all the required privileges are confirmed.- Specified by:
getPermissionDescriptor
in classStatementPermission
- Parameters:
authid
- AuthorizationIddd
- DataDictionary- Returns:
- PermissionsDescriptor The PermissionsDescriptor for the passed authorization id on this object
- Throws:
StandardException
- See Also:
StatementPermission.getPermissionDescriptor(java.lang.String, org.apache.derby.iapi.sql.dictionary.DataDictionary)
-
getPrivName
public java.lang.String getPrivName()
Return privilege needed for this access as string- Returns:
- privilege string
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-