ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sneet...@apache.org
Subject git commit: ARGUS-18: knox default policy creation has been added
Date Fri, 22 Aug 2014 06:58:42 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master 704f62614 -> ef29bfa3e


ARGUS-18:  knox default policy creation has been added


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

Branch: refs/heads/master
Commit: ef29bfa3e86718c4e858b9efe78ea224d6d87b68
Parents: 704f626
Author: sneethiraj <sneethir@apache.org>
Authored: Thu Aug 21 22:56:41 2014 -0700
Committer: sneethiraj <sneethir@apache.org>
Committed: Thu Aug 21 22:56:41 2014 -0700

----------------------------------------------------------------------
 .../main/java/com/xasecure/biz/AssetMgr.java    | 22 ++++++++++++++++++++
 .../com/xasecure/service/XPolicyService.java    |  5 -----
 2 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ef29bfa3/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java b/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
index ecf90e0..ac31fa6 100644
--- a/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
+++ b/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
@@ -11,6 +11,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Random;
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.concurrent.Callable;
@@ -1186,6 +1187,27 @@ public class AssetMgr extends AssetMgrBase {
 			vXPermMap.setUserId(vXUser.getId());
 			vXPermMap.setResourceId(vXResource.getId());
 			xPermMapService.createResource(vXPermMap);
+			
+			if (assetType == AppConstants.ASSET_KNOX) {
+				Random rand = new Random();
+				String permGroup = new Date() + " : " + rand.nextInt(9999);
+
+				VXPermMap permAdmin = new VXPermMap();
+				permAdmin.setPermFor(AppConstants.XA_PERM_FOR_USER);
+				permAdmin.setPermType(AppConstants.XA_PERM_TYPE_ADMIN);
+				permAdmin.setUserId(vXUser.getId());
+				permAdmin.setPermGroup(permGroup);
+				permAdmin.setResourceId(vXResource.getId());
+				xPermMapService.createResource(permAdmin);
+
+				VXPermMap permAllow = new VXPermMap();
+				permAllow.setPermFor(AppConstants.XA_PERM_FOR_USER);
+				permAllow.setPermType(AppConstants.XA_PERM_TYPE_ALLOW);
+				permAllow.setUserId(vXUser.getId());
+				permAllow.setPermGroup(permGroup);
+				permAllow.setResourceId(vXResource.getId());
+				xPermMapService.createResource(permAllow);
+			}
 		}
 		
 		VXAuditMap vXAuditMap = new VXAuditMap();

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ef29bfa3/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XPolicyService.java b/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
index 41eb768..82d05f6 100644
--- a/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
+++ b/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
@@ -230,7 +230,6 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 					}
 				}
 			}
-
 		}
 		return permMapList;
 	}
@@ -260,13 +259,9 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 
 			for (VXPermMap permMap : entry.getValue()) {
 				if (permMap.getPermFor() == AppConstants.XA_PERM_FOR_USER) {
-					// if (!userList.contains(permMap.getUserName())) {
 					userList.add(permMap.getUserName());
-					// }
 				} else if (permMap.getPermFor() == AppConstants.XA_PERM_FOR_GROUP) {
-					// if (!groupList.contains(permMap.getGroupName())) {
 					groupList.add(permMap.getGroupName());
-					// }
 				}
 				permList.add(AppConstants.getLabelFor_XAPermType(permMap
 						.getPermType()));


Mime
View raw message