Search in sources :

Example 1 with GetPrincipalsInRoleResponse

use of org.apache.hadoop.hive.metastore.api.GetPrincipalsInRoleResponse in project hive by apache.

the class SQLStdHiveAccessController method getHiveRoleGrants.

public static List<HiveRoleGrant> getHiveRoleGrants(IMetaStoreClient client, String roleName) throws Exception {
    GetPrincipalsInRoleRequest request = new GetPrincipalsInRoleRequest(roleName);
    GetPrincipalsInRoleResponse princGrantInfo = client.get_principals_in_role(request);
    List<HiveRoleGrant> hiveRoleGrants = new ArrayList<HiveRoleGrant>();
    for (RolePrincipalGrant thriftRoleGrant : princGrantInfo.getPrincipalGrants()) {
        hiveRoleGrants.add(new HiveRoleGrant(thriftRoleGrant));
    }
    return hiveRoleGrants;
}
Also used : RolePrincipalGrant(org.apache.hadoop.hive.metastore.api.RolePrincipalGrant) HiveRoleGrant(org.apache.hadoop.hive.ql.security.authorization.plugin.HiveRoleGrant) ArrayList(java.util.ArrayList) GetPrincipalsInRoleResponse(org.apache.hadoop.hive.metastore.api.GetPrincipalsInRoleResponse) GetPrincipalsInRoleRequest(org.apache.hadoop.hive.metastore.api.GetPrincipalsInRoleRequest)

Aggregations

ArrayList (java.util.ArrayList)1 GetPrincipalsInRoleRequest (org.apache.hadoop.hive.metastore.api.GetPrincipalsInRoleRequest)1 GetPrincipalsInRoleResponse (org.apache.hadoop.hive.metastore.api.GetPrincipalsInRoleResponse)1 RolePrincipalGrant (org.apache.hadoop.hive.metastore.api.RolePrincipalGrant)1 HiveRoleGrant (org.apache.hadoop.hive.ql.security.authorization.plugin.HiveRoleGrant)1