This is an automated email from the ASF dual-hosted git repository. pradeep pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push: new 5d12723 Revert "RANGER-3135: optimze log print for querying roles" 5d12723 is described below commit 5d1272335156dfc6d32862c6ee9af2e92b087169 Author: pradeep <prad...@apache.org> AuthorDate: Thu Nov 25 09:34:23 2021 +0530 Revert "RANGER-3135: optimze log print for querying roles" This reverts commit 5797bb9541c1bfa84fbfd9bd19dbd635c4928b6f. --- .../main/java/org/apache/ranger/rest/RoleREST.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/security-admin/src/main/java/org/apache/ranger/rest/RoleREST.java b/security-admin/src/main/java/org/apache/ranger/rest/RoleREST.java index 11df6b7..79978b5 100644 --- a/security-admin/src/main/java/org/apache/ranger/rest/RoleREST.java +++ b/security-admin/src/main/java/org/apache/ranger/rest/RoleREST.java @@ -289,9 +289,6 @@ public class RoleREST { if (ret == null) { throw restErrorUtil.createRESTException("User doesn't have permissions to get details for " + roleName); } - if (ret.getName() == null) { - throw restErrorUtil.createRESTException("Role with name: " + roleName + " does not exist"); - } } catch(WebApplicationException excp) { throw excp; @@ -943,17 +940,16 @@ public class RoleREST { effectiveUser = loggedInUser; } try { - existingRole = roleStore.getRole(roleName); - if (!ensureRoleAccess(effectiveUser, userGroups, existingRole)) { - LOG.error("User does not have permission for this operation"); - return null; - } - } catch (Exception ex) { - if (bizUtil.isUserRangerAdmin(effectiveUser)) { - return new RangerRole(); + if (!bizUtil.isUserRangerAdmin(effectiveUser)) { + existingRole = roleStore.getRole(roleName); + ensureRoleAccess(effectiveUser, userGroups, existingRole); + } else { - return null; + existingRole = roleStore.getRole(roleName); } + } catch (Exception ex) { + LOG.error(ex.getMessage()); + return null; } return existingRole;