本文整理了Java中org.apache.hadoop.hive.ql.metadata.Hive.grantRole()
方法的一些代码示例,展示了Hive.grantRole()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hive.grantRole()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.metadata.Hive
类名称:Hive
方法名:grantRole
暂无
代码示例来源:origin: apache/hive
private void grantOrRevokeRole(List<HivePrincipal> principals, List<String> roles,
boolean grantOption, HivePrincipal grantor, boolean isGrant) throws HiveException {
PrincipalType grantorType = AuthorizationUtils.getThriftPrincipalType(grantor.getType());
Hive hive = Hive.getWithFastCheck(this.conf);
for (HivePrincipal principal : principals) {
PrincipalType principalType = AuthorizationUtils.getThriftPrincipalType(principal.getType());
String userName = principal.getName();
for (String roleName : roles) {
if (isGrant) {
hive.grantRole(roleName, userName, principalType,
grantor.getName(), grantorType, grantOption);
} else {
hive.revokeRole(roleName, userName, principalType, grantOption);
}
}
}
}
代码示例来源:origin: apache/drill
private void grantOrRevokeRole(List<HivePrincipal> principals, List<String> roles,
boolean grantOption, HivePrincipal grantor, boolean isGrant) throws HiveException {
PrincipalType grantorType = AuthorizationUtils.getThriftPrincipalType(grantor.getType());
Hive hive = Hive.getWithFastCheck(this.conf);
for (HivePrincipal principal : principals) {
PrincipalType principalType = AuthorizationUtils.getThriftPrincipalType(principal.getType());
String userName = principal.getName();
for (String roleName : roles) {
if (isGrant) {
hive.grantRole(roleName, userName, principalType,
grantor.getName(), grantorType, grantOption);
} else {
hive.revokeRole(roleName, userName, principalType, grantOption);
}
}
}
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
private void grantOrRevokeRole(List<HivePrincipal> principals, List<String> roles,
boolean grantOption, HivePrincipal grantor, boolean isGrant) throws HiveException {
PrincipalType grantorType = AuthorizationUtils.getThriftPrincipalType(grantor.getType());
for (HivePrincipal principal : principals) {
PrincipalType principalType = AuthorizationUtils.getThriftPrincipalType(principal.getType());
String userName = principal.getName();
for (String roleName : roles) {
if (isGrant) {
hive.grantRole(roleName, userName, principalType,
grantor.getName(), grantorType, grantOption);
} else {
hive.revokeRole(roleName, userName, principalType, grantOption);
}
}
}
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
private int grantOrRevokeRole(GrantRevokeRoleDDL grantOrRevokeRoleDDL)
throws HiveException {
try {
boolean grantRole = grantOrRevokeRoleDDL.getGrant();
List<PrincipalDesc> principals = grantOrRevokeRoleDDL.getPrincipalDesc();
List<String> roles = grantOrRevokeRoleDDL.getRoles();
for (PrincipalDesc principal : principals) {
String userName = principal.getName();
for (String roleName : roles) {
if (grantRole) {
db.grantRole(roleName, userName, principal.getType(),
grantOrRevokeRoleDDL.getGrantor(), grantOrRevokeRoleDDL
.getGrantorType(), grantOrRevokeRoleDDL.isGrantOption());
} else {
db.revokeRole(roleName, userName, principal.getType());
}
}
}
} catch (Exception e) {
throw new HiveException(e);
}
return 0;
}
内容来源于网络,如有侵权,请联系作者删除!