use of com.facebook.presto.spi.security.PrivilegeInfo in project presto by prestodb.
the class HiveMetadata method buildGrants.
private List<GrantInfo> buildGrants(ConnectorSession session, SchemaTableName tableName, PrestoPrincipal principal) {
ImmutableList.Builder<GrantInfo> result = ImmutableList.builder();
MetastoreContext metastoreContext = getMetastoreContext(session);
Set<HivePrivilegeInfo> hivePrivileges = metastore.listTablePrivileges(metastoreContext, tableName.getSchemaName(), tableName.getTableName(), principal);
for (HivePrivilegeInfo hivePrivilege : hivePrivileges) {
Set<PrivilegeInfo> prestoPrivileges = hivePrivilege.toPrivilegeInfo();
for (PrivilegeInfo prestoPrivilege : prestoPrivileges) {
GrantInfo grant = new GrantInfo(prestoPrivilege, hivePrivilege.getGrantee(), tableName, Optional.of(hivePrivilege.getGrantor()), Optional.empty());
result.add(grant);
}
}
return result.build();
}
Aggregations