ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sneet...@apache.org
Subject git commit: ARGUS-80:Added ability to search policies by status
Date Wed, 24 Sep 2014 01:41:06 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master 1d6351a67 -> 609abd8c5


ARGUS-80:Added ability to search policies by status

Signed-off-by: sneethiraj <sneethir@apache.org>


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

Branch: refs/heads/master
Commit: 609abd8c5fd9671a4d0904b06a5d31761b7427b7
Parents: 1d6351a
Author: vperiasamy <vperiasamy@hortonworks.com>
Authored: Tue Sep 23 18:32:10 2014 -0400
Committer: sneethiraj <sneethir@apache.org>
Committed: Tue Sep 23 21:40:50 2014 -0400

----------------------------------------------------------------------
 .../main/java/com/xasecure/rest/PublicAPIs.java  | 19 +++++++++++++++++++
 .../com/xasecure/service/XResourceService.java   |  2 ++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/609abd8c/security-admin/src/main/java/com/xasecure/rest/PublicAPIs.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/rest/PublicAPIs.java b/security-admin/src/main/java/com/xasecure/rest/PublicAPIs.java
index 080d352..15e3ad8 100644
--- a/security-admin/src/main/java/com/xasecure/rest/PublicAPIs.java
+++ b/security-admin/src/main/java/com/xasecure/rest/PublicAPIs.java
@@ -20,6 +20,8 @@
  package com.xasecure.rest;
 
 import java.util.ArrayList;
+import java.util.List;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -44,6 +46,7 @@ import com.xasecure.common.MessageEnums;
 import com.xasecure.common.RESTErrorUtil;
 import com.xasecure.common.SearchCriteria;
 import com.xasecure.common.StringUtil;
+import com.xasecure.common.XACommonEnums;
 import com.xasecure.common.XAConstants;
 import com.xasecure.common.XASearchUtil;
 import com.xasecure.common.annotation.XAAnnotationClassName;
@@ -279,6 +282,22 @@ public class PublicAPIs {
 				"User Name", StringUtil.VALIDATION_TEXT);
 		searchUtil.extractString(request, searchCriteria, "repositoryName",
 				"Repository Name", StringUtil.VALIDATION_TEXT);
+		
+		String resStatus = request.getParameter("isEnabled");
+		List<Integer> resList = new ArrayList<Integer>();
+		if (stringUtil.isEmpty(resStatus)) {
+			resList.add(XACommonEnums.STATUS_ENABLED);
+			resList.add(XACommonEnums.STATUS_DISABLED);
+		} else {
+			boolean policyStatus = restErrorUtil.parseBoolean(resStatus,
+					"Invalid value for " + "isEnabled",
+					MessageEnums.INVALID_INPUT_DATA, null, "isEnabled");
+			int policyStat = (policyStatus) ? XACommonEnums.STATUS_ENABLED
+					: XACommonEnums.STATUS_DISABLED;
+			resList.add(policyStat);
+		}
+		searchCriteria.getParamList().put("resourceStatus", resList);
+		
 		searchCriteria.setDistinct(true);
 
 		VXResourceList vXResourceList = assetMgr

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/609abd8c/security-admin/src/main/java/com/xasecure/service/XResourceService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XResourceService.java b/security-admin/src/main/java/com/xasecure/service/XResourceService.java
index 4485c1b..c6f95a9 100644
--- a/security-admin/src/main/java/com/xasecure/service/XResourceService.java
+++ b/security-admin/src/main/java/com/xasecure/service/XResourceService.java
@@ -167,6 +167,8 @@ public class XResourceService extends
 		searchFields.add(new SearchField("repositoryName", "xxAsset.name",
 				DATA_TYPE.STRING, SEARCH_TYPE.PARTIAL, "XXAsset xxAsset",
 				"xxAsset.id = obj.assetId"));
+		searchFields.add(new SearchField("resourceStatus",
+				"obj.resourceStatus", DATA_TYPE.INT_LIST, SEARCH_TYPE.FULL));
 
 		sortFields.add(new SortField("name", "obj.name"));
 		sortFields.add(new SortField("isRecursive", "obj.isRecursive"));


Mime
View raw message