@Override public HivePrincipal getHivePrincipal(PrincipalDesc principal) throws HiveException { if (principal == null) { return null; } return AuthorizationUtils.getHivePrincipal(principal.getName(), principal.getType()); }
@Override public HivePrincipal getHivePrincipal(PrincipalDesc principal) throws HiveException { if (principal == null) { return null; } return AuthorizationUtils.getHivePrincipal(principal.getName(), principal.getType()); }
public static List<HivePrivilegeInfo> getPrivilegeInfos(List<HiveObjectPrivilege> privs) throws HiveException { List<HivePrivilegeInfo> hivePrivs = new ArrayList<HivePrivilegeInfo>(); for (HiveObjectPrivilege priv : privs) { PrivilegeGrantInfo grantorInfo = priv.getGrantInfo(); HiveObjectRef privObject = priv.getHiveObject(); HivePrincipal hivePrincipal = getHivePrincipal(priv.getPrincipalName(), priv.getPrincipalType()); HivePrincipal grantor = getHivePrincipal(grantorInfo.getGrantor(), grantorInfo.getGrantorType()); HivePrivilegeObject object = getHiveObjectRef(privObject); HivePrivilege privilege = new HivePrivilege(grantorInfo.getPrivilege(), null); hivePrivs.add(new HivePrivilegeInfo(hivePrincipal, privilege, object, grantor, grantorInfo.isGrantOption(), grantorInfo.getCreateTime())); } return hivePrivs; }
public static List<HivePrivilegeInfo> getPrivilegeInfos(List<HiveObjectPrivilege> privs) throws HiveException { List<HivePrivilegeInfo> hivePrivs = new ArrayList<HivePrivilegeInfo>(); for (HiveObjectPrivilege priv : privs) { PrivilegeGrantInfo grantorInfo = priv.getGrantInfo(); HiveObjectRef privObject = priv.getHiveObject(); HivePrincipal hivePrincipal = getHivePrincipal(priv.getPrincipalName(), priv.getPrincipalType()); HivePrincipal grantor = getHivePrincipal(grantorInfo.getGrantor(), grantorInfo.getGrantorType()); HivePrivilegeObject object = getHiveObjectRef(privObject); HivePrivilege privilege = new HivePrivilege(grantorInfo.getPrivilege(), null); hivePrivs.add(new HivePrivilegeInfo(hivePrincipal, privilege, object, grantor, grantorInfo.isGrantOption(), grantorInfo.getCreateTime())); } return hivePrivs; }
boolean testMode = conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST); List<HiveRoleGrant> roles = authorizer.getRoleGrantInfoForPrincipal( AuthorizationUtils.getHivePrincipal(roleDDLDesc.getName(), roleDDLDesc.getPrincipalType())); writeToFile(writeRolesGrantedInfo(roles, testMode), roleDDLDesc.getResFile()); break;
boolean testMode = conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST); List<HiveRoleGrant> roles = authorizer.getRoleGrantInfoForPrincipal( AuthorizationUtils.getHivePrincipal(roleDDLDesc.getName(), roleDDLDesc.getPrincipalType())); writeToFile(writeRolesGrantedInfo(roles, testMode), roleDDLDesc.getResFile()); break;
public static List<HivePrincipal> getHivePrincipals(List<PrincipalDesc> principals) throws HiveException { ArrayList<HivePrincipal> hivePrincipals = new ArrayList<HivePrincipal>(); for(PrincipalDesc principal : principals){ hivePrincipals.add(getHivePrincipal(principal)); } return hivePrincipals; }
public static HivePrincipal getHivePrincipal(PrincipalDesc principal) throws HiveException { if (principal == null) { return null; } return getHivePrincipal(principal.getName(), principal.getType()); }
public static List<HivePrivilegeInfo> getPrivilegeInfos(List<HiveObjectPrivilege> privs) throws HiveException { List<HivePrivilegeInfo> hivePrivs = new ArrayList<HivePrivilegeInfo>(); for (HiveObjectPrivilege priv : privs) { PrivilegeGrantInfo grantorInfo = priv.getGrantInfo(); HiveObjectRef privObject = priv.getHiveObject(); HivePrincipal hivePrincipal = getHivePrincipal(priv.getPrincipalName(), priv.getPrincipalType()); HivePrincipal grantor = getHivePrincipal(grantorInfo.getGrantor(), grantorInfo.getGrantorType()); HivePrivilegeObject object = getHiveObjectRef(privObject); HivePrivilege privilege = new HivePrivilege(grantorInfo.getPrivilege(), null); hivePrivs.add(new HivePrivilegeInfo(hivePrincipal, privilege, object, grantor, grantorInfo.isGrantOption(), grantorInfo.getCreateTime())); } return hivePrivs; }
private int showGrants(ShowGrantDesc showGrantDesc) throws HiveException { HiveAuthorizer authorizer = getSessionAuthorizer(); try { List<HivePrivilegeInfo> privInfos = authorizer.showPrivileges( AuthorizationUtils.getHivePrincipal(showGrantDesc.getPrincipalDesc()), AuthorizationUtils.getHivePrivilegeObject(showGrantDesc.getHiveObj())); boolean testMode = conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST); writeToFile(writeGrantInfo(privInfos, testMode), showGrantDesc.getResFile()); } catch (IOException e) { throw new HiveException("Error in show grant statement", e); } return 0; }
boolean testMode = conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST); List<HiveRoleGrant> roles = authorizer.getRoleGrantInfoForPrincipal( AuthorizationUtils.getHivePrincipal(roleDDLDesc.getName(), roleDDLDesc.getPrincipalType())); writeToFile(writeRolesGrantedInfo(roles, testMode), roleDDLDesc.getResFile()); break;