@Override public void grantPrivileges(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges, HivePrivilegeObject hivePrivObject, HivePrincipal grantorPrincipal, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); grantorPrincipal = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrincipal); hiveAccessController.grantPrivileges(hivePrincipals, hivePrivileges, hivePrivObject, grantorPrincipal, grantOption); }
/** * Calls getValidatedPrincipal on each principal in list and updates the list * @param hivePrincipals * @return * @return * @throws HiveAuthzPluginException */ public static List<HivePrincipal> getValidatedPrincipals(List<HivePrincipal> hivePrincipals) throws HiveAuthzPluginException { ListIterator<HivePrincipal> it = hivePrincipals.listIterator(); while(it.hasNext()){ it.set(getValidatedPrincipal(it.next())); } return hivePrincipals; }
@Override public void revokePrivileges(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges, HivePrivilegeObject hivePrivObject, HivePrincipal grantorPrincipal, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); grantorPrincipal = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrincipal); hiveAccessController.revokePrivileges(hivePrincipals, hivePrivileges, hivePrivObject, grantorPrincipal, grantOption); }
@Override public List<HivePrivilegeInfo> showPrivileges(HivePrincipal principal, HivePrivilegeObject privObj) throws HiveAuthzPluginException, HiveAccessControlException { // validate principal = SQLAuthorizationUtils.getValidatedPrincipal(principal); return hiveAccessController.showPrivileges(principal, privObj); }
@Override public void revokePrivileges(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges, HivePrivilegeObject hivePrivObject, HivePrincipal grantorPrincipal, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); grantorPrincipal = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrincipal); hiveAccessController.revokePrivileges(hivePrincipals, hivePrivileges, hivePrivObject, grantorPrincipal, grantOption); }
@Override public void createRole(String roleName, HivePrincipal adminGrantor) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals roleName = roleName.toLowerCase(); adminGrantor = SQLAuthorizationUtils.getValidatedPrincipal(adminGrantor); hiveAccessController.createRole(roleName, adminGrantor); }
@Override public void grantPrivileges(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges, HivePrivilegeObject hivePrivObject, HivePrincipal grantorPrincipal, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); grantorPrincipal = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrincipal); hiveAccessController.grantPrivileges(hivePrincipals, hivePrivileges, hivePrivObject, grantorPrincipal, grantOption); }
@Override public List<HiveRoleGrant> getRoleGrantInfoForPrincipal(HivePrincipal principal) throws HiveAuthzPluginException, HiveAccessControlException { // validate principal = SQLAuthorizationUtils.getValidatedPrincipal(principal); return hiveAccessController.getRoleGrantInfoForPrincipal(principal); }
@Override public void grantRole(List<HivePrincipal> hivePrincipals, List<String> roles, boolean grantOption, HivePrincipal grantorPrinc) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); roles = getLowerCaseRoleNames(roles); grantorPrinc = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrinc); hiveAccessController.grantRole(hivePrincipals, roles, grantOption, grantorPrinc); }
/** * Calls getValidatedPrincipal on each principal in list and updates the list * @param hivePrincipals * @return * @return * @throws HiveAuthzPluginException */ public static List<HivePrincipal> getValidatedPrincipals(List<HivePrincipal> hivePrincipals) throws HiveAuthzPluginException { ListIterator<HivePrincipal> it = hivePrincipals.listIterator(); while(it.hasNext()){ it.set(getValidatedPrincipal(it.next())); } return hivePrincipals; }
@Override public void revokeRole(List<HivePrincipal> hivePrincipals, List<String> roles, boolean grantOption, HivePrincipal grantorPrinc) throws HiveAuthzPluginException, HiveAccessControlException { // validate hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); roles = getLowerCaseRoleNames(roles); grantorPrinc = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrinc); hiveAccessController.revokeRole(hivePrincipals, roles, grantOption, grantorPrinc); }
@Override public List<HiveRoleGrant> getRoleGrantInfoForPrincipal(HivePrincipal principal) throws HiveAuthzPluginException, HiveAccessControlException { // validate principal = SQLAuthorizationUtils.getValidatedPrincipal(principal); return hiveAccessController.getRoleGrantInfoForPrincipal(principal); }
@Override public void grantRole(List<HivePrincipal> hivePrincipals, List<String> roles, boolean grantOption, HivePrincipal grantorPrinc) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); roles = getLowerCaseRoleNames(roles); grantorPrinc = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrinc); hiveAccessController.grantRole(hivePrincipals, roles, grantOption, grantorPrinc); }
@Override public void createRole(String roleName, HivePrincipal adminGrantor) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals roleName = roleName.toLowerCase(); adminGrantor = SQLAuthorizationUtils.getValidatedPrincipal(adminGrantor); hiveAccessController.createRole(roleName, adminGrantor); }
@Override public void revokeRole(List<HivePrincipal> hivePrincipals, List<String> roles, boolean grantOption, HivePrincipal grantorPrinc) throws HiveAuthzPluginException, HiveAccessControlException { // validate hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); roles = getLowerCaseRoleNames(roles); grantorPrinc = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrinc); hiveAccessController.revokeRole(hivePrincipals, roles, grantOption, grantorPrinc); }
@Override public List<HivePrivilegeInfo> showPrivileges(HivePrincipal principal, HivePrivilegeObject privObj) throws HiveAuthzPluginException, HiveAccessControlException { // validate principal = SQLAuthorizationUtils.getValidatedPrincipal(principal); return hiveAccessController.showPrivileges(principal, privObj); }
@Override public void grantPrivileges(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges, HivePrivilegeObject hivePrivObject, HivePrincipal grantorPrincipal, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); grantorPrincipal = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrincipal); hiveAccessController.grantPrivileges(hivePrincipals, hivePrivileges, hivePrivObject, grantorPrincipal, grantOption); }
@Override public void createRole(String roleName, HivePrincipal adminGrantor) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals roleName = roleName.toLowerCase(); adminGrantor = SQLAuthorizationUtils.getValidatedPrincipal(adminGrantor); hiveAccessController.createRole(roleName, adminGrantor); }
@Override public void revokePrivileges(List<HivePrincipal> hivePrincipals, List<HivePrivilege> hivePrivileges, HivePrivilegeObject hivePrivObject, HivePrincipal grantorPrincipal, boolean grantOption) throws HiveAuthzPluginException, HiveAccessControlException { // validate principals hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); grantorPrincipal = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrincipal); hiveAccessController.revokePrivileges(hivePrincipals, hivePrivileges, hivePrivObject, grantorPrincipal, grantOption); }
@Override public void revokeRole(List<HivePrincipal> hivePrincipals, List<String> roles, boolean grantOption, HivePrincipal grantorPrinc) throws HiveAuthzPluginException, HiveAccessControlException { // validate hivePrincipals = SQLAuthorizationUtils.getValidatedPrincipals(hivePrincipals); roles = getLowerCaseRoleNames(roles); grantorPrinc = SQLAuthorizationUtils.getValidatedPrincipal(grantorPrinc); hiveAccessController.revokeRole(hivePrincipals, roles, grantOption, grantorPrinc); }