This is an automated email from the ASF dual-hosted git repository.

spolavarapu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new 224e5fb  Introduce new column syncSource for Ranger UI
224e5fb is described below

commit 224e5fb50055929d506f7554c1b27ed8d081f5d2
Author: abhishek.kumar <[email protected]>
AuthorDate: Thu Aug 5 14:57:57 2021 -0700

    Introduce new column syncSource for Ranger UI
    
    Signed-off-by: Sailaja Polavarapu <[email protected]>
---
 .../optimized/current/ranger_core_db_mysql.sql     |  4 +++
 ...cSource-col-in-x_user-x_portal_user-x_group.sql | 38 ++++++++++++++++++++
 .../optimized/current/ranger_core_db_oracle.sql    |  4 +++
 ...cSource-col-in-x_user-x_portal_user-x_group.sql | 36 +++++++++++++++++++
 .../optimized/current/ranger_core_db_postgres.sql  |  4 +++
 ...cSource-col-in-x_user-x_portal_user-x_group.sql | 42 ++++++++++++++++++++++
 .../current/ranger_core_db_sqlanywhere.sql         |  5 +++
 ...cSource-col-in-x_user-x_portal_user-x_group.sql | 28 +++++++++++++++
 .../optimized/current/ranger_core_db_sqlserver.sql |  4 +++
 ...cSource-col-in-x_user-x_portal_user-x_group.sql | 33 +++++++++++++++++
 .../main/java/org/apache/ranger/biz/UserMgr.java   |  3 +-
 .../main/java/org/apache/ranger/biz/XUserMgr.java  |  1 +
 .../java/org/apache/ranger/entity/XXGroup.java     | 24 +++++++++++++
 .../org/apache/ranger/entity/XXPortalUser.java     | 25 +++++++++++++
 .../main/java/org/apache/ranger/entity/XXUser.java | 25 +++++++++++++
 .../java/org/apache/ranger/rest/XUserREST.java     |  7 ++--
 .../org/apache/ranger/service/XGroupService.java   |  4 ++-
 .../apache/ranger/service/XGroupServiceBase.java   |  8 ++---
 .../ranger/service/XPortalUserServiceBase.java     |  2 ++
 .../org/apache/ranger/service/XUserService.java    |  3 ++
 .../apache/ranger/service/XUserServiceBase.java    |  9 ++---
 .../main/java/org/apache/ranger/view/VXGroup.java  | 19 ++++++++++
 .../java/org/apache/ranger/view/VXPortalUser.java  | 22 ++++++++++++
 .../main/java/org/apache/ranger/view/VXUser.java   | 17 +++++++++
 .../apache/ranger/ugsyncutil/model/XGroupInfo.java |  5 +++
 .../apache/ranger/ugsyncutil/model/XUserInfo.java  | 10 ++++++
 .../process/PolicyMgrUserGroupBuilder.java         |  5 ++-
 27 files changed, 373 insertions(+), 14 deletions(-)

