Interface ConnectorAccessControl
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanCreateViewWithExecuteFunction(ConnectorSecurityContext context, SchemaRoutineName function) Is identity allowed to create a view that executes the specified function?default booleancanExecuteFunction(ConnectorSecurityContext context, SchemaRoutineName function) Is the identity allowed to execute the specified function?default voidcheckCanAddColumn(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to add columns to the specified table.default voidcheckCanAlterColumn(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to alter columns for the specified table.default voidcheckCanCreateFunction(ConnectorSecurityContext context, SchemaRoutineName function) Check if identity is allowed to create the specified function.default voidcheckCanCreateMaterializedView(ConnectorSecurityContext context, SchemaTableName materializedViewName, Map<String, Object> properties) Check if identity is allowed to create the specified materialized view.default voidcheckCanCreateRole(ConnectorSecurityContext context, String role, Optional<TrinoPrincipal> grantor) default voidcheckCanCreateSchema(ConnectorSecurityContext context, String schemaName, Map<String, Object> properties) Check if identity is allowed to create the specified schema with properties.default voidcheckCanCreateTable(ConnectorSecurityContext context, SchemaTableName tableName, Map<String, Object> properties) Check if identity is allowed to create the specified table with properties.default voidcheckCanCreateView(ConnectorSecurityContext context, SchemaTableName viewName) Check if identity is allowed to create the specified view.default voidcheckCanCreateViewWithSelectFromColumns(ConnectorSecurityContext context, SchemaTableName tableName, Set<String> columnNames) Check if identity is allowed to create a view that selects from the specified columns in a relation.default voidcheckCanDeleteFromTable(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to delete from the specified table.default voidcheckCanDenySchemaPrivilege(ConnectorSecurityContext context, Privilege privilege, String schemaName, TrinoPrincipal grantee) Check if identity is allowed to deny to any other user the specified privilege on the specified schema.default voidcheckCanDenyTablePrivilege(ConnectorSecurityContext context, Privilege privilege, SchemaTableName tableName, TrinoPrincipal grantee) Check if identity is allowed to deny to any other user the specified privilege on the specified table.default voidcheckCanDropColumn(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to drop columns from the specified table.default voidcheckCanDropFunction(ConnectorSecurityContext context, SchemaRoutineName function) Check if identity is allowed to drop the specified function.default voidcheckCanDropMaterializedView(ConnectorSecurityContext context, SchemaTableName materializedViewName) Check if identity is allowed to drop the specified materialized view.default voidcheckCanDropRole(ConnectorSecurityContext context, String role) default voidcheckCanDropSchema(ConnectorSecurityContext context, String schemaName) Check if identity is allowed to drop the specified schema.default voidcheckCanDropTable(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to drop the specified table.default voidcheckCanDropView(ConnectorSecurityContext context, SchemaTableName viewName) Check if identity is allowed to drop the specified view.default voidcheckCanExecuteProcedure(ConnectorSecurityContext context, SchemaRoutineName procedure) default voidcheckCanExecuteTableProcedure(ConnectorSecurityContext context, SchemaTableName tableName, String procedure) default voidcheckCanGrantRoles(ConnectorSecurityContext context, Set<String> roles, Set<TrinoPrincipal> grantees, boolean adminOption, Optional<TrinoPrincipal> grantor) default voidcheckCanGrantSchemaPrivilege(ConnectorSecurityContext context, Privilege privilege, String schemaName, TrinoPrincipal grantee, boolean grantOption) Check if identity is allowed to grant to any other user the specified privilege on the specified schema.default voidcheckCanGrantTablePrivilege(ConnectorSecurityContext context, Privilege privilege, SchemaTableName tableName, TrinoPrincipal grantee, boolean grantOption) Check if identity is allowed to grant to any other user the specified privilege on the specified table.default voidcheckCanInsertIntoTable(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to insert into the specified table.default voidcheckCanRefreshMaterializedView(ConnectorSecurityContext context, SchemaTableName materializedViewName) Check if identity is allowed to refresh the specified materialized view.default voidcheckCanRenameColumn(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to rename a column in the specified table.default voidcheckCanRenameMaterializedView(ConnectorSecurityContext context, SchemaTableName viewName, SchemaTableName newViewName) Check if identity is allowed to rename the specified materialized view.default voidcheckCanRenameSchema(ConnectorSecurityContext context, String schemaName, String newSchemaName) Check if identity is allowed to rename the specified schema.default voidcheckCanRenameTable(ConnectorSecurityContext context, SchemaTableName tableName, SchemaTableName newTableName) Check if identity is allowed to rename the specified table.default voidcheckCanRenameView(ConnectorSecurityContext context, SchemaTableName viewName, SchemaTableName newViewName) Check if identity is allowed to rename the specified view.default voidcheckCanRevokeRoles(ConnectorSecurityContext context, Set<String> roles, Set<TrinoPrincipal> grantees, boolean adminOption, Optional<TrinoPrincipal> grantor) default voidcheckCanRevokeSchemaPrivilege(ConnectorSecurityContext context, Privilege privilege, String schemaName, TrinoPrincipal revokee, boolean grantOption) default voidcheckCanRevokeTablePrivilege(ConnectorSecurityContext context, Privilege privilege, SchemaTableName tableName, TrinoPrincipal revokee, boolean grantOption) Check if identity is allowed to revoke the specified privilege on the specified table from any user.default voidcheckCanSelectFromColumns(ConnectorSecurityContext context, SchemaTableName tableName, Set<String> columnNames) Check if identity is allowed to select from the specified columns in a relation.default voidcheckCanSetCatalogSessionProperty(ConnectorSecurityContext context, String propertyName) Check if identity is allowed to set the specified property.default voidcheckCanSetColumnComment(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to comment the column in the specified table.default voidcheckCanSetMaterializedViewProperties(ConnectorSecurityContext context, SchemaTableName materializedViewName, Map<String, Optional<Object>> properties) Check if identity is allowed to set the properties of the specified materialized view.default voidcheckCanSetRole(ConnectorSecurityContext context, String role) default voidcheckCanSetSchemaAuthorization(ConnectorSecurityContext context, String schemaName, TrinoPrincipal principal) Check if identity is allowed to change the specified schema's user/role.default voidcheckCanSetTableAuthorization(ConnectorSecurityContext context, SchemaTableName tableName, TrinoPrincipal principal) Check if identity is allowed to change the specified table's user/role.default voidcheckCanSetTableComment(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to comment the specified table.default voidcheckCanSetTableProperties(ConnectorSecurityContext context, SchemaTableName tableName, Map<String, Optional<Object>> properties) Check if identity is allowed to set properties to the specified table.default voidcheckCanSetViewAuthorization(ConnectorSecurityContext context, SchemaTableName viewName, TrinoPrincipal principal) Check if identity is allowed to change the specified view's user/role.default voidcheckCanSetViewComment(ConnectorSecurityContext context, SchemaTableName viewName) Check if identity is allowed to comment the specified view.default voidcheckCanShowColumns(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to show columns of tables by executing SHOW COLUMNS, DESCRIBE etc.default voidcheckCanShowCreateFunction(ConnectorSecurityContext context, SchemaRoutineName function) Check if identity is allowed to execute SHOW CREATE FUNCTION.default voidcheckCanShowCreateSchema(ConnectorSecurityContext context, String schemaName) Check if identity is allowed to execute SHOW CREATE SCHEMA.default voidcheckCanShowCreateTable(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to execute SHOW CREATE TABLE, SHOW CREATE VIEW or SHOW CREATE MATERIALIZED VIEWdefault voidCheck if identity is allowed to show current roles.default voidcheckCanShowFunctions(ConnectorSecurityContext context, String schemaName) Check if identity is allowed to show functions by executing SHOW FUNCTIONS.default voidCheck if identity is allowed to show its own role grants.default voidCheck if identity is allowed to show roles.default voidCheck if identity is allowed to execute SHOW SCHEMAS.default voidcheckCanShowTables(ConnectorSecurityContext context, String schemaName) Check if identity is allowed to show metadata of tables by executing SHOW TABLES, SHOW GRANTS etc..default voidcheckCanTruncateTable(ConnectorSecurityContext context, SchemaTableName tableName) Check if identity is allowed to truncate the specified table in this catalog.default voidcheckCanUpdateTableColumns(ConnectorSecurityContext context, SchemaTableName tableName, Set<String> updatedColumns) Check if identity is allowed to update the supplied columns in the specified table in this catalog.default Map<SchemaTableName, Set<String>> filterColumns(ConnectorSecurityContext context, Map<SchemaTableName, Set<String>> tableColumns) Filter lists of columns of multiple tables to those visible to the identity.default Set<SchemaFunctionName> filterFunctions(ConnectorSecurityContext context, Set<SchemaFunctionName> functionNames) Filter the list of functions to those visible to the identity.filterSchemas(ConnectorSecurityContext context, Set<String> schemaNames) Filter the list of schemas to those visible to the identity.default Set<SchemaTableName> filterTables(ConnectorSecurityContext context, Set<SchemaTableName> tableNames) Filter the list of tables and views to those visible to the identity.default Optional<ViewExpression> getColumnMask(ConnectorSecurityContext context, SchemaTableName tableName, String columnName, Type type) Deprecated.default Map<ColumnSchema, ViewExpression> getColumnMasks(ConnectorSecurityContext context, SchemaTableName tableName, List<ColumnSchema> columns) Bulk method for getting column masks for a subset of columns in a table.default List<ViewExpression> getRowFilters(ConnectorSecurityContext context, SchemaTableName tableName) Get row filters associated with the given table and identity.
-
Method Details
-
checkCanCreateSchema
default void checkCanCreateSchema(ConnectorSecurityContext context, String schemaName, Map<String, Object> properties) Check if identity is allowed to create the specified schema with properties.- Throws:
AccessDeniedException- if not allowed
-
checkCanDropSchema
Check if identity is allowed to drop the specified schema.- Throws:
AccessDeniedException- if not allowed
-
checkCanRenameSchema
default void checkCanRenameSchema(ConnectorSecurityContext context, String schemaName, String newSchemaName) Check if identity is allowed to rename the specified schema.- Throws:
AccessDeniedException- if not allowed
-
checkCanSetSchemaAuthorization
default void checkCanSetSchemaAuthorization(ConnectorSecurityContext context, String schemaName, TrinoPrincipal principal) Check if identity is allowed to change the specified schema's user/role.- Throws:
AccessDeniedException- if not allowed
-
checkCanShowSchemas
Check if identity is allowed to execute SHOW SCHEMAS.NOTE: This method is only present to give users an error message when listing is not allowed. The
filterSchemas(io.trino.spi.connector.ConnectorSecurityContext, java.util.Set<java.lang.String>)method must handle filter all results for unauthorized users, since there are multiple way to list schemas.- Throws:
AccessDeniedException- if not allowed
-
filterSchemas
Filter the list of schemas to those visible to the identity. -
checkCanShowCreateSchema
Check if identity is allowed to execute SHOW CREATE SCHEMA.- Throws:
AccessDeniedException- if not allowed
-
checkCanShowCreateTable
Check if identity is allowed to execute SHOW CREATE TABLE, SHOW CREATE VIEW or SHOW CREATE MATERIALIZED VIEW- Throws:
AccessDeniedException- if not allowed
-
checkCanCreateTable
default void checkCanCreateTable(ConnectorSecurityContext context, SchemaTableName tableName, Map<String, Object> properties) Check if identity is allowed to create the specified table with properties.- Throws:
AccessDeniedException- if not allowed
-
checkCanDropTable
Check if identity is allowed to drop the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanRenameTable
default void checkCanRenameTable(ConnectorSecurityContext context, SchemaTableName tableName, SchemaTableName newTableName) Check if identity is allowed to rename the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanSetTableProperties
default void checkCanSetTableProperties(ConnectorSecurityContext context, SchemaTableName tableName, Map<String, Optional<Object>> properties) Check if identity is allowed to set properties to the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanSetTableComment
Check if identity is allowed to comment the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanSetViewComment
Check if identity is allowed to comment the specified view.- Throws:
AccessDeniedException- if not allowed
-
checkCanSetColumnComment
Check if identity is allowed to comment the column in the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanShowTables
Check if identity is allowed to show metadata of tables by executing SHOW TABLES, SHOW GRANTS etc..NOTE: This method is only present to give users an error message when listing is not allowed. The
filterTables(io.trino.spi.connector.ConnectorSecurityContext, java.util.Set<io.trino.spi.connector.SchemaTableName>)method must filter all results for unauthorized users, since there are multiple ways to list tables.- Throws:
AccessDeniedException- if not allowed
-
filterTables
default Set<SchemaTableName> filterTables(ConnectorSecurityContext context, Set<SchemaTableName> tableNames) Filter the list of tables and views to those visible to the identity. -
checkCanShowColumns
Check if identity is allowed to show columns of tables by executing SHOW COLUMNS, DESCRIBE etc.NOTE: This method is only present to give users an error message when listing is not allowed. The
filterColumns(io.trino.spi.connector.ConnectorSecurityContext, java.util.Map<io.trino.spi.connector.SchemaTableName, java.util.Set<java.lang.String>>)method must filter all results for unauthorized users, since there are multiple ways to list columns.- Throws:
AccessDeniedException- if not allowed
-
filterColumns
default Map<SchemaTableName,Set<String>> filterColumns(ConnectorSecurityContext context, Map<SchemaTableName, Set<String>> tableColumns) Filter lists of columns of multiple tables to those visible to the identity. -
checkCanAddColumn
Check if identity is allowed to add columns to the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanAlterColumn
Check if identity is allowed to alter columns for the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanDropColumn
Check if identity is allowed to drop columns from the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanSetTableAuthorization
default void checkCanSetTableAuthorization(ConnectorSecurityContext context, SchemaTableName tableName, TrinoPrincipal principal) Check if identity is allowed to change the specified table's user/role.- Throws:
AccessDeniedException- if not allowed
-
checkCanRenameColumn
Check if identity is allowed to rename a column in the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanSelectFromColumns
default void checkCanSelectFromColumns(ConnectorSecurityContext context, SchemaTableName tableName, Set<String> columnNames) Check if identity is allowed to select from the specified columns in a relation. The column set can be empty.- Throws:
AccessDeniedException- if not allowed
-
checkCanInsertIntoTable
Check if identity is allowed to insert into the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanDeleteFromTable
Check if identity is allowed to delete from the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanTruncateTable
Check if identity is allowed to truncate the specified table in this catalog.- Throws:
AccessDeniedException- if not allowed
-
checkCanUpdateTableColumns
default void checkCanUpdateTableColumns(ConnectorSecurityContext context, SchemaTableName tableName, Set<String> updatedColumns) Check if identity is allowed to update the supplied columns in the specified table in this catalog.- Throws:
AccessDeniedException- if not allowed
-
checkCanCreateView
Check if identity is allowed to create the specified view.- Throws:
AccessDeniedException- if not allowed
-
checkCanRenameView
default void checkCanRenameView(ConnectorSecurityContext context, SchemaTableName viewName, SchemaTableName newViewName) Check if identity is allowed to rename the specified view.- Throws:
AccessDeniedException- if not allowed
-
checkCanSetViewAuthorization
default void checkCanSetViewAuthorization(ConnectorSecurityContext context, SchemaTableName viewName, TrinoPrincipal principal) Check if identity is allowed to change the specified view's user/role.- Throws:
AccessDeniedException- if not allowed
-
checkCanDropView
Check if identity is allowed to drop the specified view.- Throws:
AccessDeniedException- if not allowed
-
checkCanCreateViewWithSelectFromColumns
default void checkCanCreateViewWithSelectFromColumns(ConnectorSecurityContext context, SchemaTableName tableName, Set<String> columnNames) Check if identity is allowed to create a view that selects from the specified columns in a relation.- Throws:
AccessDeniedException- if not allowed
-
checkCanCreateMaterializedView
default void checkCanCreateMaterializedView(ConnectorSecurityContext context, SchemaTableName materializedViewName, Map<String, Object> properties) Check if identity is allowed to create the specified materialized view.- Throws:
AccessDeniedException- if not allowed
-
checkCanRefreshMaterializedView
default void checkCanRefreshMaterializedView(ConnectorSecurityContext context, SchemaTableName materializedViewName) Check if identity is allowed to refresh the specified materialized view.- Throws:
AccessDeniedException- if not allowed
-
checkCanSetMaterializedViewProperties
default void checkCanSetMaterializedViewProperties(ConnectorSecurityContext context, SchemaTableName materializedViewName, Map<String, Optional<Object>> properties) Check if identity is allowed to set the properties of the specified materialized view.- Throws:
AccessDeniedException- if not allowed
-
checkCanDropMaterializedView
default void checkCanDropMaterializedView(ConnectorSecurityContext context, SchemaTableName materializedViewName) Check if identity is allowed to drop the specified materialized view.- Throws:
AccessDeniedException- if not allowed
-
checkCanRenameMaterializedView
default void checkCanRenameMaterializedView(ConnectorSecurityContext context, SchemaTableName viewName, SchemaTableName newViewName) Check if identity is allowed to rename the specified materialized view.- Throws:
AccessDeniedException- if not allowed
-
checkCanSetCatalogSessionProperty
default void checkCanSetCatalogSessionProperty(ConnectorSecurityContext context, String propertyName) Check if identity is allowed to set the specified property.- Throws:
AccessDeniedException- if not allowed
-
checkCanGrantSchemaPrivilege
default void checkCanGrantSchemaPrivilege(ConnectorSecurityContext context, Privilege privilege, String schemaName, TrinoPrincipal grantee, boolean grantOption) Check if identity is allowed to grant to any other user the specified privilege on the specified schema.- Throws:
AccessDeniedException- if not allowed
-
checkCanDenySchemaPrivilege
default void checkCanDenySchemaPrivilege(ConnectorSecurityContext context, Privilege privilege, String schemaName, TrinoPrincipal grantee) Check if identity is allowed to deny to any other user the specified privilege on the specified schema.- Throws:
AccessDeniedException- if not allowed
-
checkCanRevokeSchemaPrivilege
default void checkCanRevokeSchemaPrivilege(ConnectorSecurityContext context, Privilege privilege, String schemaName, TrinoPrincipal revokee, boolean grantOption) -
checkCanGrantTablePrivilege
default void checkCanGrantTablePrivilege(ConnectorSecurityContext context, Privilege privilege, SchemaTableName tableName, TrinoPrincipal grantee, boolean grantOption) Check if identity is allowed to grant to any other user the specified privilege on the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanDenyTablePrivilege
default void checkCanDenyTablePrivilege(ConnectorSecurityContext context, Privilege privilege, SchemaTableName tableName, TrinoPrincipal grantee) Check if identity is allowed to deny to any other user the specified privilege on the specified table.- Throws:
AccessDeniedException- if not allowed
-
checkCanRevokeTablePrivilege
default void checkCanRevokeTablePrivilege(ConnectorSecurityContext context, Privilege privilege, SchemaTableName tableName, TrinoPrincipal revokee, boolean grantOption) Check if identity is allowed to revoke the specified privilege on the specified table from any user.- Throws:
AccessDeniedException- if not allowed
-
checkCanCreateRole
default void checkCanCreateRole(ConnectorSecurityContext context, String role, Optional<TrinoPrincipal> grantor) -
checkCanDropRole
-
checkCanGrantRoles
default void checkCanGrantRoles(ConnectorSecurityContext context, Set<String> roles, Set<TrinoPrincipal> grantees, boolean adminOption, Optional<TrinoPrincipal> grantor) -
checkCanRevokeRoles
default void checkCanRevokeRoles(ConnectorSecurityContext context, Set<String> roles, Set<TrinoPrincipal> grantees, boolean adminOption, Optional<TrinoPrincipal> grantor) -
checkCanSetRole
-
checkCanShowRoles
Check if identity is allowed to show roles.- Throws:
AccessDeniedException- if not allowed
-
checkCanShowCurrentRoles
Check if identity is allowed to show current roles.- Throws:
AccessDeniedException- if not allowed
-
checkCanShowRoleGrants
Check if identity is allowed to show its own role grants.- Throws:
AccessDeniedException- if not allowed
-
checkCanExecuteProcedure
default void checkCanExecuteProcedure(ConnectorSecurityContext context, SchemaRoutineName procedure) -
checkCanExecuteTableProcedure
default void checkCanExecuteTableProcedure(ConnectorSecurityContext context, SchemaTableName tableName, String procedure) -
canExecuteFunction
Is the identity allowed to execute the specified function? -
canCreateViewWithExecuteFunction
default boolean canCreateViewWithExecuteFunction(ConnectorSecurityContext context, SchemaRoutineName function) Is identity allowed to create a view that executes the specified function? -
checkCanShowFunctions
Check if identity is allowed to show functions by executing SHOW FUNCTIONS.NOTE: This method is only present to give users an error message when listing is not allowed. The
filterFunctions(io.trino.spi.connector.ConnectorSecurityContext, java.util.Set<io.trino.spi.function.SchemaFunctionName>)method must filter all results for unauthorized users, since there are multiple ways to list functions.- Throws:
AccessDeniedException- if not allowed
-
filterFunctions
default Set<SchemaFunctionName> filterFunctions(ConnectorSecurityContext context, Set<SchemaFunctionName> functionNames) Filter the list of functions to those visible to the identity. -
checkCanCreateFunction
Check if identity is allowed to create the specified function.- Throws:
AccessDeniedException- if not allowed
-
checkCanDropFunction
Check if identity is allowed to drop the specified function.- Throws:
AccessDeniedException- if not allowed
-
checkCanShowCreateFunction
default void checkCanShowCreateFunction(ConnectorSecurityContext context, SchemaRoutineName function) Check if identity is allowed to execute SHOW CREATE FUNCTION.- Throws:
AccessDeniedException- if not allowed
-
getRowFilters
default List<ViewExpression> getRowFilters(ConnectorSecurityContext context, SchemaTableName tableName) Get row filters associated with the given table and identity.Each filter must be a scalar SQL expression of boolean type over the columns in the table.
- Returns:
- the list of filters, or empty list if not applicable
-
getColumnMask
@Deprecated default Optional<ViewExpression> getColumnMask(ConnectorSecurityContext context, SchemaTableName tableName, String columnName, Type type) Deprecated.Get column mask associated with the given table, column and identity.The mask must be a scalar SQL expression of a type coercible to the type of the column being masked. The expression must be written in terms of columns in the table.
- Returns:
- the mask if present, or empty if not applicable
-
getColumnMasks
default Map<ColumnSchema,ViewExpression> getColumnMasks(ConnectorSecurityContext context, SchemaTableName tableName, List<ColumnSchema> columns) Bulk method for getting column masks for a subset of columns in a table.Each mask must be a scalar SQL expression of a type coercible to the type of the column being masked. The expression must be written in terms of columns in the table.
- Returns:
- a mapping from columns to masks. The keys of the return Map are a subset of
columns.
-
getColumnMasks(ConnectorSecurityContext, SchemaTableName, List)