use of io.prestosql.spi.security.PrivilegeInfo in project hetu-core by openlookeng.
the class SqlStandardAccessControlMetadata method buildGrants.
private List<GrantInfo> buildGrants(SchemaTableName tableName, HivePrincipal principal) {
ImmutableList.Builder<GrantInfo> result = ImmutableList.builder();
Set<HivePrivilegeInfo> hivePrivileges = metastore.listTablePrivileges(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().toPrestoPrincipal(), tableName, Optional.of(hivePrivilege.getGrantor().toPrestoPrincipal()), Optional.empty());
result.add(grant);
}
}
return result.build();
}
use of io.prestosql.spi.security.PrivilegeInfo in project boostkit-bigdata by kunpengcompute.
the class SqlStandardAccessControlMetadata method buildGrants.
private List<GrantInfo> buildGrants(SchemaTableName tableName, HivePrincipal principal) {
ImmutableList.Builder<GrantInfo> result = ImmutableList.builder();
Set<HivePrivilegeInfo> hivePrivileges = metastore.listTablePrivileges(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().toPrestoPrincipal(), tableName, Optional.of(hivePrivilege.getGrantor().toPrestoPrincipal()), Optional.empty());
result.add(grant);
}
}
return result.build();
}
Aggregations