diff --git a/security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql 
b/security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql
index 1ba3e69..d5d8129 100644
--- a/security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql
+++ b/security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql
@@ -117,6 +117,7 @@ CREATE TABLE `x_portal_user` (
   `user_src` int(11) NOT NULL DEFAULT '0',
   `notes` varchar(4000) DEFAULT NULL,
   `other_attributes` varchar(4000) DEFAULT NULL,
+  `sync_source` varchar(4000) DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `x_portal_user_UK_login_id` (`login_id`),
   UNIQUE KEY `x_portal_user_UK_email` (`email`),
@@ -276,6 +277,7 @@ CREATE TABLE `x_group` (
   `group_src` INT NOT NULL DEFAULT 0,
   `is_visible` INT(11) NOT NULL DEFAULT '1',
   `other_attributes` varchar(4000) DEFAULT NULL,
+  `sync_source` varchar(4000) DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `x_group_UK_group_name` (`group_name`),
   KEY `x_group_FK_added_by_id` (`added_by_id`),
@@ -322,6 +324,7 @@ CREATE TABLE `x_user` (
   `cred_store_id` bigint(20) DEFAULT NULL,
   `is_visible` INT(11) NOT NULL DEFAULT '1',
   `other_attributes` varchar(4000) DEFAULT NULL,
+  `sync_source` varchar(4000) DEFAULT NULL,
   PRIMARY KEY (`id`),
   KEY `x_user_FK_added_by_id` (`added_by_id`),
   KEY `x_user_FK_upd_by_id` (`upd_by_id`),
@@ -1734,6 +1737,7 @@ INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('051',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('052',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('054',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
+INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('055',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('DB_PATCHES',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
 
 INSERT INTO x_user_module_perm 
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed)
diff --git 
a/security-admin/db/mysql/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/mysql/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..4ca8a82
--- /dev/null
+++ 
b/security-admin/db/mysql/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,38 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+drop procedure if exists add_column_in_x_user_and_x_portal_user_and_x_group;
+
+delimiter ;;
+create procedure add_column_in-x_user-x_portal_user-x_group() begin
+
+if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_user' and 
column_name='sync_source') then
+        ALTER TABLE x_user ADD sync_source varchar(4000) DEFAULT NULL;
+end if;
+
+if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_portal_user' and 
column_name='sync_source') then
+        ALTER TABLE x_portal_user ADD sync_source varchar(4000) DEFAULT NULL;
+end if;
+
+if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_group' and 
column_name='sync_source') then
+        ALTER TABLE x_group ADD sync_source varchar(4000) DEFAULT NULL;
+end if;
+
+end;;
+
+delimiter ;
+call add_column_in_x_user_and_x_portal_user_and_x_group();
+
+drop procedure if exists add_column_in_x_user_and_x_portal_user_and_x_group;
\ No newline at end of file
diff --git 
a/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql 
b/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
index 021c34c..2210a2a 100644
--- a/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
+++ b/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
@@ -309,6 +309,7 @@ CREATE TABLE x_portal_user (
         user_src NUMBER(11) DEFAULT '0' NOT NULL ,
         notes VARCHAR(4000) DEFAULT NULL NULL ,
         other_attributes VARCHAR(4000) DEFAULT NULL NULL,
+        sync_source VARCHAR(4000) DEFAULT NULL NULL,
         PRIMARY KEY (id),
         CONSTRAINT x_portal_user_UK_login_id UNIQUE (login_id) ,
         CONSTRAINT x_portal_user_UK_email UNIQUE (email),
@@ -435,6 +436,7 @@ CREATE TABLE X_GROUP(
         group_src NUMBER(10) DEFAULT 0 NOT NULL,
         is_visible NUMBER(11) DEFAULT 1 NOT NULL,
         other_attributes VARCHAR(4000) DEFAULT NULL NULL,
+        sync_source VARCHAR(4000) DEFAULT NULL NULL,
         PRIMARY KEY (ID),
         CONSTRAINT x_group_UK_group_name UNIQUE (group_name),
         CONSTRAINT X_GROUP_FK_ADDED_BY_ID FOREIGN KEY (ADDED_BY_ID) REFERENCES 
X_PORTAL_USER (ID) ENABLE,
@@ -470,6 +472,7 @@ CREATE TABLE x_user (
         cred_store_id NUMBER(20) DEFAULT NULL NULL ,
         is_visible NUMBER(11) DEFAULT 1 NOT NULL ,
         other_attributes VARCHAR(4000) DEFAULT NULL NULL ,
+        sync_source VARCHAR(4000) DEFAULT NULL NULL,
         PRIMARY KEY (id),
         CONSTRAINT x_user_UK_user_name UNIQUE (user_name),
         CONSTRAINT x_user_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES 
x_portal_user (id),
@@ -1959,6 +1962,7 @@ INSERT INTO x_db_version_h 
(id,version,inst_at,inst_by,updated_at,updated_by,act
 INSERT INTO x_db_version_h 
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
(X_DB_VERSION_H_SEQ.nextval, '051',sys_extract_utc(systimestamp),'Ranger 
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
 INSERT INTO x_db_version_h 
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
(X_DB_VERSION_H_SEQ.nextval, '052',sys_extract_utc(systimestamp),'Ranger 
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
 INSERT INTO x_db_version_h 
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
(X_DB_VERSION_H_SEQ.nextval, '054',sys_extract_utc(systimestamp),'Ranger 
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
+INSERT INTO x_db_version_h 
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
(X_DB_VERSION_H_SEQ.nextval, '055',sys_extract_utc(systimestamp),'Ranger 
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
 INSERT INTO x_db_version_h 
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
(X_DB_VERSION_H_SEQ.nextval, 'DB_PATCHES',sys_extract_utc(systimestamp),'Ranger 
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
 
 INSERT INTO x_user_module_perm 
(id,user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed) 
VALUES 
(X_USER_MODULE_PERM_SEQ.nextval,getXportalUIdByLoginId('admin'),getModulesIdByName('Reports'),sys_extract_utc(systimestamp),sys_extract_utc(systimestamp),getXportalUIdByLoginId('admin'),getXportalUIdByLoginId('admin'),1);
diff --git 
a/security-admin/db/oracle/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/oracle/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..a1d4b36
--- /dev/null
+++ 
b/security-admin/db/oracle/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,36 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+DECLARE
+        v_count number:=0;
+BEGIN
+        select count(*) into v_count from user_tab_cols where 
table_name='x_portal_user' and column_name='sync_source';
+        if (v_count = 0) then
+                execute immediate 'ALTER TABLE x_portal_user ADD sync_source 
VARCHAR(4000) DEFAULT NULL NULL';
+        end if;
+
+        v_count number:=0;
+        select count(*) into v_count from user_tab_cols where 
table_name='x_user' and column_name='sync_source';
+        if (v_count = 0) then
+                execute immediate 'ALTER TABLE x_user ADD sync_source 
VARCHAR(4000) DEFAULT NULL NULL';
+        end if;
+
+        v_count number:=0;
+        select count(*) into v_count from user_tab_cols where 
table_name='X_GROUP' and column_name='sync_source';
+        if (v_count = 0) then
+                execute immediate 'ALTER TABLE X_GROUP ADD sync_source 
VARCHAR(4000) DEFAULT NULL NULL';
+        end if;
+        commit;
+END;/
\ No newline at end of file
diff --git 
a/security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql 
b/security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql
index 89e9e77..25fe2bf 100644
--- a/security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql
+++ b/security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql
@@ -192,6 +192,7 @@ status INT DEFAULT '0' NOT NULL,
 user_src INT DEFAULT '0' NOT NULL,
 notes VARCHAR(4000) DEFAULT NULL NULL,
 other_attributes VARCHAR(4000) DEFAULT NULL NULL,
+sync_source VARCHAR(4000) DEFAULT NULL NULL,
 PRIMARY KEY(id),
 CONSTRAINT x_portal_user_UK_login_id UNIQUE(login_id),
 CONSTRAINT x_portal_user_UK_email UNIQUE(email),
@@ -325,6 +326,7 @@ CRED_STORE_ID BIGINT DEFAULT NULL,
 GROUP_SRC INT DEFAULT 0 NOT NULL,
 IS_VISIBLE INT DEFAULT '1' NOT NULL,
 other_attributes VARCHAR(4000) DEFAULT NULL NULL,
+sync_source VARCHAR(4000) DEFAULT NULL NULL,
 PRIMARY KEY(ID),
 CONSTRAINT x_group_UK_group_name UNIQUE(group_name),
 CONSTRAINT X_GROUP_FK_ADDED_BY_ID FOREIGN KEY(ADDED_BY_ID) REFERENCES 
X_PORTAL_USER(ID),
@@ -362,6 +364,7 @@ status INT DEFAULT '0' NOT NULL,
 cred_store_id BIGINT DEFAULT NULL NULL,
 is_visible INT DEFAULT '1' NOT NULL,
 other_attributes VARCHAR(4000) DEFAULT NULL NULL,
+sync_source VARCHAR(4000) DEFAULT NULL NULL,
 PRIMARY KEY(id),
 CONSTRAINT x_user_UK_user_name UNIQUE(user_name),
 CONSTRAINT x_user_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES 
x_portal_user(id),
@@ -1882,6 +1885,7 @@ INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('051',current_timestamp,'Ranger 1.0.0',current_timestamp,'localhost','Y');
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('052',current_timestamp,'Ranger 1.0.0',current_timestamp,'localhost','Y');
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('054',current_timestamp,'Ranger 1.0.0',current_timestamp,'localhost','Y');
+INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('055',current_timestamp,'Ranger 1.0.0',current_timestamp,'localhost','Y');
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('DB_PATCHES',current_timestamp,'Ranger 
1.0.0',current_timestamp,'localhost','Y');
 
 INSERT INTO x_user_module_perm 
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed) 
VALUES
diff --git 
a/security-admin/db/postgres/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/postgres/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..68117a1
--- /dev/null
+++ 
b/security-admin/db/postgres/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,42 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+select 'delimiter start';
+CREATE OR REPLACE FUNCTION add_column_in_x_user_and_x_portal_user_and_x_group()
+RETURNS void AS $$
+DECLARE
+ v_column_exists integer := 0;
+BEGIN
+ select count(*) into v_column_exists from pg_attribute where attrelid 
in(select oid from pg_class where relname='x_portal_user') and 
attname='sync_source';
+ IF v_column_exists = 0 THEN
+  ALTER TABLE x_portal_user ADD COLUMN sync_source VARCHAR(4000) DEFAULT NULL 
NULL;
+ END IF;
+
+ select count(*) into v_column_exists from pg_attribute where attrelid 
in(select oid from pg_class where relname='x_user') and attname='sync_source';
+ IF v_column_exists = 0 THEN
+  ALTER TABLE x_user ADD COLUMN sync_source VARCHAR(4000) DEFAULT NULL NULL;
+ END IF;
+
+ select count(*) into v_column_exists from pg_attribute where attrelid 
in(select oid from pg_class where relname='x_group') and attname='sync_source';
+ IF v_column_exists = 0 THEN
+  ALTER TABLE x_group ADD COLUMN sync_source VARCHAR(4000) DEFAULT NULL NULL;
+ END IF;
+
+END;
+$$ LANGUAGE plpgsql;
+select 'delimiter end';
+
+select add_column_in_x_user_and_x_portal_user_and_x_group();
+select 'delimiter end';
\ No newline at end of file
diff --git 
a/security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql
 
b/security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql
index b90a48e..cbc5d73 100644
--- 
a/security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql
+++ 
b/security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql
@@ -217,6 +217,7 @@ create table dbo.x_portal_user(
        user_src int DEFAULT 0 NOT NULL,
        notes varchar(4000) DEFAULT NULL NULL,
        other_attributes varchar(4000) DEFAULT NULL NULL,
+       sync_source varchar(4000) DEFAULT NULL NULL,
        CONSTRAINT x_portal_user_PK_id PRIMARY KEY CLUSTERED(id),
        CONSTRAINT x_portal_user_UK_login_id UNIQUE NONCLUSTERED (login_id)
 )
@@ -331,6 +332,7 @@ create table dbo.x_group(
        group_src int DEFAULT 0 NOT NULL,
        is_visible int DEFAULT 1 NOT NULL,
        other_attributes varchar(4000) DEFAULT NULL NULL,
+       sync_source varchar(4000) DEFAULT NULL NULL,
        CONSTRAINT x_group_PK_id PRIMARY KEY CLUSTERED(id),
        CONSTRAINT x_group_UK_group_name UNIQUE NONCLUSTERED (group_name)
 )
@@ -359,6 +361,7 @@ create table dbo.x_user(
        cred_store_id bigint DEFAULT NULL NULL,
        is_visible int DEFAULT 1 NOT NULL,
        other_attributes varchar(4000) DEFAULT NULL NULL,
+       sync_source varchar(4000) DEFAULT NULL NULL,
        CONSTRAINT x_user_PK_id PRIMARY KEY CLUSTERED(id),
        CONSTRAINT x_user_UK_user_name UNIQUE NONCLUSTERED (user_name)
 )
@@ -2247,6 +2250,8 @@ INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active
 GO
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('054',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
 GO
+INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('055',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
+GO
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('DB_PATCHES',CURRENT_TIMESTAMP,'Ranger 
1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
 GO
 INSERT INTO x_user_module_perm 
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed) 
VALUES 
(dbo.getXportalUIdByLoginId('admin'),dbo.getModulesIdByName('Reports'),CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,dbo.getXportalUIdByLoginId('admin'),dbo.getXportalUIdByLoginId('admin'),1);
diff --git 
a/security-admin/db/sqlanywhere/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/sqlanywhere/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..3354590
--- /dev/null
+++ 
b/security-admin/db/sqlanywhere/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,28 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_portal_user' and 
cname = 'sync_source') THEN
+               ALTER TABLE dbo.x_portal_user ADD sync_source varchar(4000) 
DEFAULT NULL NULL;
+END IF;
+GO
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_user' and cname = 
'sync_source') THEN
+               ALTER TABLE dbo.x_user ADD sync_source varchar(4000) DEFAULT 
NULL NULL;
+END IF;
+GO
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_group' and cname = 
'sync_source') THEN
+               ALTER TABLE dbo.x_group ADD sync_source varchar(4000) DEFAULT 
NULL NULL;
+END IF;
+GO
+exit
\ No newline at end of file
diff --git 
a/security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql 
b/security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql
index 7e03289..a87692e 100644
--- a/security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql
+++ b/security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql
@@ -966,6 +966,7 @@ CREATE TABLE [dbo].[x_portal_user](
         [user_src] [int] DEFAULT 0 NOT NULL,
         [notes] [varchar](4000) DEFAULT NULL NULL,
         [other_attributes] [varchar](4000) DEFAULT NULL NULL,
+        [sync_source] [varchar](4000) DEFAULT NULL NULL,
 PRIMARY KEY CLUSTERED
 (
         [id] ASC
@@ -1118,6 +1119,7 @@ CREATE TABLE [dbo].[x_group](
         [group_src] [int] DEFAULT 0 NOT NULL,
         [is_visible] [int] DEFAULT 1 NOT NULL,
         [other_attributes] [varchar](4000) DEFAULT NULL NULL,
+        [sync_source] [varchar](4000) DEFAULT NULL NULL,
 PRIMARY KEY CLUSTERED
 (
         [id] ASC
@@ -1161,6 +1163,7 @@ CREATE TABLE [dbo].[x_user](
         [cred_store_id] [bigint] DEFAULT NULL NULL,
         [is_visible] [int] DEFAULT 1 NOT NULL,
         [other_attributes] [varchar](4000) DEFAULT NULL NULL,
+        [sync_source] [varchar](4000) DEFAULT NULL NULL,
 PRIMARY KEY CLUSTERED
 (
         [id] ASC
@@ -4095,6 +4098,7 @@ INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('052',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('053',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('054',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
+INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('055',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
 INSERT INTO x_db_version_h 
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES 
('DB_PATCHES',CURRENT_TIMESTAMP,'Ranger 
1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
 INSERT INTO x_user_module_perm 
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed) 
VALUES 
(dbo.getXportalUIdByLoginId('admin'),dbo.getModulesIdByName('Reports'),CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,dbo.getXportalUIdByLoginId('admin'),dbo.getXportalUIdByLoginId('admin'),1);
 INSERT INTO x_user_module_perm 
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed) 
VALUES (dbo.getXportalUIdByLoginId('admin'),dbo.getModulesIdByName('Resource 
Based 
Policies'),CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,dbo.getXportalUIdByLoginId('admin'),dbo.getXportalUIdByLoginId('admin'),1);
diff --git 
a/security-admin/db/sqlserver/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/sqlserver/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..3b8a8d8
--- /dev/null
+++ 
b/security-admin/db/sqlserver/patches/055-add-syncSource-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,33 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_portal_user' and column_name = 'sync_source')
+BEGIN
+       ALTER TABLE [dbo].[x_portal_user] ADD [sync_source] [varchar](4000) 
DEFAULT NULL NULL;
+END
+GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_user' and column_name = 'sync_source')
+BEGIN
+       ALTER TABLE [dbo].[x_user] ADD [sync_source] [varchar](4000) DEFAULT 
NULL NULL;
+END
+GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_group' and column_name = 'sync_source')
+BEGIN
+       ALTER TABLE [dbo].[x_group] ADD [sync_source] [varchar](4000) DEFAULT 
NULL NULL;
+END
+GO
+exit
+
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java 
b/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
index e72a7a7..7046c9b 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java
@@ -596,6 +596,7 @@ public class UserMgr {
                gjUser.setUserSource(userProfile.getUserSource());
                gjUser.setPublicScreenName(userProfile.getPublicScreenName());
                gjUser.setOtherAttributes(userProfile.getOtherAttributes());
+               gjUser.setSyncSource(userProfile.getSyncSource());
                if (userProfile.getFirstName() != null
                                && userProfile.getLastName() != null
                                && !userProfile.getFirstName().trim().isEmpty()
@@ -1289,7 +1290,7 @@ public class UserMgr {
                userProfile.setLastName(user.getLastName());
                userProfile.setPublicScreenName(user.getPublicScreenName());
                userProfile.setOtherAttributes(user.getOtherAttributes());
-
+               userProfile.setSyncSource(user.getSyncSource());
                List<XXPortalUserRole> gjUserRoleList = daoManager
                                
.getXXPortalUserRole().findByParentId(user.getId());
 
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java 
b/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java
index 6596bac..7b29f3d 100755
--- a/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java
@@ -3070,6 +3070,7 @@ public class XUserMgr extends XUserMgrBase {
                        vXPortalUser.setPublicScreenName(vXUser.getName());
                }
                vXPortalUser.setUserSource(vXUser.getUserSource());
+               vXPortalUser.setSyncSource(vXUser.getSyncSource());
 
                String hiddenPasswordString = 
PropertiesUtil.getProperty("ranger.password.hidden", "*****");
                String password = vXUser.getPassword();
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXGroup.java 
b/security-admin/src/main/java/org/apache/ranger/entity/XXGroup.java
index 996a9e1..708375f 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXGroup.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXGroup.java
@@ -129,6 +129,15 @@ public class XXGroup extends XXDBBase implements 
java.io.Serializable {
        protected String otherAttributes;
 
        /**
+        * Sync Source Attribute.
+        * <ul>
+        * </ul>
+        *
+        */
+       @Column(name="SYNC_SOURCE")
+       protected String syncSource;
+
+       /**
         * Default constructor. This will set all the attributes to default 
value.
         */
        public XXGroup ( ) {
@@ -265,6 +274,20 @@ public class XXGroup extends XXDBBase implements 
java.io.Serializable {
        }
 
        /**
+        * This method sets JSON {@link String} representation of sync source 
attribute.
+        * This method accepts null values.
+        * @param syncSource
+        */
+       public void setSyncSource(String syncSource) {
+               this.syncSource = syncSource;
+       }
+
+       /**
+        * @return JSON {@link String} representation of sync source attribute 
if available,
+        * <code>null</code> otherwise.
+        */
+       public String getSyncSource() { return syncSource; }
+       /**
         * This return the bean content in string format
         * @return formatedStr
        */
@@ -280,6 +303,7 @@ public class XXGroup extends XXDBBase implements 
java.io.Serializable {
                str += "credStoreId={" + credStoreId + "} ";
                str += "groupSrc={" + groupSource + "} ";
                str += "otherAttributes={" + otherAttributes + "} ";
+               str += "syncSource={" + syncSource + "} ";
                str += "}";
                return str;
        }
diff --git 
a/security-admin/src/main/java/org/apache/ranger/entity/XXPortalUser.java 
b/security-admin/src/main/java/org/apache/ranger/entity/XXPortalUser.java
index ed69f38..d0451b4 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPortalUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPortalUser.java
@@ -157,6 +157,15 @@ public class XXPortalUser extends XXDBBase implements 
java.io.Serializable {
        protected String otherAttributes;
 
        /**
+        * Sync Source Attribute.
+        * <ul>
+        * </ul>
+        *
+        */
+       @Column(name="SYNC_SOURCE")
+       protected String syncSource;
+
+       /**
         * Default constructor. This will set all the attributes to default 
value.
         */
        public XXPortalUser ( ) {
@@ -340,6 +349,21 @@ public class XXPortalUser extends XXDBBase implements 
java.io.Serializable {
        }
 
        /**
+        * This method sets JSON {@link String} representation of sync source 
attribute.
+        * This method accepts null values.
+        * @param syncSource
+        */
+       public void setSyncSource(String syncSource) {
+               this.syncSource = syncSource;
+       }
+
+       /**
+        * @return JSON {@link String} representation of sync source attribute 
if available,
+        * <code>null</code> otherwise.
+        */
+       public String getSyncSource() { return syncSource; }
+
+       /**
         * This return the bean content in string format
         * @return formatedStr
        */
@@ -356,6 +380,7 @@ public class XXPortalUser extends XXDBBase implements 
java.io.Serializable {
                str += "userSource={" + userSource + "} ";
                str += "notes={" + notes + "} ";
                str += "otherAttributes={" + otherAttributes + "} ";
+               str += "syncSource={" + syncSource + "} ";
                str += "}";
                return str;
        }
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXUser.java 
b/security-admin/src/main/java/org/apache/ranger/entity/XXUser.java
index 0464e7b..99bea26 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXUser.java
@@ -116,6 +116,15 @@ public class XXUser extends XXDBBase implements 
java.io.Serializable {
        protected String otherAttributes;
 
        /**
+        * Sync Source attribute.
+        * <ul>
+        * </ul>
+        *
+        */
+       @Column(name="SYNC_SOURCE")
+       protected String syncSource;
+
+       /**
         * Default constructor. This will set all the attributes to default 
value.
         */
        public XXUser ( ) {
@@ -237,6 +246,21 @@ public class XXUser extends XXDBBase implements 
java.io.Serializable {
        }
 
        /**
+        * This method sets JSON {@link String} representation of sync source 
attribute.
+        * This method accepts null values.
+        * @param syncSource
+        */
+       public void setSyncSource(String syncSource) {
+               this.syncSource = syncSource;
+       }
+
+       /**
+        * @return JSON {@link String} representation of sync source attribute 
if available,
+        * <code>null</code> otherwise.
+        */
+       public String getSyncSource() { return syncSource; }
+
+       /**
         * This return the bean content in string format
         * @return formatedStr
        */
@@ -250,6 +274,7 @@ public class XXUser extends XXDBBase implements 
java.io.Serializable {
                str += "isvisible={" + isVisible + "} ";
                str += "credStoreId={" + credStoreId + "} ";
                str += "otherAttributes={" + otherAttributes + "} ";
+               str += "syncSource={" + syncSource + "} ";
                str += "}";
                return str;
        }
diff --git a/security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java 
b/security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java
index 4c648ae..1f44703 100644
--- a/security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java
+++ b/security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java
@@ -254,8 +254,8 @@ public class XUserREST {
                                request, xGroupService.sortFields);
                searchUtil.extractString(request, searchCriteria, "name", 
"group name", null);
                searchUtil.extractInt(request, searchCriteria, "isVisible", 
"Group Visibility");
-//             searchUtil.extractString(request, searchCriteria, 
"groupSource", "group source", null);
                searchUtil.extractInt(request, searchCriteria, "groupSource", 
"group source");
+               searchUtil.extractString(request, searchCriteria, "syncSource", 
"Sync Source", null);
                return xUserMgr.searchXGroups(searchCriteria);
        }
 
@@ -384,9 +384,10 @@ public class XUserREST {
                searchUtil.extractInt(request, searchCriteria, "userSource", 
"User Source");
                searchUtil.extractInt(request, searchCriteria, "isVisible", 
"User Visibility");
                searchUtil.extractInt(request, searchCriteria, "status", "User 
Status");
-               List<String> userRolesList = 
searchUtil.extractStringList(request, searchCriteria, "userRoleList", "User 
Role List", "userRoleList", null,
-                               null);
+               List<String> userRolesList = 
searchUtil.extractStringList(request, searchCriteria, "userRoleList",
+                               "User Role List", "userRoleList", null, null);
                searchUtil.extractRoleString(request, searchCriteria, 
"userRole", "Role", null);
+               searchUtil.extractString(request, searchCriteria, "syncSource", 
"Sync Source", null);
 
                if (CollectionUtils.isNotEmpty(userRolesList) && 
CollectionUtils.size(userRolesList) == 1 && 
userRolesList.get(0).equalsIgnoreCase(UserRoleParamName)) {
                        if 
(!(searchCriteria.getParamList().containsKey("name"))) {
diff --git 
a/security-admin/src/main/java/org/apache/ranger/service/XGroupService.java 
b/security-admin/src/main/java/org/apache/ranger/service/XGroupService.java
index 44eebcf..c397968 100644
--- a/security-admin/src/main/java/org/apache/ranger/service/XGroupService.java
+++ b/security-admin/src/main/java/org/apache/ranger/service/XGroupService.java
@@ -74,10 +74,12 @@ public class XGroupService extends 
XGroupServiceBase<XXGroup, VXGroup> {
                                SearchField.DATA_TYPE.INTEGER, 
SearchField.SEARCH_TYPE.FULL,
                                "XXGroupUser groupUser", "obj.id = 
groupUser.parentGroupId"));
 
+               searchFields.add(new SearchField("syncSource", "obj.syncSource",
+                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.FULL));
 
                createdByUserId = 
PropertiesUtil.getLongProperty("ranger.xuser.createdByUserId", 1);
 
-                sortFields.add(new SortField("name", 
"obj.name",true,SortField.SORT_ORDER.ASC));
+               sortFields.add(new SortField("name", 
"obj.name",true,SortField.SORT_ORDER.ASC));
        }
 
        @Override
diff --git 
a/security-admin/src/main/java/org/apache/ranger/service/XGroupServiceBase.java 
b/security-admin/src/main/java/org/apache/ranger/service/XGroupServiceBase.java
index cde91dc..447bdd3 100644
--- 
a/security-admin/src/main/java/org/apache/ranger/service/XGroupServiceBase.java
+++ 
b/security-admin/src/main/java/org/apache/ranger/service/XGroupServiceBase.java
@@ -53,6 +53,7 @@ public abstract class XGroupServiceBase<T extends XXGroup, V 
extends VXGroup>
                mObj.setCredStoreId( vObj.getCredStoreId());
                mObj.setGroupSource(vObj.getGroupSource());
                mObj.setOtherAttributes(vObj.getOtherAttributes());
+               mObj.setSyncSource(vObj.getSyncSource());
                return mObj;
        }
 
@@ -65,6 +66,7 @@ public abstract class XGroupServiceBase<T extends XXGroup, V 
extends VXGroup>
                vObj.setCredStoreId( mObj.getCredStoreId());
                vObj.setGroupSource(mObj.getGroupSource());
                vObj.setOtherAttributes(mObj.getOtherAttributes());
+               vObj.setSyncSource(mObj.getSyncSource());
                return vObj;
        }
 
@@ -73,11 +75,9 @@ public abstract class XGroupServiceBase<T extends XXGroup, V 
extends VXGroup>
         * @return
         */
        public VXGroupList searchXGroups(SearchCriteria searchCriteria) {
-               VXGroupList returnList = new VXGroupList();
+               VXGroupList returnList   = new VXGroupList();
                List<VXGroup> xGroupList = new ArrayList<VXGroup>();
-
-               List<T> resultList = searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
+               List<T> resultList       = searchResources(searchCriteria, 
searchFields, sortFields, returnList);
 
                // Iterate over the result list and create the return list
                for (T gjXGroup : resultList) {
diff --git 
a/security-admin/src/main/java/org/apache/ranger/service/XPortalUserServiceBase.java
 
b/security-admin/src/main/java/org/apache/ranger/service/XPortalUserServiceBase.java
index 85e4b84..4d2e9d7 100644
--- 
a/security-admin/src/main/java/org/apache/ranger/service/XPortalUserServiceBase.java
+++ 
b/security-admin/src/main/java/org/apache/ranger/service/XPortalUserServiceBase.java
@@ -51,6 +51,7 @@ public abstract class XPortalUserServiceBase<T extends 
XXPortalUser, V extends V
                mObj.setUserSource( vObj.getUserSource());
                mObj.setNotes( vObj.getNotes());
                mObj.setOtherAttributes(vObj.getOtherAttributes());
+               mObj.setSyncSource(vObj.getSyncSource());
                return mObj;
        }
 
@@ -66,6 +67,7 @@ public abstract class XPortalUserServiceBase<T extends 
XXPortalUser, V extends V
                vObj.setUserSource( mObj.getUserSource());
                vObj.setNotes( mObj.getNotes());
                vObj.setOtherAttributes(mObj.getOtherAttributes());
+               vObj.setSyncSource(mObj.getSyncSource());
                return vObj;
        }
 
diff --git 
a/security-admin/src/main/java/org/apache/ranger/service/XUserService.java 
b/security-admin/src/main/java/org/apache/ranger/service/XUserService.java
index 0728eea..eff1718 100644
--- a/security-admin/src/main/java/org/apache/ranger/service/XUserService.java
+++ b/security-admin/src/main/java/org/apache/ranger/service/XUserService.java
@@ -117,6 +117,9 @@ public class XUserService extends XUserServiceBase<XXUser, 
VXUser> {
                                "XXPortalUser xXPortalUser, XXPortalUserRole 
xXPortalUserRole",
                                "xXPortalUser.id=xXPortalUserRole.userId and 
xXPortalUser.loginId = obj.name "));
 
+               searchFields.add(new SearchField("syncSource", "obj.syncSource",
+                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.FULL));
+
                createdByUserId = 
PropertiesUtil.getLongProperty("ranger.xuser.createdByUserId", 1);
 
                hiddenPasswordString = 
PropertiesUtil.getProperty("ranger.password.hidden","*****");
diff --git 
a/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java 
b/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java
index 9cdc14e..25fec3d 100644
--- 
a/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java
+++ 
b/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java
@@ -52,6 +52,7 @@ public abstract class XUserServiceBase<T extends XXUser, V 
extends VXUser>
                mObj.setDescription( vObj.getDescription());
                mObj.setCredStoreId( vObj.getCredStoreId());
                mObj.setOtherAttributes(vObj.getOtherAttributes());
+               mObj.setSyncSource(vObj.getSyncSource());
                return mObj;
        }
 
@@ -63,6 +64,7 @@ public abstract class XUserServiceBase<T extends XXUser, V 
extends VXUser>
                vObj.setDescription( mObj.getDescription());
                vObj.setCredStoreId( mObj.getCredStoreId());
                vObj.setOtherAttributes(mObj.getOtherAttributes());
+               vObj.setSyncSource(mObj.getSyncSource());
                return vObj;
        }
 
@@ -71,12 +73,11 @@ public abstract class XUserServiceBase<T extends XXUser, V 
extends VXUser>
         * @return
         */
        public VXUserList searchXUsers(SearchCriteria searchCriteria) {
-               VXUserList returnList = new VXUserList();
-               List<VXUser> xUserList = new ArrayList<VXUser>();
+               VXUserList returnList   = new VXUserList();
+               List<VXUser> xUserList  = new ArrayList<VXUser>();
 
                @SuppressWarnings("unchecked")
-               List<XXUser> resultList = 
(List<XXUser>)searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
+               List<XXUser> resultList = 
(List<XXUser>)searchResources(searchCriteria, searchFields, sortFields, 
returnList);
 
                // Iterate over the result list and create the return list
                for (XXUser gjXUser : resultList) {
diff --git a/security-admin/src/main/java/org/apache/ranger/view/VXGroup.java 
b/security-admin/src/main/java/org/apache/ranger/view/VXGroup.java
index ed64704..0106de2 100644
--- a/security-admin/src/main/java/org/apache/ranger/view/VXGroup.java
+++ b/security-admin/src/main/java/org/apache/ranger/view/VXGroup.java
@@ -73,6 +73,11 @@ public class VXGroup extends VXDataObject implements 
java.io.Serializable {
        protected String otherAttributes;
 
        /**
+        * Sync Source Attribute
+        * */
+       protected String syncSource;
+
+       /**
         * Default constructor. This will set all the attributes to default 
value.
         */
        public VXGroup ( ) {
@@ -194,6 +199,19 @@ public class VXGroup extends VXDataObject implements 
java.io.Serializable {
        }
 
        /**
+        * This method sets sync source attribute.
+        * @param syncSource
+        */
+       public void setSyncSource(String syncSource) {
+               this.syncSource = syncSource;
+       }
+
+       /**
+        * @return {@link String} sync source attribute
+        */
+       public String getSyncSource() { return syncSource; }
+
+       /**
         * This return the bean content in string format
         * @return formatedStr
        */
@@ -207,6 +225,7 @@ public class VXGroup extends VXDataObject implements 
java.io.Serializable {
                str += "isVisible={" + isVisible + "} ";
                str += "groupSrc={" + groupSource + "} ";
                str += "otherAttributes={" + otherAttributes + "} ";
+               str += "syncSource={" + syncSource + "} ";
                str += "}";
                return str;
        }
diff --git 
a/security-admin/src/main/java/org/apache/ranger/view/VXPortalUser.java 
b/security-admin/src/main/java/org/apache/ranger/view/VXPortalUser.java
index b6035b2..5a1b203 100644
--- a/security-admin/src/main/java/org/apache/ranger/view/VXPortalUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/view/VXPortalUser.java
@@ -92,6 +92,12 @@ public class VXPortalUser extends VXDataObject implements 
java.io.Serializable {
        protected String otherAttributes;
 
        /**
+        * sync Source Attribute.
+        *
+        */
+       protected String syncSource;
+
+       /**
         * Default constructor. This will set all the attributes to default 
value.
         */
        public VXPortalUser ( ) {
@@ -316,6 +322,21 @@ public class VXPortalUser extends VXDataObject implements 
java.io.Serializable {
        }
 
        /**
+        * @return {@link String} - sync Source attribute.
+        */
+       public String getSyncSource() {
+               return syncSource;
+       }
+
+       /**
+        * This method sets sync Source attribute.
+        * @param syncSource
+        */
+       public void setSyncSource(final String syncSource) {
+               this.syncSource = syncSource;
+       }
+
+       /**
         * This return the bean content in string format
         * @return formatedStr
        */
@@ -332,6 +353,7 @@ public class VXPortalUser extends VXDataObject implements 
java.io.Serializable {
                str += "notes={" + notes + "} ";
                str += "userRoleList={" + userRoleList + "} ";
                str += "otherAttributes={" + otherAttributes + "} ";
+               str += "syncSource={" + syncSource + "} ";
                str += "}";
                return str;
        }
diff --git a/security-admin/src/main/java/org/apache/ranger/view/VXUser.java 
b/security-admin/src/main/java/org/apache/ranger/view/VXUser.java
index 96f6468..59375c4 100644
--- a/security-admin/src/main/java/org/apache/ranger/view/VXUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/view/VXUser.java
@@ -92,6 +92,11 @@ public class VXUser extends VXDataObject implements 
java.io.Serializable {
        protected String otherAttributes;
 
        /**
+        * Sync Source
+        */
+       protected String syncSource;
+
+       /**
         * Default constructor. This will set all the attributes to default 
value.
         */
        public VXUser ( ) {
@@ -306,6 +311,17 @@ public class VXUser extends VXDataObject implements 
java.io.Serializable {
        }
 
        /**
+        * @return {@link String} - sync Source.
+        */
+       public String getSyncSource() { return syncSource; }
+
+       /**
+        * This method sets additional attributes.
+        * @param syncSource
+        */
+       public void setSyncSource(String syncSource) { this.syncSource = 
syncSource; }
+
+       /**
         * This return the bean content in string format
         * @return formatedStr
        */
@@ -323,6 +339,7 @@ public class VXUser extends VXDataObject implements 
java.io.Serializable {
                str += "groupNameList={" + groupNameList + "} ";
         str += "roleList={" + userRoleList + "} ";
                str += "otherAttributes={" + otherAttributes + "} ";
+               str += "syncSource={" + syncSource + "} ";
                str += "}";
                return str;
        }
diff --git 
a/ugsync-util/src/main/java/org/apache/ranger/ugsyncutil/model/XGroupInfo.java 
b/ugsync-util/src/main/java/org/apache/ranger/ugsyncutil/model/XGroupInfo.java
index a80e5dc..e8f3e96 100644
--- 
a/ugsync-util/src/main/java/org/apache/ranger/ugsyncutil/model/XGroupInfo.java
+++ 
b/ugsync-util/src/main/java/org/apache/ranger/ugsyncutil/model/XGroupInfo.java
@@ -31,6 +31,7 @@ public class XGroupInfo {
        private String isVisible;
        private String groupSource;
        private String otherAttributes;
+       private String syncSource;
        private Map<String, String> otherAttrsMap = new HashMap<>();
        public String getId() {
                return id;
@@ -91,6 +92,10 @@ public class XGroupInfo {
                this.otherAttributes = otherAttributes;
        }
 
+       public String getSyncSource() { return syncSource; }
+
+       public void setSyncSource(String syncSource) { this.syncSource = 
syncSource; }
+
        @Override
        public boolean equals(Object o) {
                if (this == o) return true;
diff --git 
a/ugsync-util/src/main/java/org/apache/ranger/ugsyncutil/model/XUserInfo.java 
b/ugsync-util/src/main/java/org/apache/ranger/ugsyncutil/model/XUserInfo.java
index bc1a665..2a2e01e 100644
--- 
a/ugsync-util/src/main/java/org/apache/ranger/ugsyncutil/model/XUserInfo.java
+++ 
b/ugsync-util/src/main/java/org/apache/ranger/ugsyncutil/model/XUserInfo.java
@@ -29,6 +29,7 @@ public class XUserInfo {
        private String name;
        private String  description;
        private String otherAttributes;
+       private String syncSource;
        private Map<String, String> otherAttrsMap = new HashMap<>();
        private String userSource;
        private String status;
@@ -39,18 +40,23 @@ public class XUserInfo {
        public String getId() {
                return id;
        }
+
        public void setId(String id) {
                this.id = id;
        }
+
        public String getName() {
                return name;
        }
+
        public void setName(String name) {
                this.name = name;
        }
+
        public String getDescription() {
                return description;
        }
+
        public void setDescription(String description) {
                this.description = description;
        }
@@ -123,6 +129,10 @@ public class XUserInfo {
                this.otherAttributes = otherAttributes;
        }
 
+       public String getSyncSource() { return syncSource; }
+
+       public void setSyncSource(String syncSource) { this.syncSource = 
syncSource; }
+
        @Override
     public String toString() {
         return "XUserInfo [id=" + id + ", name=" + name + ", description="
diff --git 
a/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
 
b/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
index 65e26fe..ff513aa 100644
--- 
a/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
+++ 
b/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
@@ -630,6 +630,7 @@ public class PolicyMgrUserGroupBuilder extends 
AbstractUserGroupSource implement
                                                                || 
StringUtils.equalsIgnoreCase(oldGroupAttrs.get(UgsyncCommonConstants.SYNC_SOURCE),
                                                                
newGroupAttrs.get(UgsyncCommonConstants.SYNC_SOURCE))))) {
                                                        
oldGroup.setOtherAttributes(newGroupAttrsStr);
+                                                       
oldGroup.setSyncSource(newGroupAttrs.get(UgsyncCommonConstants.SYNC_SOURCE));
                                                        
oldGroup.setOtherAttrsMap(newGroupAttrs);
                                                        
deltaGroups.put(groupName, oldGroup);
                                                        noOfModifiedGroups++;
@@ -686,6 +687,7 @@ public class PolicyMgrUserGroupBuilder extends 
AbstractUserGroupSource implement
                                                                || 
StringUtils.equalsIgnoreCase(oldUserAttrs.get(UgsyncCommonConstants.SYNC_SOURCE),
                                                                
newUserAttrs.get(UgsyncCommonConstants.SYNC_SOURCE))))) {
                                                        
oldUser.setOtherAttributes(newUserAttrsStr);
+                                                       
oldUser.setSyncSource(newUserAttrs.get(UgsyncCommonConstants.SYNC_SOURCE));
                                                        
oldUser.setOtherAttrsMap(newUserAttrs);
                                                        
oldUser.setUserSource(SOURCE_EXTERNAL);
                                                        
deltaUsers.put(userName, oldUser);
@@ -797,8 +799,8 @@ public class PolicyMgrUserGroupBuilder extends 
AbstractUserGroupSource implement
                }
                xuserInfo.setUserRoleList(roleList);
                xuserInfo.setOtherAttributes(otherAttributes);
+               
xuserInfo.setSyncSource(otherAttrsMap.get(UgsyncCommonConstants.SYNC_SOURCE));
                xuserInfo.setOtherAttrsMap(otherAttrsMap);
-
                return xuserInfo;
        }
 
@@ -815,6 +817,7 @@ public class PolicyMgrUserGroupBuilder extends 
AbstractUserGroupSource implement
                addGroup.setIsVisible(ISVISIBLE);
                addGroup.setGroupSource(SOURCE_EXTERNAL);
                addGroup.setOtherAttributes(otherAttributes);
+               
addGroup.setSyncSource(otherAttrsMap.get(UgsyncCommonConstants.SYNC_SOURCE));
                addGroup.setOtherAttrsMap(otherAttrsMap);
 
                return addGroup;

Reply via email to