@Override public int compare(HivePrivilegeInfo o1, HivePrivilegeInfo o2) { int compare = o1.getObject().compareTo(o2.getObject()); if (compare == 0) { compare = o1.getPrincipal().compareTo(o2.getPrincipal()); } if (compare == 0) { compare = o1.getPrivilege().compareTo(o2.getPrivilege()); } return compare; } });
@Override public List<String> filterDatabases(List<String> dbList) throws MetaException { List<HivePrivilegeObject> listObjs = HivePrivilegeObjectUtils.getHivePrivDbObjects(dbList); return getDbNames(getFilteredObjects(listObjs)); }
@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); } }
private HiveAuthzSessionContext getHS2SessionCtx() { Builder ctxBuilder = new HiveAuthzSessionContext.Builder(); ctxBuilder.setClientType(CLIENT_TYPE.HIVESERVER2); return ctxBuilder.build(); }
@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); } }
/** * Create HivePrivilegeObject of type {@link HivePrivilegeObjectType.COMMAND_PARAMS} * @param cmdParams * @return */ public static HivePrivilegeObject createHivePrivilegeObject(List<String> cmdParams) { return new HivePrivilegeObject(HivePrivilegeObjectType.COMMAND_PARAMS, null, null, null, null, cmdParams); }
@Override public List<String> filterTableNames(String catName, String dbName, List<String> tableList) throws MetaException { List<HivePrivilegeObject> listObjs = getHivePrivObjects(dbName, tableList); return getTableNames(getFilteredObjects(listObjs)); }
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 List<HiveRoleGrant> getPrincipalGrantInfoForRole(String roleName) throws HiveAuthzPluginException, HiveAccessControlException { return accessController.getPrincipalGrantInfoForRole(roleName); }
@Override public void grantPrivileges(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges, HivePrivilegeObject hivePrivObject, HivePrincipal grantorPrincipal, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { accessController.grantPrivileges(hivePrincipals, hivePrivileges, hivePrivObject, grantorPrincipal, grantOption); }
@Override public void grantRole(List<HivePrincipal> hivePrincipals, List<String> roles, boolean grantOption, HivePrincipal grantorPrinc) throws HiveAuthzPluginException, HiveAccessControlException { accessController.grantRole(hivePrincipals, roles, grantOption, grantorPrinc); }
@Override public List<HiveRoleGrant> getRoleGrantInfoForPrincipal(HivePrincipal principal) throws HiveAuthzPluginException, HiveAccessControlException { return accessController.getRoleGrantInfoForPrincipal(principal); }
@Override public int compare(HivePrivilegeInfo o1, HivePrivilegeInfo o2) { int compare = o1.getObject().compareTo(o2.getObject()); if (compare == 0) { compare = o1.getPrincipal().compareTo(o2.getPrincipal()); } if (compare == 0) { compare = o1.getPrivilege().compareTo(o2.getPrivilege()); } return compare; } });
@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 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 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 revokePrivileges( List<HivePrincipal> principals, List<HivePrivilege> privileges, HivePrivilegeObject privObject, HivePrincipal grantor, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { try { PrivilegeBag privBag = toPrivilegeBag(privileges, privObject, grantor, grantOption); grantOrRevokePrivs(principals, privBag, false, grantOption); } catch (Exception e) { throw new HiveAuthzPluginException(e); } }
@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 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"); }