ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sneet...@apache.org
Subject git commit: ARGUS-26:public api mods for specific repo types
Date Fri, 05 Sep 2014 02:49:01 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master 78281ae0d -> 65c4c17f4


ARGUS-26:public api mods for specific repo types

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

Branch: refs/heads/master
Commit: 65c4c17f45abc9d2874967596f10ef251f673d31
Parents: 78281ae
Author: vperiasamy <vperiasamy@hortonworks.com>
Authored: Thu Sep 4 16:35:57 2014 -0400
Committer: sneethiraj <sneethir@apache.org>
Committed: Thu Sep 4 22:48:41 2014 -0400

----------------------------------------------------------------------
 .../java/com/xasecure/common/AppConstants.java  |  5 +-
 .../com/xasecure/service/XPolicyService.java    | 49 ++++++++++++++------
 .../main/java/com/xasecure/view/VXPolicy.java   |  6 +--
 3 files changed, 43 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/65c4c17f/security-admin/src/main/java/com/xasecure/common/AppConstants.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/AppConstants.java b/security-admin/src/main/java/com/xasecure/common/AppConstants.java
index 46519d5..2f0b545 100644
--- a/security-admin/src/main/java/com/xasecure/common/AppConstants.java
+++ b/security-admin/src/main/java/com/xasecure/common/AppConstants.java
@@ -428,9 +428,12 @@ public class AppConstants extends XACommonEnums {
 			return "Hive"; //ASSET_HIVE
 		}
 		if( elementValue == 4 ) {
-			return "Knox"; //ASSET_KNOX
+			return "XAAGENT"; // XAAGENT
 		}
 		if( elementValue == 5 ) {
+			return "Knox"; //ASSET_KNOX
+		}
+		if( elementValue == 6 ) {
 			return "Storm"; //ASSET_STORM
 		}
 		return null;

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/65c4c17f/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 b6dcf14..0122639 100644
--- a/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
+++ b/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
@@ -90,10 +90,7 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 		vXPolicy.setColumns(vXResource.getColumns());
 		vXPolicy.setDatabases(vXResource.getDatabases());
 		vXPolicy.setUdfs(vXResource.getUdfs());
-		vXPolicy.setTableType(AppConstants.getLabelFor_PolicyType(vXResource
-				.getTableType()));
-		vXPolicy.setColumnType(AppConstants.getLabelFor_PolicyType(vXResource
-				.getColumnType()));
+		
 		vXPolicy.setTopologies(vXResource.getTopologies());
 		vXPolicy.setServices(vXResource.getServices());
 
@@ -103,8 +100,6 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 			enable = false;
 		}
 		vXPolicy.setIsEnabled(enable);
-		vXPolicy.setIsRecursive(AppConstants
-				.getBooleanFor_BooleanValue(vXResource.getIsRecursive()));
 
 		boolean auditEnable = true;
 		if (stringUtil.isEmpty(vXResource.getAuditList())) {
@@ -112,6 +107,23 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 		}
 		vXPolicy.setIsAuditEnabled(auditEnable);
 		vXPolicy.setVersion(version);
+		
+		/*
+		 * TODO : These parameters are specific for some components. Need to
+		 * take care while adding new component
+		 */
+		if (vXResource.getAssetType() == AppConstants.ASSET_HIVE) {
+			vXPolicy.setTableType(AppConstants
+					.getLabelFor_PolicyType(vXResource.getTableType()));
+			vXPolicy.setColumnType(AppConstants
+					.getLabelFor_PolicyType(vXResource.getColumnType()));
+		}
+		if (vXResource.getAssetType() == AppConstants.ASSET_HDFS) {
+			vXPolicy.setIsRecursive(AppConstants
+					.getBooleanFor_BooleanValue(vXResource.getIsRecursive()));
+		} else {
+			vXPolicy.setIsRecursive(null);
+		}
 
 		return vXPolicy;
 	}
@@ -196,8 +208,6 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 			}
 		}
 
-		vXResource.setIsRecursive(AppConstants.getEnumFor_BooleanValue(vXPolicy
-				.getIsRecursive()));
 		vXResource.setDatabases(vXPolicy.getDatabases());
 		vXResource.setTables(vXPolicy.getTables());
 		vXResource.setColumnFamilies(vXPolicy.getColumnFamilies());
@@ -216,10 +226,23 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 		vXResource.setCheckParentPermission(AppConstants.BOOL_FALSE);
 		vXResource.setTopologies(vXPolicy.getTopologies());
 		vXResource.setServices(vXPolicy.getServices());
-		vXResource.setTableType(AppConstants.getEnumFor_PolicyType(vXPolicy
-				.getTableType()));
-		vXResource.setColumnType(AppConstants.getEnumFor_PolicyType(vXPolicy
-				.getColumnType()));
+		
+		/*
+		 * TODO : These parameters are specific for some components. Need to
+		 * take care while adding new component
+		 */
+		if (vXPolicy.getRepositoryType().equalsIgnoreCase(
+				AppConstants.getLabelFor_AssetType(AppConstants.ASSET_HIVE))) {
+			vXResource.setTableType(AppConstants.getEnumFor_PolicyType(vXPolicy
+					.getTableType()));
+			vXResource.setColumnType(AppConstants
+					.getEnumFor_PolicyType(vXPolicy.getColumnType()));
+		}
+		if (vXPolicy.getRepositoryType().equalsIgnoreCase(
+				AppConstants.getLabelFor_AssetType(AppConstants.ASSET_HDFS))) {
+			vXResource.setIsRecursive(AppConstants
+					.getEnumFor_BooleanValue(vXPolicy.getIsRecursive()));
+		}
 
 		return vXResource;
 	}
@@ -286,7 +309,7 @@ public class XPolicyService extends PublicAPIServiceBase<VXResource,
VXPolicy> {
 						logger.error("No UserGroup found with this name : "
 								+ group);
 						throw restErrorUtil.createRESTException(
-								"No User found with name : " + group,
+								"No Group found with name : " + group,
 								MessageEnums.DATA_NOT_FOUND);
 					}
 					Long grpId = xxGroup.getId();

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/65c4c17f/security-admin/src/main/java/com/xasecure/view/VXPolicy.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXPolicy.java b/security-admin/src/main/java/com/xasecure/view/VXPolicy.java
index 90fb5c5..339e2b4 100644
--- a/security-admin/src/main/java/com/xasecure/view/VXPolicy.java
+++ b/security-admin/src/main/java/com/xasecure/view/VXPolicy.java
@@ -102,7 +102,7 @@ public class VXPolicy extends VXDataObject implements java.io.Serializable
{
 	/**
 	 * Is recursive This attribute is of type enum CommonEnums::BooleanValue
 	 */
-	protected boolean isRecursive;
+	protected Boolean isRecursive;
 	/**
 	 * Audit is enable or not.
 	 */
@@ -450,7 +450,7 @@ public class VXPolicy extends VXDataObject implements java.io.Serializable
{
 	 * @param isRecursive
 	 *            Value to set member attribute <b>isRecursive</b>
 	 */
-	public void setIsRecursive(boolean isRecursive) {
+	public void setIsRecursive(Boolean isRecursive) {
 		this.isRecursive = isRecursive;
 	}
 
@@ -459,7 +459,7 @@ public class VXPolicy extends VXDataObject implements java.io.Serializable
{
 	 * 
 	 * @return boolean - value of member attribute <b>isRecursive</b>.
 	 */
-	public boolean getIsRecursive() {
+	public Boolean getIsRecursive() {
 		return this.isRecursive;
 	}
 


Mime
View raw message