ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject [2/2] incubator-ranger git commit: Ranger-201: Additional Change after to FileSourceUserGroupBuilder and file format documentation
Date Thu, 08 Jan 2015 19:46:52 GMT
Ranger-201: Additional Change after to FileSourceUserGroupBuilder and file format documentation


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

Branch: refs/heads/master
Commit: ef152319198af7689ebf8838e90a5c7fa8a0dbd4
Parents: 21152a5
Author: rmani <rmani@hortonworks.com>
Authored: Thu Jan 8 11:45:39 2015 -0800
Committer: rmani <rmani@hortonworks.com>
Committed: Thu Jan 8 11:45:39 2015 -0800

----------------------------------------------------------------------
 .../process/FileSourceUserGroupBuilder.java     | 13 ++++++-------
 .../conf.dist/unixauthservice.properties        | 20 +++++++++++++++++---
 2 files changed, 23 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/ef152319/ugsync/src/main/java/org/apache/ranger/unixusersync/process/FileSourceUserGroupBuilder.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/process/FileSourceUserGroupBuilder.java
b/ugsync/src/main/java/org/apache/ranger/unixusersync/process/FileSourceUserGroupBuilder.java
index af18fa1..312f383 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/process/FileSourceUserGroupBuilder.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/process/FileSourceUserGroupBuilder.java
@@ -188,18 +188,17 @@ public class FileSourceUserGroupBuilder  implements UserGroupSource
{
 			for(CSVRecord csvRecord : csvRecordList) {
 				List<String> groups = new ArrayList<String>();
 				String user = csvRecord.get(0);
-				if ( (user.substring(0,1).equals("\"")) && (user.substring(user.length()-1)).equals("\""))
{
-					user = user.substring(1,user.length()-1);
-				} 
+				
+				user = user.replaceAll("^\"|\"$", "");
 					
 				int i = csvRecord.size();
 				
 				for (int j = 1; j < i; j ++) {
 					String group = csvRecord.get(j);
-					if ( (group.substring(0,1).equals("\"")) && (group.substring(group.length()-1)).equals("\""))
{
-						group = group.substring(1,group.length()-1);
-					} 
-					groups.add(group);
+					if ( group != null && !group.isEmpty()) {
+						 group = group.replaceAll("^\"|\"$", ""); 
+						 groups.add(group);
+					}
 				}
 				ret.put(user,groups);
 			 } 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/ef152319/unixauthservice/conf.dist/unixauthservice.properties
----------------------------------------------------------------------
diff --git a/unixauthservice/conf.dist/unixauthservice.properties b/unixauthservice/conf.dist/unixauthservice.properties
index 680b53f..b45a426 100644
--- a/unixauthservice/conf.dist/unixauthservice.properties
+++ b/unixauthservice/conf.dist/unixauthservice.properties
@@ -85,11 +85,25 @@ usergroupSync.source.impl.class =
 # The following properties are relevant
 # only if value of usergroupSync.source.impl.class is
 # org.apache.ranger.unixusersync.process.FileSourceUserGroupBuilder
-# e.g usergroupSync.filesource.file = /tmp/usergroup.json or /tmp/usergroup.txt
-# if the file is .txt usergroupSync.filesource.text.delimiter will be used.
-# if the file is .json JSONParser will be used instead of delimiter.
+# usergroupSync.filesource.file property holds the path of the UserGroup Map file to be submmited.
+# e.g usergroupSync.filesource.file = /tmp/usergroup.json or /tmp/usergroup.csv or /tmp/usergroup.txt
+# JSON File Format: 
+#	{
+#	 {"user1":["group0","group18","group6","group7","group26","group24","group19","group3","group5"]},
+#	 {"user2":["group0","group18","group6","]},
+#	 {"user3":[]},
+#	 {"user4":["group0","group18"]}
+# 	}
+# Text File Format:(.txt,.csv).Delimiter for the text file can be anything like tab, comma
or any desired delimiter.
 # default delimiter value : ,
+# File Format:
+#	"user1","group0","group18","group6","group7","group26","group24","group19","group3","group5"
+#	"user2","group0","group18","group6"
+#	"user3",
+#	"user4","group0","group18"
+# usergroupSync.filesource.text.delimiter property should have the right delimiter if the
file delimiter is other than ,
 # e.g To input a tab delimited file use usergroupSync.filesource.text.delimiter = \t 
+# if the file is .json JSONParser will be used instead of delimiter.
 # ---------------------------------------------------------------
 usergroupSync.filesource.file =
 usergroupSync.filesource.text.delimiter = ,


Mime
View raw message