ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sneet...@apache.org
Subject git commit: ARGUS-57:Fixed-Search-in-public-REST-API
Date Tue, 16 Sep 2014 15:07:33 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master e3f255e6e -> 57c364586


ARGUS-57:Fixed-Search-in-public-REST-API

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/57c36458
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/57c36458
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/57c36458

Branch: refs/heads/master
Commit: 57c364586116c9a7634c03671d5cbf22848df714
Parents: e3f255e
Author: vperiasamy <vperiasamy@hortonworks.com>
Authored: Mon Sep 15 20:20:03 2014 -0400
Committer: sneethiraj <sneethir@apache.org>
Committed: Tue Sep 16 11:07:19 2014 -0400

----------------------------------------------------------------------
 .../main/java/com/xasecure/rest/PublicAPIs.java  | 19 +++++++++++++++++--
 .../java/com/xasecure/service/XAssetService.java |  6 ++++++
 .../com/xasecure/service/XPolicyService.java     |  5 +++++
 .../com/xasecure/service/XResourceService.java   |  5 ++++-
 4 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/57c36458/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 320f23f..fd07166 100644
--- a/security-admin/src/main/java/com/xasecure/rest/PublicAPIs.java
+++ b/security-admin/src/main/java/com/xasecure/rest/PublicAPIs.java
@@ -39,9 +39,11 @@ import org.springframework.transaction.annotation.Transactional;
 
 import com.xasecure.biz.AssetMgr;
 import com.xasecure.common.AppConstants;
+import com.xasecure.common.MessageEnums;
 import com.xasecure.common.RESTErrorUtil;
 import com.xasecure.common.SearchCriteria;
 import com.xasecure.common.StringUtil;
+import com.xasecure.common.XAConstants;
 import com.xasecure.common.XASearchUtil;
 import com.xasecure.common.annotation.XAAnnotationClassName;
 import com.xasecure.common.annotation.XAAnnotationJSMgrName;
@@ -157,6 +159,11 @@ public class PublicAPIs {
 				request, xAssetService.sortFields);
 		searchUtil.extractString(request, searchCriteria, "name",
 				"Repository Name", null);
+		searchUtil.extractBoolean(request, searchCriteria, "status",
+				"Activation Status");
+		searchUtil.extractString(request, searchCriteria, "type",
+				"Repository Type", null);
+
 		searchCriteria = xRepositoryService.getMappedSearchParams(request,
 				searchCriteria);
 		VXAssetList vXAssetList = assetMgr.searchXAssets(searchCriteria);
@@ -251,8 +258,16 @@ public class PublicAPIs {
 					AppConstants.getEnumFor_AssetType(repositoryType));
 		}
 
