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.
  • Field Details

    • tableUUID

      UUID tableUUID
    • privType

      int privType
  • Constructor Details

    • 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 table
      privType - Access privilege requested
  • Method Details

    • 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(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 class Object
      Parameters:
      obj - Another instance of StatementPermission
      Returns:
      true if match
    • hashCode

      public int hashCode()
      Return hash code for this instance
      Overrides:
      hashCode in class Object
      Returns:
      Hashcode
    • check

      public void check(LanguageConnectionContext lcc, boolean forGrant, Activation activation) throws StandardException
      Specified by:
      check in class StatementPermission
      Parameters:
      lcc - LanguageConnectionContext
      forGrant -
      activation - activation for statement needing check
      Throws:
      StandardException - if the permission has not been granted
      See Also:
    • 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 context
      activation - the activation of ps
      forGrant - true if FOR GRANT is required
      ps - the prepared statement for which we are checking necessary privileges
      Throws:
      StandardException
    • oneAuthHasPermissionOnTable

      protected boolean oneAuthHasPermissionOnTable(DataDictionary dd, String authorizationId, boolean forGrant) throws StandardException
      Throws:
      StandardException
    • getPermissionDescriptor

      public PermissionsDescriptor getPermissionDescriptor(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 class StatementPermission
      Parameters:
      authid - AuthorizationId
      dd - DataDictionary
      Returns:
      PermissionsDescriptor The PermissionsDescriptor for the passed authorization id on this object
      Throws:
      StandardException
      See Also:
    • getPrivName

      public String getPrivName()
      Return privilege needed for this access as string
      Returns:
      privilege string
    • toString

      public String toString()
      Overrides:
      toString in class Object