Top Description Fields Constructors Methods
org.apache.derby.iapi.sql.dictionary

public Class StatementColumnPermission

extends StatementTablePermission
Class Inheritance
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.catalog.UUID, org.apache.derby.iapi.sql.conn.Authorizer, .LanguageConnectionContext, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.sql.execute.ExecPreparedStatement, org.apache.derby.iapi.sql.depend.DependencyManager, org.apache.derby.iapi.services.context.ContextManager

This class describes a column permission used (required) by a statement.

Field Summary

Modifier and TypeField and Description
private FormatableBitSet
Inherited from org.apache.derby.iapi.sql.dictionary.StatementTablePermission:
privTypetableUUID

Constructor Summary

AccessConstructor and Description
public
StatementColumnPermission(UUID
UUID of the table
tableUUID
,
int
Access privilege requested
privType
,
FormatableBitSet
List of columns
columns
)

Constructor for StatementColumnPermission.

Method Summary

Modifier and TypeMethod and Description
private FormatableBitSet
addPermittedColumns(DataDictionary dd, boolean forGrant, String authorizationId, FormatableBitSet permittedColumns)

Add one user's set of permitted columns to a list of permitted columns.

public boolean

Returns:

false if the current role is required
allColumnsCoveredByUserOrPUBLIC
(String
authentication id of the current user
authid
,
DataDictionary
data dictionary
dd
)

Returns false if the current role is necessary to cover the necessary permission(s).

public void
check(LanguageConnectionContext
LanguageConnectionContext
lcc
,
boolean forGrant, Activation
activation for statement needing check
activation
)

Overrides org.apache.derby.iapi.sql.dictionary.StatementTablePermission.check.

public boolean

Returns:

true if match
equals
(Object
Another instance of StatementPermission
obj
)

Overrides org.apache.derby.iapi.sql.dictionary.StatementTablePermission.equals.

Method to check if another instance of column access descriptor matches this.

public FormatableBitSet

Returns:

FormatableBitSet of columns
getColumns
()

Return list of columns that need access

public PermissionsDescriptor
getPermissionDescriptor(String
AuthorizationId
authid
,
DataDictionary
DataDictionary
dd
)

Overrides org.apache.derby.iapi.sql.dictionary.StatementTablePermission.getPermissionDescriptor.

Get the PermissionsDescriptor for the passed authorization id for this object.

public PermissionsDescriptor
getPUBLIClevelColPermsDescriptor(String authid, DataDictionary dd)

This method gets called in execution phase after it is established that all the required privileges exist for the given sql.

public String
toString()

Overrides org.apache.derby.iapi.sql.dictionary.StatementTablePermission.toString.

Returns a string representation of the object.

private FormatableBitSet
tryRole(LanguageConnectionContext
language connection context
lcc
,
DataDictionary
data dictionary
dd
,
boolean
true of a GRANTable permission is sought
forGrant
,
String
the role to inspect to see if it can supply the required privileges return the set of columns on which we have privileges through this role
r
)

Try to use the supplied role r to see what column privileges are we entitled to.

Inherited from org.apache.derby.iapi.sql.dictionary.StatementTablePermission:
getPrivNamegetPrivTypegetTableDescriptorgetTableUUIDhashCodehasPermissionOnTableoneAuthHasPermissionOnTable

Field Detail

columnsback to summary
private FormatableBitSet columns

Constructor Detail

StatementColumnPermissionback to summary
public StatementColumnPermission(UUID tableUUID, int privType, FormatableBitSet columns)

Constructor for StatementColumnPermission. Creates an instance of column permission requested for the given access.

Parameters
tableUUID:UUID

UUID of the table

privType:int

Access privilege requested

columns:FormatableBitSet

List of columns

Method Detail

addPermittedColumnsback to summary
private FormatableBitSet addPermittedColumns(DataDictionary dd, boolean forGrant, String authorizationId, FormatableBitSet permittedColumns) throws StandardException

Add one user's set of permitted columns to a list of permitted columns.

allColumnsCoveredByUserOrPUBLICback to summary
public boolean allColumnsCoveredByUserOrPUBLIC(String authid, DataDictionary dd) throws StandardException

Returns false if the current role is necessary to cover the necessary permission(s).

Parameters
authid:String

authentication id of the current user

dd:DataDictionary

data dictionary

Returns:boolean

false if the current role is required

checkback to summary
public void check(LanguageConnectionContext lcc, boolean forGrant, Activation activation) throws StandardException

Overrides org.apache.derby.iapi.sql.dictionary.StatementTablePermission.check.

Parameters
lcc:LanguageConnectionContext

Doc from org.apache.derby.iapi.sql.dictionary.StatementPermission.check.

LanguageConnectionContext

activation:Activation

Doc from org.apache.derby.iapi.sql.dictionary.StatementPermission.check.

activation for statement needing check

Exceptions
StandardException:

Doc from org.apache.derby.iapi.sql.dictionary.StatementPermission.check.

if the permission has not been granted

See Also
StatementPermission#check
equalsback to summary
public boolean equals(Object obj)

Overrides org.apache.derby.iapi.sql.dictionary.StatementTablePermission.equals.

Method to check if another instance of column access descriptor matches this. Used to ensure only one access descriptor for a table/columns of given privilege is created.

Parameters
obj:Object

Another instance of StatementPermission

Returns:boolean

true if match

getColumnsback to summary
public FormatableBitSet getColumns()

Return list of columns that need access

Returns:FormatableBitSet

FormatableBitSet of columns

getPermissionDescriptorback to summary
public PermissionsDescriptor getPermissionDescriptor(String authid, DataDictionary dd) throws StandardException

Overrides org.apache.derby.iapi.sql.dictionary.StatementTablePermission.getPermissionDescriptor.

Doc from org.apache.derby.iapi.sql.dictionary.StatementPermission.getPermissionDescriptor.

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.

Parameters
authid:String

AuthorizationId

dd:DataDictionary

DataDictionary

Returns:PermissionsDescriptor

PermissionsDescriptor The PermissionsDescriptor for the passed authorization id on this object

See Also
StatementPermission#getPermissionDescriptor
getPUBLIClevelColPermsDescriptorback to summary
public PermissionsDescriptor getPUBLIClevelColPermsDescriptor(String authid, DataDictionary dd) throws StandardException

This method gets called in execution phase after it is established that all the required privileges exist for the given sql. This method gets called by create view/trigger/constraint to record their dependency on various privileges. Special code is required to track column level privileges. It is possible that some column level privileges are available to the passed authorizer id but the rest required column level privileges are available at PUBLIC level. In this method, we check if all the required column level privileges are found for the passed authorizer. If yes, then simply return null, indicating that no dependency is required at PUBLIC level, because all the required privileges were found at the user level. But if some column level privileges are not available at user level, then they have to exist at the PUBLIC level when this method gets called.

toStringback to summary
public String toString()

Overrides org.apache.derby.iapi.sql.dictionary.StatementTablePermission.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

tryRoleback to summary
private FormatableBitSet tryRole(LanguageConnectionContext lcc, DataDictionary dd, boolean forGrant, String r) throws StandardException

Try to use the supplied role r to see what column privileges are we entitled to.

Parameters
lcc:LanguageConnectionContext

language connection context

dd:DataDictionary

data dictionary

forGrant:boolean

true of a GRANTable permission is sought

r:String

the role to inspect to see if it can supply the required privileges return the set of columns on which we have privileges through this role