/** * @param roleName * @return true if roleName is the name of one of the roles (including the role hierarchy) * that the user belongs to. * @throws HiveAuthzPluginException */ private boolean userBelongsToRole(String roleName) throws HiveAuthzPluginException { for (HiveRoleGrant role : getRolesFromMS()) { // set to one of the roles user belongs to. if (role.getRoleName().equalsIgnoreCase(roleName)) { return true; } } return false; }
/** * (Re-)initialize currentRoleNames if necessary. * @throws HiveAuthzPluginException */ private void initUserRoles() throws HiveAuthzPluginException { //to aid in testing through .q files, authenticator is passed as argument to // the interface. this helps in being able to switch the user within a session. // so we need to check if the user has changed String newUserName = authenticator.getUserName(); if (Objects.equals(currentUserName, newUserName)) { //no need to (re-)initialize the currentUserName, currentRoles fields return; } this.currentUserName = newUserName; this.currentRoles = getRolesFromMS(); LOG.info("Current user : " + currentUserName + ", Current Roles : " + currentRoles); }
/** * @param roleName * @return true if roleName is the name of one of the roles (including the role hierarchy) * that the user belongs to. * @throws HiveAuthzPluginException */ private boolean userBelongsToRole(String roleName) throws HiveAuthzPluginException { for (HiveRoleGrant role : getRolesFromMS()) { // set to one of the roles user belongs to. if (role.getRoleName().equalsIgnoreCase(roleName)) { return true; } } return false; }
/** * (Re-)initialize currentRoleNames if necessary. * @throws HiveAuthzPluginException */ private void initUserRoles() throws HiveAuthzPluginException { //to aid in testing through .q files, authenticator is passed as argument to // the interface. this helps in being able to switch the user within a session. // so we need to check if the user has changed String newUserName = authenticator.getUserName(); if(currentUserName == newUserName){ //no need to (re-)initialize the currentUserName, currentRoles fields return; } this.currentUserName = newUserName; this.currentRoles = getRolesFromMS(); LOG.info("Current user : " + currentUserName + ", Current Roles : " + currentRoles); }
currentRoles.addAll(getRolesFromMS()); return; for (HiveRoleGrant role : getRolesFromMS()) {
currentRoles.addAll(getRolesFromMS()); return; for (HiveRoleGrant role : getRolesFromMS()) {
/** * @param roleName * @return true if roleName is the name of one of the roles (including the role hierarchy) * that the user belongs to. * @throws HiveAuthzPluginException */ private boolean userBelongsToRole(String roleName) throws HiveAuthzPluginException { for (HiveRoleGrant role : getRolesFromMS()) { // set to one of the roles user belongs to. if (role.getRoleName().equalsIgnoreCase(roleName)) { return true; } } return false; }
currentRoles.addAll(getRolesFromMS()); return; for (HiveRoleGrant role : getRolesFromMS()) {
/** * (Re-)initialize currentRoleNames if necessary. * @throws HiveAuthzPluginException */ private void initUserRoles() throws HiveAuthzPluginException { //to aid in testing through .q files, authenticator is passed as argument to // the interface. this helps in being able to switch the user within a session. // so we need to check if the user has changed String newUserName = authenticator.getUserName(); if(currentUserName == newUserName){ //no need to (re-)initialize the currentUserName, currentRoles fields return; } this.currentUserName = newUserName; this.currentRoles = getRolesFromMS(); LOG.info("Current user : " + currentUserName + ", Current Roles : " + currentRoles); }