private static void throwGetObjErr(Exception e, HivePrivilegeObject hivePrivObject) throws HiveAuthzPluginException { String msg = "Error getting object from metastore for " + hivePrivObject; throw new HiveAuthzPluginException(msg, e); }
@Override public void grantPrivileges(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges, HivePrivilegeObject hivePrivObject, HivePrincipal grantorPrincipal, boolean grantOption) throws HiveAuthzPluginException { throw new HiveAuthzPluginException("grantPrivileges not implemented in FallbackHiveAuthorizer"); }
@Override public void grantRole(List<HivePrincipal> hivePrincipals, List<String> roles, boolean grantOption, HivePrincipal grantorPrinc) throws HiveAuthzPluginException, HiveAccessControlException { throw new HiveAuthzPluginException("grantRole not implemented in FallbackHiveAuthorizer"); }
@Override public List<HiveRoleGrant> getRoleGrantInfoForPrincipal(HivePrincipal principal) throws HiveAuthzPluginException, HiveAccessControlException { throw new HiveAuthzPluginException("getRoleGrantInfoForPrincipal not implemented in FallbackHiveAuthorizer"); }
@Override public void revokePrivileges(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges, HivePrivilegeObject hivePrivObject, HivePrincipal grantorPrincipal, boolean grantOption) throws HiveAuthzPluginException { throw new HiveAuthzPluginException("revokePrivileges not implemented in FallbackHiveAuthorizer"); }
@Override public List<HiveRoleGrant> getPrincipalGrantInfoForRole(String roleName) throws HiveAuthzPluginException, HiveAccessControlException { throw new HiveAuthzPluginException("getPrincipalGrantInfoForRole not implemented in FallbackHiveAuthorizer"); }
@Override public void revokeRole(List<HivePrincipal> hivePrincipals, List<String> roles, boolean grantOption, HivePrincipal grantorPrinc) throws HiveAuthzPluginException, HiveAccessControlException { throw new HiveAuthzPluginException("revokeRole not implemented in FallbackHiveAuthorizer"); }
@Override public List<HivePrivilegeInfo> showPrivileges(HivePrincipal principal, HivePrivilegeObject privObj) throws HiveAuthzPluginException { throw new HiveAuthzPluginException("showPrivileges not implemented in FallbackHiveAuthorizer"); }
private static void throwGetPrivErr(Exception e, HivePrivilegeObject hivePrivObject, String userName) throws HiveAuthzPluginException { String msg = "Error getting privileges on " + hivePrivObject + " for " + userName + ": " + e.getMessage(); throw new HiveAuthzPluginException(msg, e); }
public static SQLPrivilegeType getRequirePrivilege(String priv) throws HiveAuthzPluginException { SQLPrivilegeType reqPriv; if(priv == null){ throw new HiveAuthzPluginException("Null privilege obtained"); } try { reqPriv = SQLPrivilegeType.valueOf(priv.toUpperCase(Locale.US)); } catch (IllegalArgumentException e) { throw new HiveAuthzPluginException("Unsupported privilege type " + priv, e); } return reqPriv; }
static PrivilegeGrantInfo getThriftPrivilegeGrantInfo(HivePrivilege privilege, HivePrincipal grantorPrincipal, boolean grantOption, int grantTime) throws HiveAuthzPluginException { try { return AuthorizationUtils.getThriftPrivilegeGrantInfo(privilege, grantorPrincipal, grantOption, grantTime); } catch (HiveException e) { throw new HiveAuthzPluginException(e); } }
@Override public void grantRole(List<HivePrincipal> principals, List<String> roles, boolean grantOption, HivePrincipal grantor) throws HiveAuthzPluginException, HiveAccessControlException { try { grantOrRevokeRole(principals, roles, grantOption, grantor, true); } catch (HiveException e) { throw new HiveAuthzPluginException(e); } }
@Override public void revokeRole(List<HivePrincipal> principals, List<String> roles, boolean grantOption, HivePrincipal grantor) throws HiveAuthzPluginException, HiveAccessControlException { try { grantOrRevokeRole(principals, roles, grantOption, grantor, false); } catch (HiveException e) { throw new HiveAuthzPluginException(e); } }
@Override public IMetaStoreClient getHiveMetastoreClient() throws HiveAuthzPluginException { String errMsg = "Error getting metastore client"; try { return Hive.get().getMSC(); } catch (MetaException e) { throw new HiveAuthzPluginException(errMsg, e); } catch (HiveException e) { throw new HiveAuthzPluginException(errMsg, e); } }
@Override public void dropRole(String roleName) throws HiveAuthzPluginException, HiveAccessControlException { try { Hive hive = Hive.getWithFastCheck(this.conf); hive.dropRole(roleName); } catch (HiveException e) { throw new HiveAuthzPluginException(e); } }
@Override public List<String> getAllRoles() throws HiveAuthzPluginException, HiveAccessControlException { try { Hive hive = Hive.getWithFastCheck(this.conf); return hive.getAllRoleNames(); } catch (HiveException e) { throw new HiveAuthzPluginException(e); } }
@Override public void grantPrivileges( List<HivePrincipal> principals, List<HivePrivilege> privileges, HivePrivilegeObject privObject, HivePrincipal grantor, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { try { PrivilegeBag privBag = toPrivilegeBag(privileges, privObject, grantor, grantOption, AUTHORIZER); grantOrRevokePrivs(principals, privBag, true, grantOption); } catch (Exception e) { throw new HiveAuthzPluginException(e); } }
@Override public void revokePrivileges( List<HivePrincipal> principals, List<HivePrivilege> privileges, HivePrivilegeObject privObject, HivePrincipal grantor, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { try { PrivilegeBag privBag = toPrivilegeBag(privileges, privObject, grantor, grantOption, AUTHORIZER); grantOrRevokePrivs(principals, privBag, false, grantOption); } catch (Exception e) { throw new HiveAuthzPluginException(e); } }
@Override public void createRole(String roleName, HivePrincipal adminGrantor) throws HiveAuthzPluginException, HiveAccessControlException { try { Hive hive = Hive.getWithFastCheck(this.conf); hive.createRole(roleName, adminGrantor == null ? null : adminGrantor.getName()); } catch (HiveException e) { throw new HiveAuthzPluginException(e); } }
@Override public List<HiveRoleGrant> getPrincipalGrantInfoForRole(String roleName) throws HiveAuthzPluginException, HiveAccessControlException { try { Hive hive = Hive.getWithFastCheck(this.conf); return SQLStdHiveAccessController.getHiveRoleGrants(hive.getMSC(), roleName); } catch (Exception e) { throw new HiveAuthzPluginException(e); } }