Search in sources :

Example 1 with PrivilegeInfo

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();
}
Also used : HivePrivilegeInfo(io.prestosql.plugin.hive.metastore.HivePrivilegeInfo) ImmutableList(com.google.common.collect.ImmutableList) GrantInfo(io.prestosql.spi.security.GrantInfo) PrivilegeInfo(io.prestosql.spi.security.PrivilegeInfo) HivePrivilegeInfo(io.prestosql.plugin.hive.metastore.HivePrivilegeInfo)

Example 2 with PrivilegeInfo

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();
}
Also used : HivePrivilegeInfo(io.prestosql.plugin.hive.metastore.HivePrivilegeInfo) ImmutableList(com.google.common.collect.ImmutableList) GrantInfo(io.prestosql.spi.security.GrantInfo) PrivilegeInfo(io.prestosql.spi.security.PrivilegeInfo) HivePrivilegeInfo(io.prestosql.plugin.hive.metastore.HivePrivilegeInfo)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)2 HivePrivilegeInfo (io.prestosql.plugin.hive.metastore.HivePrivilegeInfo)2 GrantInfo (io.prestosql.spi.security.GrantInfo)2 PrivilegeInfo (io.prestosql.spi.security.PrivilegeInfo)2