ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gau...@apache.org
Subject incubator-ranger git commit: RANGER-1213: No check for wrong ROLEs set on a user
Date Fri, 23 Dec 2016 11:18:20 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/master 57c88b548 -> 4a565dfbc


RANGER-1213: No check for wrong ROLEs set on a user

Signed-off-by: Gautam Borad <gautam@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/4a565dfb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/4a565dfb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/4a565dfb

Branch: refs/heads/master
Commit: 4a565dfbc6661ea74abd70aed4d02e5bbe50bcf6
Parents: 57c88b5
Author: pradeep agrawal <pradeep.agrawal@freestoneinfotech.com>
Authored: Mon Dec 19 14:01:52 2016 +0530
Committer: Gautam Borad <gautam@apache.org>
Committed: Fri Dec 23 16:48:05 2016 +0530

----------------------------------------------------------------------
 .../src/main/java/org/apache/ranger/biz/UserMgr.java        | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a565dfb/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
index 3f6e2cc..925c0e5 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
@@ -317,7 +317,11 @@ public class UserMgr {
 		if (rolesList == null || rolesList.size() == 0) {
 			return false;
 		}
-
+                for (String userRole : rolesList) {
+                        if(!VALID_ROLE_LIST.contains(userRole.toUpperCase())){
+                                throw restErrorUtil.createRESTException("Invalid user role,
please provide valid user role.",MessageEnums.INVALID_INPUT_DATA);
+                        }
+                }
 		// Let's first delete old roles
 		List<XXPortalUserRole> gjUserRoles = daoManager.getXXPortalUserRole()
 				.findByUserId(userId);
@@ -984,6 +988,9 @@ public class UserMgr {
 			}
 		}
 		XXPortalUserRole userRoleObj = new XXPortalUserRole();
+                if(!VALID_ROLE_LIST.contains(userRole.toUpperCase())){
+                        throw restErrorUtil.createRESTException("Invalid user role, please
provide valid user role.",MessageEnums.INVALID_INPUT_DATA);
+                }
 		userRoleObj.setUserRole(userRole.toUpperCase());
 		userRoleObj.setUserId(userId);
 		userRoleObj.setStatus(RangerConstants.STATUS_ENABLED);


Mime
View raw message