use of com.facebook.presto.hive.HiveTransactionHandle in project presto by prestodb.
the class SqlStandardAccessControl method checkDatabasePermission.
private boolean checkDatabasePermission(ConnectorTransactionHandle transaction, Identity identity, String schemaName, HivePrivilege... requiredPrivileges) {
SemiTransactionalHiveMetastore metastore = metastoreProvider.apply(((HiveTransactionHandle) transaction));
Set<HivePrivilege> privilegeSet = metastore.getDatabasePrivileges(identity.getUser(), schemaName).stream().map(HivePrivilegeInfo::getHivePrivilege).collect(Collectors.toSet());
return privilegeSet.containsAll(ImmutableSet.copyOf(requiredPrivileges));
}
use of com.facebook.presto.hive.HiveTransactionHandle in project presto by prestodb.
the class SqlStandardAccessControl method checkTablePermission.
private boolean checkTablePermission(ConnectorTransactionHandle transaction, Identity identity, SchemaTableName tableName, HivePrivilege... requiredPrivileges) {
if (INFORMATION_SCHEMA_NAME.equals(tableName.getSchemaName())) {
return true;
}
SemiTransactionalHiveMetastore metastore = metastoreProvider.apply(((HiveTransactionHandle) transaction));
Set<HivePrivilege> privilegeSet = metastore.getTablePrivileges(identity.getUser(), tableName.getSchemaName(), tableName.getTableName()).stream().map(HivePrivilegeInfo::getHivePrivilege).collect(Collectors.toSet());
return privilegeSet.containsAll(ImmutableSet.copyOf(requiredPrivileges));
}
Aggregations