-		searchUtil.extractInt(request, searchCriteria, "isRecursive",
-				"Is Recursive");
+		String isRec = request.getParameter("isRecursive");
+		if (isRec != null) {
+			boolean isRecursiveBool = restErrorUtil.parseBoolean(isRec,
+					"Invalid value for " + "isRecursive",
+					MessageEnums.INVALID_INPUT_DATA, null, "isRecursive");
+			int isRecursive = (isRecursiveBool == true) ? XAConstants.BOOL_TRUE
+					: XAConstants.BOOL_FALSE;
+			searchCriteria.getParamList().put("isRecursive", isRecursive);
+		}
+			
 		searchUtil.extractString(request, searchCriteria, "userName",
 				"User Name", StringUtil.VALIDATION_TEXT);
 		searchUtil.extractString(request, searchCriteria, "repositoryName",

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/57c36458/security-admin/src/main/java/com/xasecure/service/XAssetService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XAssetService.java b/security-admin/src/main/java/com/xasecure/service/XAssetService.java
index b3dc2e5..5463817 100644
--- a/security-admin/src/main/java/com/xasecure/service/XAssetService.java
+++ b/security-admin/src/main/java/com/xasecure/service/XAssetService.java
@@ -32,6 +32,8 @@ import com.xasecure.common.JSONUtil;
 import com.xasecure.common.MessageEnums;
 import com.xasecure.common.PropertiesUtil;
 import com.xasecure.common.SearchField;
+import com.xasecure.common.SearchField.DATA_TYPE;
+import com.xasecure.common.SearchField.SEARCH_TYPE;
 import com.xasecure.common.StringUtil;
 import com.xasecure.entity.*;
 
@@ -78,6 +80,10 @@ public class XAssetService extends XAssetServiceBase<XXAsset, VXAsset>
{
 		hiddenPasswordString = PropertiesUtil.getProperty("xa.password.hidden", "*****");
 		searchFields.add(new SearchField("status", "obj.activeStatus",
 				SearchField.DATA_TYPE.INT_LIST, SearchField.SEARCH_TYPE.FULL));
+		searchFields.add(new SearchField("name", "obj.name", DATA_TYPE.STRING,
+				SEARCH_TYPE.PARTIAL));
+		searchFields.add(new SearchField("type", "obj.assetType",
+				DATA_TYPE.INTEGER, SEARCH_TYPE.FULL));
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/57c36458/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 a643e3b..73ec978 100644
--- a/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
+++ b/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
@@ -288,6 +288,7 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 		}
 		for (VXPermObj permObj : permObjList) {
 			String permGrp = new Date() + " : " + rand.nextInt(9999);
+			String ipAddress = permObj.getIpAddress();
 
 			if (!stringUtil.isEmpty(permObj.getUserList())) {
 				int permFor = AppConstants.XA_PERM_FOR_USER;
@@ -312,6 +313,7 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 						vXPermMap.setPermType(permType);
 						vXPermMap.setUserId(xxUser.getId());
 						vXPermMap.setResourceId(resId);
+						vXPermMap.setIpAddress(ipAddress);
 						permMapList.add(vXPermMap);
 
 						StringBuilder uniqueKey = new StringBuilder();
@@ -348,6 +350,7 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 						vXPermMap.setPermType(permType);
 						vXPermMap.setGroupId(xxGroup.getId());
 						vXPermMap.setResourceId(resId);
+						vXPermMap.setIpAddress(ipAddress);
 						permMapList.add(vXPermMap);
 
 						StringBuilder uniqueKey = new StringBuilder();
@@ -371,6 +374,8 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 				} else {
 					VXPermMap vPMap = xPermMapService
 							.populateViewBean(prevPermMap.get(entry.getKey()));
+					VXPermMap vPMapNew = entry.getValue();
+					vPMap.setIpAddress(vPMapNew.getIpAddress());
 					updPermMapList.add(vPMap);
 				}
 			}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/57c36458/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 9b4f05b..e6081dc 100644
--- a/security-admin/src/main/java/com/xasecure/service/XResourceService.java
+++ b/security-admin/src/main/java/com/xasecure/service/XResourceService.java
@@ -132,7 +132,7 @@ public class XResourceService extends
 
 		searchFields.add(new SearchField("userName", "xUser.name",
 				SearchField.DATA_TYPE.STRING, SearchField.SEARCH_TYPE.PARTIAL,
-				"XXPermMap xxPermMap, XUser xUser", "xxPermMap.resourceId "
+				"XXPermMap xxPermMap, XXUser xUser", "xxPermMap.resourceId "
 						+ "= obj.id and xxPermMap.userId = xUser.id"));
 
 		searchFields.add(new SearchField("userId", "xxPermMap.userId",
@@ -157,6 +157,9 @@ public class XResourceService extends
 				DATA_TYPE.INTEGER, SEARCH_TYPE.FULL));
 		searchFields.add(new SearchField("columnType", "obj.columnType",
 				DATA_TYPE.INTEGER, SEARCH_TYPE.FULL));
+		searchFields.add(new SearchField("repositoryName", "xxAsset.name",
+				DATA_TYPE.STRING, SEARCH_TYPE.PARTIAL, "XXAsset xxAsset",
+				"xxAsset.id = obj.assetId"));
 
 		sortFields.add(new SortField("name", "obj.name"));
 		sortFields.add(new SortField("isRecursive", "obj.isRecursive"));


Mime
View raw message