You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by pr...@apache.org on 2026/01/06 13:28:54 UTC
(ranger) branch RANGER-2713_master updated (d5ff2f95f -> ad357d4ee)
This is an automated email from the ASF dual-hosted git repository.
pradeep pushed a change to branch RANGER-2713_master
in repository https://gitbox.apache.org/repos/asf/ranger.git
discard d5ff2f95f RANGER-2713: Remove audit fields from XXPolicyRef objects
add 9e8172aa8 RANGER-5436: Fix typo in variable name for namespace permission (#789)
new ad357d4ee RANGER-2713: Remove audit fields from XXPolicyRef objects
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (d5ff2f95f)
\
N -- N -- N refs/heads/RANGER-2713_master (ad357d4ee)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../ranger/authorization/hbase/RangerAuthorizationCoprocessor.java | 4 ++--
.../mysql/patches/077-drop-audit-columns-from-policy-ref-tables.sql | 3 +--
.../oracle/patches/077-drop-audit-columns-from-policy-ref-tables.sql | 5 ++---
.../patches/077-drop-audit-columns-from-policy-ref-tables.sql | 4 ++--
.../patches/077-drop-audit-columns-from-policy-ref-tables.sql | 3 +--
.../patches/077-drop-audit-columns-from-policy-ref-tables.sql | 3 +--
6 files changed, 9 insertions(+), 13 deletions(-)
(ranger) 01/01: RANGER-2713: Remove audit fields from XXPolicyRef objects
Posted by pr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
pradeep pushed a commit to branch RANGER-2713_master
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit ad357d4ee49b19c330f8a561d2af951764251645
Author: andrewluotechnologies <an...@outlook.com>
AuthorDate: Mon Jan 5 21:03:54 2026 +0530
RANGER-2713: Remove audit fields from XXPolicyRef objects
---
.../optimized/current/ranger_core_db_mysql.sql | 97 +------
...7-drop-audit-columns-from-policy-ref-tables.sql | 155 ++++++++++
.../optimized/current/ranger_core_db_oracle.sql | 109 +------
...7-drop-audit-columns-from-policy-ref-tables.sql | 110 +++++++
.../optimized/current/ranger_core_db_postgres.sql | 109 +------
...7-drop-audit-columns-from-policy-ref-tables.sql | 99 +++++++
.../current/ranger_core_db_sqlanywhere.sql | 62 +---
...7-drop-audit-columns-from-policy-ref-tables.sql | 248 ++++++++++++++++
.../optimized/current/ranger_core_db_sqlserver.sql | 151 +---------
...7-drop-audit-columns-from-policy-ref-tables.sql | 316 +++++++++++++++++++++
.../org/apache/ranger/biz/PolicyRefUpdater.java | 16 +-
.../java/org/apache/ranger/biz/RoleRefUpdater.java | 10 +-
.../apache/ranger/biz/SecurityZoneRefUpdater.java | 16 +-
.../ranger/entity/XXPolicyRefAccessType.java | 2 +-
.../apache/ranger/entity/XXPolicyRefCondition.java | 2 +-
.../ranger/entity/XXPolicyRefDataMaskType.java | 2 +-
.../org/apache/ranger/entity/XXPolicyRefGroup.java | 4 +-
.../apache/ranger/entity/XXPolicyRefResource.java | 2 +-
.../org/apache/ranger/entity/XXPolicyRefRole.java | 2 +-
.../org/apache/ranger/entity/XXPolicyRefUser.java | 2 +-
.../org/apache/ranger/entity/XXRoleRefGroup.java | 2 +-
.../org/apache/ranger/entity/XXRoleRefRole.java | 2 +-
.../org/apache/ranger/entity/XXRoleRefUser.java | 2 +-
.../ranger/entity/XXSecurityZoneRefResource.java | 4 +-
.../ranger/entity/XXSecurityZoneRefService.java | 4 +-
.../ranger/entity/XXSecurityZoneRefTagService.java | 4 +-
.../ranger/entity/XXSecurityZoneRefUser.java | 4 +-
.../apache/ranger/service/XPortalUserService.java | 33 +--
.../org/apache/ranger/biz/TestRoleRefUpdater.java | 6 -
.../ranger/biz/TestSecurityZoneRefUpdater.java | 13 -
.../org/apache/ranger/biz/TestServiceDBStore.java | 11 -
.../ranger/service/TestXPortalUserService.java | 48 +---
32 files changed, 981 insertions(+), 666 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 debcc9422..43db2d677 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
@@ -606,16 +606,10 @@ CONSTRAINT `x_ranger_global_state_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERE
CREATE TABLE IF NOT EXISTS `x_security_zone_ref_service`(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
-`create_time` datetime NULL DEFAULT NULL,
-`update_time` datetime NULL DEFAULT NULL,
-`added_by_id` bigint(20) NULL DEFAULT NULL,
-`upd_by_id` bigint(20) NULL DEFAULT NULL,
`zone_id` bigint(20) NULL DEFAULT NULL,
`service_id` bigint(20) NULL DEFAULT NULL,
`service_name` varchar(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
- CONSTRAINT `x_sz_ref_service_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_sz_ref_service_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_sz_ref_service_FK_zone_id` FOREIGN KEY (`zone_id`) REFERENCES `x_security_zone` (`id`),
CONSTRAINT `x_sz_ref_service_FK_service_id` FOREIGN KEY (`service_id`) REFERENCES `x_service` (`id`),
CONSTRAINT `x_sz_ref_service_FK_service_name` FOREIGN KEY (`service_name`) REFERENCES `x_service` (`name`)
@@ -623,16 +617,10 @@ CREATE TABLE IF NOT EXISTS `x_security_zone_ref_service`(
CREATE TABLE IF NOT EXISTS `x_security_zone_ref_tag_srvc`(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
-`create_time` datetime NULL DEFAULT NULL,
-`update_time` datetime NULL DEFAULT NULL,
-`added_by_id` bigint(20) NULL DEFAULT NULL,
-`upd_by_id` bigint(20) NULL DEFAULT NULL,
`zone_id` bigint(20) NULL DEFAULT NULL,
`tag_srvc_id` bigint(20) NULL DEFAULT NULL,
`tag_srvc_name` varchar(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
- CONSTRAINT `x_sz_ref_tag_service_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_sz_ref_tag_service_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_sz_ref_tag_service_FK_zone_id` FOREIGN KEY (`zone_id`) REFERENCES `x_security_zone` (`id`),
CONSTRAINT `x_sz_ref_tag_service_FK_tag_srvc_id` FOREIGN KEY (`tag_srvc_id`) REFERENCES `x_service` (`id`),
CONSTRAINT `x_sz_ref_tag_service_FK_tag_srvc_name` FOREIGN KEY (`tag_srvc_name`) REFERENCES `x_service` (`name`)
@@ -640,17 +628,11 @@ CREATE TABLE IF NOT EXISTS `x_security_zone_ref_tag_srvc`(
CREATE TABLE IF NOT EXISTS `x_security_zone_ref_user`(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
-`create_time` datetime NULL DEFAULT NULL,
-`update_time` datetime NULL DEFAULT NULL,
-`added_by_id` bigint(20) NULL DEFAULT NULL,
-`upd_by_id` bigint(20) NULL DEFAULT NULL,
`zone_id` bigint(20) NULL DEFAULT NULL,
`user_id` bigint(20) NULL DEFAULT NULL,
`user_name` varchar(255) NULL DEFAULT NULL,
`user_type` tinyint(3) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
- CONSTRAINT `x_sz_ref_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_sz_ref_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_sz_ref_user_FK_zone_id` FOREIGN KEY (`zone_id`) REFERENCES `x_security_zone` (`id`),
CONSTRAINT `x_sz_ref_user_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`),
CONSTRAINT `x_sz_ref_user_FK_user_name` FOREIGN KEY (`user_name`) REFERENCES `x_user` (`user_name`)
@@ -658,17 +640,11 @@ CREATE TABLE IF NOT EXISTS `x_security_zone_ref_user`(
CREATE TABLE IF NOT EXISTS `x_security_zone_ref_group`(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
-`create_time` datetime NULL DEFAULT NULL,
-`update_time` datetime NULL DEFAULT NULL,
-`added_by_id` bigint(20) NULL DEFAULT NULL,
-`upd_by_id` bigint(20) NULL DEFAULT NULL,
`zone_id` bigint(20) NULL DEFAULT NULL,
`group_id` bigint(20) NULL DEFAULT NULL,
`group_name` varchar(255) NULL DEFAULT NULL,
`group_type` tinyint(3) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
- CONSTRAINT `x_sz_ref_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_sz_ref_group_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_sz_ref_group_FK_zone_id` FOREIGN KEY (`zone_id`) REFERENCES `x_security_zone` (`id`),
CONSTRAINT `x_sz_ref_group_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`)
)ROW_FORMAT=DYNAMIC;
@@ -1329,124 +1305,76 @@ CREATE TABLE IF NOT EXISTS `x_ugsync_audit_info`(
CREATE TABLE IF NOT EXISTS `x_policy_ref_resource` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
- `guid` varchar(1024) DEFAULT NULL,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
`policy_id` bigint(20) NOT NULL,
`resource_def_id` bigint(20) NOT NULL,
`resource_name` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `x_policy_ref_res_UK_polId_resDefId`(`policy_id`, `resource_def_id`),
- CONSTRAINT `x_policy_ref_res_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_policy_ref_res_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_policy_ref_res_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
CONSTRAINT `x_policy_ref_res_FK_resource_def_id` FOREIGN KEY (`resource_def_id`) REFERENCES `x_resource_def` (`id`)
) ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `x_policy_ref_access_type` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
- `guid` varchar(1024) DEFAULT NULL,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
`policy_id` bigint(20) NOT NULL,
`access_def_id` bigint(20) NOT NULL,
`access_type_name` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `x_policy_ref_access_UK_polId_accessDefId`(`policy_id`, `access_def_id`),
- CONSTRAINT `x_policy_ref_access_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_policy_ref_access_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_policy_ref_access_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
CONSTRAINT `x_policy_ref_access_FK_access_def_id` FOREIGN KEY (`access_def_id`) REFERENCES `x_access_type_def` (`id`)
) ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `x_policy_ref_condition` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
- `guid` varchar(1024) DEFAULT NULL,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
`policy_id` bigint(20) NOT NULL,
`condition_def_id` bigint(20) NOT NULL,
`condition_name` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `x_policy_ref_condition_UK_polId_condDefId`(`policy_id`, `condition_def_id`),
- CONSTRAINT `x_policy_ref_condition_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_policy_ref_condition_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_policy_ref_condition_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
CONSTRAINT `x_policy_ref_condition_FK_condition_def_id` FOREIGN KEY (`condition_def_id`) REFERENCES `x_policy_condition_def` (`id`)
) ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `x_policy_ref_datamask_type` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
- `guid` varchar(1024) DEFAULT NULL,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
`policy_id` bigint(20) NOT NULL,
`datamask_def_id` bigint(20) NOT NULL,
`datamask_type_name` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `x_policy_ref_datamask_UK_polId_dmaskDefId`(`policy_id`, `datamask_def_id`),
- CONSTRAINT `x_policy_ref_datamask_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_policy_ref_datamask_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_policy_ref_datamask_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
CONSTRAINT `x_policy_ref_datamask_FK_datamask_def_id` FOREIGN KEY (`datamask_def_id`) REFERENCES `x_datamask_type_def` (`id`)
) ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `x_policy_ref_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
- `guid` varchar(1024) DEFAULT NULL,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
`policy_id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
`user_name` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `x_policy_ref_user_UK_polId_userId`(`policy_id`, `user_id`),
- CONSTRAINT `x_policy_ref_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_policy_ref_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_policy_ref_user_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
CONSTRAINT `x_policy_ref_user_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
) ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `x_policy_ref_group` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
- `guid` varchar(1024) DEFAULT NULL,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
`policy_id` bigint(20) NOT NULL,
`group_id` bigint(20) NOT NULL,
`group_name` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `x_policy_ref_group_UK_polId_groupId`(`policy_id`, `group_id`),
- CONSTRAINT `x_policy_ref_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_policy_ref_group_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_policy_ref_group_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
CONSTRAINT `x_policy_ref_group_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`)
) ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `x_security_zone_ref_resource`(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
-`create_time` datetime NULL DEFAULT NULL,
-`update_time` datetime NULL DEFAULT NULL,
-`added_by_id` bigint(20) NULL DEFAULT NULL,
-`upd_by_id` bigint(20) NULL DEFAULT NULL,
`zone_id` bigint(20) NOT NULL,
`resource_def_id` bigint(20) NOT NULL,
`resource_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
- CONSTRAINT `x_sz_ref_resource_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_sz_ref_resource_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_sz_ref_resource_FK_zone_id` FOREIGN KEY (`zone_id`) REFERENCES `x_security_zone` (`id`),
CONSTRAINT `x_sz_ref_resource_FK_resource_def_id` FOREIGN KEY (`resource_def_id`) REFERENCES `x_resource_def` (`id`)
) ROW_FORMAT=DYNAMIC;
@@ -1484,68 +1412,44 @@ CREATE TABLE IF NOT EXISTS `x_role`(
CREATE TABLE IF NOT EXISTS `x_role_ref_user`(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
-`create_time` datetime NULL DEFAULT NULL,
-`update_time` datetime NULL DEFAULT NULL,
-`added_by_id` bigint(20) NULL DEFAULT NULL,
-`upd_by_id` bigint(20) NULL DEFAULT NULL,
`role_id` bigint(20) NOT NULL,
`user_id` bigint(20) NULL DEFAULT NULL,
`user_name` varchar(767) NULL DEFAULT NULL,
`priv_type` int(10) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
- CONSTRAINT `x_role_ref_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_role_ref_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_role_ref_user_FK_role_id` FOREIGN KEY (`role_id`) REFERENCES `x_role` (`id`),
CONSTRAINT `x_role_ref_user_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
)ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `x_role_ref_group`(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
-`create_time` datetime NULL DEFAULT NULL,
-`update_time` datetime NULL DEFAULT NULL,
-`added_by_id` bigint(20) NULL DEFAULT NULL,
-`upd_by_id` bigint(20) NULL DEFAULT NULL,
`role_id` bigint(20) NOT NULL,
`group_id` bigint(20) NULL DEFAULT NULL,
`group_name` varchar(767) NULL DEFAULT NULL,
`priv_type` int(10) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
- CONSTRAINT `x_role_ref_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_role_ref_group_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_role_ref_group_FK_role_id` FOREIGN KEY (`role_id`) REFERENCES `x_role` (`id`),
CONSTRAINT `x_role_ref_group_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`)
)ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `x_policy_ref_role`(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
-`create_time` datetime NULL DEFAULT NULL,
-`update_time` datetime NULL DEFAULT NULL,
-`added_by_id` bigint(20) NULL DEFAULT NULL,
-`upd_by_id` bigint(20) NULL DEFAULT NULL,
`policy_id` bigint(20) NOT NULL,
`role_id` bigint(20) NOT NULL,
`role_name` varchar(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `x_policy_ref_role_UK_polId_roleId`(`policy_id`, `role_id`),
- CONSTRAINT `x_policy_ref_role_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_policy_ref_role_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_policy_ref_role_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
CONSTRAINT `x_policy_ref_role_FK_role_id` FOREIGN KEY (`role_id`) REFERENCES `x_role` (`id`)
)ROW_FORMAT=DYNAMIC;
CREATE TABLE IF NOT EXISTS `x_role_ref_role`(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
-`create_time` datetime NULL DEFAULT NULL,
-`update_time` datetime NULL DEFAULT NULL,
-`added_by_id` bigint(20) NULL DEFAULT NULL,
-`upd_by_id` bigint(20) NULL DEFAULT NULL,
`role_ref_id` bigint(20) NULL DEFAULT NULL,
`role_id` bigint(20) NOT NULL,
`role_name` varchar(255) NULL DEFAULT NULL,
`priv_type` int(10) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
- CONSTRAINT `x_role_ref_role_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_role_ref_role_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
CONSTRAINT `x_role_ref_role_FK_role_ref_id` FOREIGN KEY (`role_ref_id`) REFERENCES `x_role` (`id`)
)ROW_FORMAT=DYNAMIC;
@@ -2048,6 +1952,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 ('074',UTC_TIMESTAMP(),'Ranger 3.0.0',UTC_TIMESTAMP(),'localhost','Y');
INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('075',UTC_TIMESTAMP(),'Ranger 3.0.0',UTC_TIMESTAMP(),'localhost','Y');
INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('076',UTC_TIMESTAMP(),'Ranger 3.0.0',UTC_TIMESTAMP(),'localhost','Y');
+INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('077',UTC_TIMESTAMP(),'Ranger 3.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_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('J10001',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
diff --git a/security-admin/db/mysql/patches/077-drop-audit-columns-from-policy-ref-tables.sql b/security-admin/db/mysql/patches/077-drop-audit-columns-from-policy-ref-tables.sql
new file mode 100644
index 000000000..bb6462d46
--- /dev/null
+++ b/security-admin/db/mysql/patches/077-drop-audit-columns-from-policy-ref-tables.sql
@@ -0,0 +1,155 @@
+-- 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.
+
+-- Commented because dropping this column would break high-availability setups
+-- We can uncomment this after the next major version upgrade
+
+drop procedure if exists drop_table_column;
+delimiter ;;
+create procedure drop_table_column(IN tableName varchar(64), IN columnName varchar(64)) begin
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = tableName and column_name = columnName) then
+ SET @query = CONCAT('ALTER TABLE `', tableName,'` DROP COLUMN `', columnName,'`');
+ PREPARE stmt FROM @query;
+ EXECUTE stmt;
+ DEALLOCATE PREPARE stmt;
+ end if;
+end;;
+delimiter ;
+
+drop procedure if exists drop_table_foreign_key;
+delimiter ;;
+create procedure drop_table_foreign_key(IN tableName varchar(64), IN foreignKeyName varchar(64)) begin
+ if exists (select * from information_schema.table_constraints where table_schema=database() and table_name = tableName and constraint_name = foreignKeyName and constraint_type = 'FOREIGN KEY') then
+ SET @query = CONCAT('ALTER TABLE `', tableName,'` DROP FOREIGN KEY `', foreignKeyName,'`');
+ PREPARE stmt FROM @query;
+ EXECUTE stmt;
+ DEALLOCATE PREPARE stmt;
+ end if;
+end;;
+delimiter ;
+
+call drop_table_column('x_policy_ref_resource', 'guid');
+call drop_table_column('x_policy_ref_resource', 'create_time');
+call drop_table_column('x_policy_ref_resource', 'update_time');
+call drop_table_foreign_key('x_policy_ref_resource', 'x_policy_ref_res_FK_added_by_id');
+call drop_table_column('x_policy_ref_resource', 'added_by_id');
+call drop_table_foreign_key('x_policy_ref_resource', 'x_policy_ref_res_FK_upd_by_id');
+call drop_table_column('x_policy_ref_resource', 'upd_by_id');
+
+call drop_table_column('x_policy_ref_role', 'create_time');
+call drop_table_column('x_policy_ref_role', 'update_time');
+call drop_table_foreign_key('x_policy_ref_role', 'x_policy_ref_role_FK_added_by_id');
+call drop_table_column('x_policy_ref_role', 'added_by_id');
+call drop_table_foreign_key('x_policy_ref_role', 'x_policy_ref_role_FK_upd_by_id');
+call drop_table_column('x_policy_ref_role', 'upd_by_id');
+
+call drop_table_column('x_policy_ref_group', 'guid');
+call drop_table_column('x_policy_ref_group', 'create_time');
+call drop_table_column('x_policy_ref_group', 'update_time');
+call drop_table_foreign_key('x_policy_ref_group', 'x_policy_ref_group_FK_added_by_id');
+call drop_table_column('x_policy_ref_group', 'added_by_id');
+call drop_table_foreign_key('x_policy_ref_group', 'x_policy_ref_group_FK_upd_by_id');
+call drop_table_column('x_policy_ref_group', 'upd_by_id');
+
+call drop_table_column('x_policy_ref_user', 'guid');
+call drop_table_column('x_policy_ref_user', 'create_time');
+call drop_table_column('x_policy_ref_user', 'update_time');
+call drop_table_foreign_key('x_policy_ref_user', 'x_policy_ref_user_FK_added_by_id');
+call drop_table_column('x_policy_ref_user', 'added_by_id');
+call drop_table_foreign_key('x_policy_ref_user', 'x_policy_ref_user_FK_upd_by_id');
+call drop_table_column('x_policy_ref_user', 'upd_by_id');
+
+call drop_table_column('x_policy_ref_access_type', 'guid');
+call drop_table_column('x_policy_ref_access_type', 'create_time');
+call drop_table_column('x_policy_ref_access_type', 'update_time');
+call drop_table_foreign_key('x_policy_ref_access_type', 'x_policy_ref_access_FK_added_by_id');
+call drop_table_column('x_policy_ref_access_type', 'added_by_id');
+call drop_table_foreign_key('x_policy_ref_access_type', 'x_policy_ref_access_FK_upd_by_id');
+call drop_table_column('x_policy_ref_access_type', 'upd_by_id');
+
+call drop_table_column('x_policy_ref_condition', 'guid');
+call drop_table_column('x_policy_ref_condition', 'create_time');
+call drop_table_column('x_policy_ref_condition', 'update_time');
+call drop_table_foreign_key('x_policy_ref_condition', 'x_policy_ref_condition_FK_added_by_id');
+call drop_table_column('x_policy_ref_condition', 'added_by_id');
+call drop_table_foreign_key('x_policy_ref_condition', 'x_policy_ref_condition_FK_upd_by_id');
+call drop_table_column('x_policy_ref_condition', 'upd_by_id');
+
+call drop_table_column('x_policy_ref_datamask_type', 'guid');
+call drop_table_column('x_policy_ref_datamask_type', 'create_time');
+call drop_table_column('x_policy_ref_datamask_type', 'update_time');
+call drop_table_foreign_key('x_policy_ref_datamask_type', 'x_policy_ref_datamask_FK_added_by_id');
+call drop_table_column('x_policy_ref_datamask_type', 'added_by_id');
+call drop_table_foreign_key('x_policy_ref_datamask_type', 'x_policy_ref_datamask_FK_upd_by_id');
+call drop_table_column('x_policy_ref_datamask_type', 'upd_by_id');
+
+call drop_table_column('x_security_zone_ref_service', 'create_time');
+call drop_table_column('x_security_zone_ref_service', 'update_time');
+call drop_table_foreign_key('x_security_zone_ref_service', 'x_sz_ref_service_FK_added_by_id');
+call drop_table_column('x_security_zone_ref_service', 'added_by_id');
+call drop_table_foreign_key('x_security_zone_ref_service', 'x_sz_ref_service_FK_upd_by_id');
+call drop_table_column('x_security_zone_ref_service', 'upd_by_id');
+
+call drop_table_column('x_security_zone_ref_tag_srvc', 'create_time');
+call drop_table_column('x_security_zone_ref_tag_srvc', 'update_time');
+call drop_table_foreign_key('x_security_zone_ref_tag_srvc', 'x_sz_ref_tag_service_FK_added_by_id');
+call drop_table_column('x_security_zone_ref_tag_srvc', 'added_by_id');
+call drop_table_foreign_key('x_security_zone_ref_tag_srvc', 'x_sz_ref_tag_service_FK_upd_by_id');
+call drop_table_column('x_security_zone_ref_tag_srvc', 'upd_by_id');
+
+call drop_table_column('x_security_zone_ref_user', 'create_time');
+call drop_table_column('x_security_zone_ref_user', 'update_time');
+call drop_table_foreign_key('x_security_zone_ref_user', 'x_sz_ref_user_FK_added_by_id');
+call drop_table_column('x_security_zone_ref_user', 'added_by_id');
+call drop_table_foreign_key('x_security_zone_ref_user', 'x_sz_ref_user_FK_upd_by_id');
+call drop_table_column('x_security_zone_ref_user', 'upd_by_id');
+
+call drop_table_column('x_security_zone_ref_group', 'create_time');
+call drop_table_column('x_security_zone_ref_group', 'update_time');
+call drop_table_foreign_key('x_security_zone_ref_group', 'x_sz_ref_group_FK_added_by_id');
+call drop_table_column('x_security_zone_ref_group', 'added_by_id');
+call drop_table_foreign_key('x_security_zone_ref_group', 'x_sz_ref_group_FK_upd_by_id');
+call drop_table_column('x_security_zone_ref_group', 'upd_by_id');
+
+call drop_table_column('x_security_zone_ref_resource', 'create_time');
+call drop_table_column('x_security_zone_ref_resource', 'update_time');
+call drop_table_foreign_key('x_security_zone_ref_resource', 'x_sz_ref_resource_FK_added_by_id');
+call drop_table_column('x_security_zone_ref_resource', 'added_by_id');
+call drop_table_foreign_key('x_security_zone_ref_resource', 'x_sz_ref_resource_FK_upd_by_id');
+call drop_table_column('x_security_zone_ref_resource', 'upd_by_id');
+
+call drop_table_column('x_role_ref_user', 'create_time');
+call drop_table_column('x_role_ref_user', 'update_time');
+call drop_table_foreign_key('x_role_ref_user', 'x_role_ref_user_FK_added_by_id');
+call drop_table_column('x_role_ref_user', 'added_by_id');
+call drop_table_foreign_key('x_role_ref_user', 'x_role_ref_user_FK_upd_by_id');
+call drop_table_column('x_role_ref_user', 'upd_by_id');
+
+call drop_table_column('x_role_ref_group', 'create_time');
+call drop_table_column('x_role_ref_group', 'update_time');
+call drop_table_foreign_key('x_role_ref_group', 'x_role_ref_group_FK_added_by_id');
+call drop_table_column('x_role_ref_group', 'added_by_id');
+call drop_table_foreign_key('x_role_ref_group', 'x_role_ref_group_FK_upd_by_id');
+call drop_table_column('x_role_ref_group', 'upd_by_id');
+
+call drop_table_column('x_role_ref_role', 'create_time');
+call drop_table_column('x_role_ref_role', 'update_time');
+call drop_table_foreign_key('x_role_ref_role', 'x_role_ref_role_FK_added_by_id');
+call drop_table_column('x_role_ref_role', 'added_by_id');
+call drop_table_foreign_key('x_role_ref_role', 'x_role_ref_role_FK_upd_by_id');
+call drop_table_column('x_role_ref_role', 'upd_by_id');
+
+drop procedure if exists drop_table_column;
+drop procedure if exists drop_table_foreign_key;
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 0e9f5dc36..006c04788 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
@@ -729,16 +729,10 @@ commit;
CREATE TABLE x_security_zone_ref_service (
id NUMBER(20) NOT NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
zone_id NUMBER(20) DEFAULT NULL NULL,
service_id NUMBER(20) DEFAULT NULL NULL,
service_name VARCHAR(255) DEFAULT NULL NULL,
primary key (id),
-CONSTRAINT x_sz_ref_ser_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_ref_ser_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_ref_ser_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_ref_ser_FK_service_id FOREIGN KEY (service_id) REFERENCES x_service (id),
CONSTRAINT x_sz_ref_ser_FK_service_name FOREIGN KEY (service_name) REFERENCES x_service (name)
@@ -747,16 +741,10 @@ commit;
CREATE TABLE x_security_zone_ref_tag_srvc (
id NUMBER(20) NOT NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
zone_id NUMBER(20) DEFAULT NULL NULL,
tag_srvc_id NUMBER(20) DEFAULT NULL NULL,
tag_srvc_name VARCHAR(255) DEFAULT NULL NULL,
primary key (id),
-CONSTRAINT x_sz_refTagTser_FK_aded_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_refTagTser_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_refTagTser_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_refTagTser_FK_srvc_id FOREIGN KEY (tag_srvc_id) REFERENCES x_service (id),
CONSTRAINT x_sz_refTagTser_FK_srvc_name FOREIGN KEY (tag_srvc_name) REFERENCES x_service (name)
@@ -765,17 +753,11 @@ commit;
CREATE TABLE x_security_zone_ref_user (
id NUMBER(20) NOT NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
zone_id NUMBER(20) DEFAULT NULL NULL,
user_id NUMBER(20) DEFAULT NULL NULL,
user_name varchar(255) DEFAULT NULL NULL,
user_type NUMBER(3) DEFAULT NULL NULL,
primary key (id),
-CONSTRAINT x_sz_ref_user_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_ref_user_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_ref_user_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_ref_user_FK_user_id FOREIGN KEY (user_id) REFERENCES x_user (id),
CONSTRAINT x_sz_ref_user_FK_user_name FOREIGN KEY (user_name) REFERENCES x_user (user_name)
@@ -784,17 +766,11 @@ commit;
CREATE TABLE x_security_zone_ref_group (
id NUMBER(20) NOT NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
zone_id NUMBER(20) DEFAULT NULL NULL,
group_id NUMBER(20) DEFAULT NULL NULL,
group_name varchar(255) DEFAULT NULL NULL,
group_type NUMBER(3) DEFAULT NULL NULL,
primary key (id),
-CONSTRAINT x_sz_ref_group_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_ref_group_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_ref_group_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_ref_group_FK_group_id FOREIGN KEY (group_id) REFERENCES x_group (id)
);
@@ -1423,110 +1399,68 @@ commit;
CREATE TABLE x_policy_ref_resource (
id NUMBER(20) NOT NULL,
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
policy_id NUMBER(20) NOT NULL,
resource_def_id NUMBER(20) NOT NULL,
resource_name VARCHAR(4000) DEFAULT NULL NULL,
primary key (id),
CONSTRAINT x_p_ref_res_UK_polId_resDefId UNIQUE (policy_id, resource_def_id),
CONSTRAINT x_p_ref_res_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
-CONSTRAINT x_p_ref_res_FK_resource_def_id FOREIGN KEY (resource_def_id) REFERENCES x_resource_def (id),
-CONSTRAINT x_p_ref_res_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_p_ref_res_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+CONSTRAINT x_p_ref_res_FK_resource_def_id FOREIGN KEY (resource_def_id) REFERENCES x_resource_def (id)
);
commit;
CREATE TABLE x_policy_ref_access_type (
id NUMBER(20) NOT NULL,
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
policy_id NUMBER(20) NOT NULL,
access_def_id NUMBER(20) NOT NULL,
access_type_name VARCHAR(4000) DEFAULT NULL NULL,
primary key (id),
CONSTRAINT x_p_ref_acc_UK_polId_accDefId UNIQUE(policy_id, access_def_id),
CONSTRAINT x_p_ref_acc_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
-CONSTRAINT x_p_ref_acc_FK_acc_def_id FOREIGN KEY (access_def_id) REFERENCES x_access_type_def (id),
-CONSTRAINT x_p_ref_acc_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_p_ref_acc_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+CONSTRAINT x_p_ref_acc_FK_acc_def_id FOREIGN KEY (access_def_id) REFERENCES x_access_type_def (id)
);
commit;
CREATE TABLE x_policy_ref_condition (
id NUMBER(20) NOT NULL,
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
policy_id NUMBER(20) NOT NULL,
condition_def_id NUMBER(20) NOT NULL,
condition_name VARCHAR(4000) DEFAULT NULL NULL,
primary key (id),
CONSTRAINT x_p_ref_cond_UK_polId_cDefId UNIQUE(policy_id, condition_def_id),
CONSTRAINT x_p_ref_cond_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
-CONSTRAINT x_p_ref_cond_FK_cond_def_id FOREIGN KEY (condition_def_id) REFERENCES x_policy_condition_def (id),
-CONSTRAINT x_p_ref_cond_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_p_ref_cond_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+CONSTRAINT x_p_ref_cond_FK_cond_def_id FOREIGN KEY (condition_def_id) REFERENCES x_policy_condition_def (id)
);
commit;
CREATE TABLE x_policy_ref_datamask_type (
id NUMBER(20) NOT NULL,
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
policy_id NUMBER(20) NOT NULL,
datamask_def_id NUMBER(20) NOT NULL,
datamask_type_name VARCHAR(4000) DEFAULT NULL NULL,
primary key (id),
CONSTRAINT x_p_ref_dmsk_UK_polId_dDefId UNIQUE(policy_id, datamask_def_id),
CONSTRAINT x_p_ref_dmsk_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
-CONSTRAINT x_p_ref_dmsk_FK_dmk_def_id FOREIGN KEY (datamask_def_id) REFERENCES x_datamask_type_def (id),
-CONSTRAINT x_p_ref_dmsk_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_p_ref_dmsk_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+CONSTRAINT x_p_ref_dmsk_FK_dmk_def_id FOREIGN KEY (datamask_def_id) REFERENCES x_datamask_type_def (id)
);
commit;
CREATE TABLE x_policy_ref_user (
id NUMBER(20) NOT NULL,
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
policy_id NUMBER(20) NOT NULL,
user_id NUMBER(20) NOT NULL,
user_name VARCHAR(4000) DEFAULT NULL NULL,
primary key (id),
CONSTRAINT x_p_ref_usr_UK_polId_userId UNIQUE(policy_id, user_id),
CONSTRAINT x_p_ref_usr_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
-CONSTRAINT x_p_ref_usr_FK_user_id FOREIGN KEY (user_id) REFERENCES x_user (id),
-CONSTRAINT x_p_ref_usr_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_p_ref_usr_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+CONSTRAINT x_p_ref_usr_FK_user_id FOREIGN KEY (user_id) REFERENCES x_user (id)
);
commit;
CREATE TABLE x_policy_ref_group (
id NUMBER(20) NOT NULL,
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
policy_id NUMBER(20) NOT NULL,
group_id NUMBER(20) NOT NULL,
group_name VARCHAR(4000) DEFAULT NULL NULL,
primary key (id),
CONSTRAINT x_p_ref_grp_UK_polId_grpId UNIQUE(policy_id, group_id),
CONSTRAINT x_p_ref_grp_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
-CONSTRAINT x_p_ref_grp_FK_group_id FOREIGN KEY (group_id) REFERENCES x_group (id),
-CONSTRAINT x_p_ref_grp_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_p_ref_grp_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+CONSTRAINT x_p_ref_grp_FK_group_id FOREIGN KEY (group_id) REFERENCES x_group (id)
);
commit;
CREATE TABLE x_policy_change_log(
@@ -1582,17 +1516,11 @@ commit;
CREATE TABLE x_role_ref_user(
id NUMBER(20) NOT NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
role_id NUMBER(20) NOT NULL,
user_id NUMBER(20) DEFAULT NULL NULL,
user_name varchar(767) DEFAULT NULL NULL,
priv_type NUMBER(10) DEFAULT NULL NULL,
PRIMARY KEY (id),
- CONSTRAINT x_role_ref_user_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
- CONSTRAINT x_role_ref_user_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_role_ref_user_FK_role_id FOREIGN KEY (role_id) REFERENCES x_role (id),
CONSTRAINT x_role_ref_user_FK_user_id FOREIGN KEY (user_id) REFERENCES x_user (id)
);
@@ -1600,17 +1528,11 @@ commit;
CREATE TABLE x_role_ref_group(
id NUMBER(20) NOT NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
role_id NUMBER(20) NOT NULL,
group_id NUMBER(20) DEFAULT NULL NULL,
group_name varchar(767) DEFAULT NULL NULL,
priv_type NUMBER(10) DEFAULT NULL NULL,
PRIMARY KEY (id),
- CONSTRAINT x_role_ref_grp_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
- CONSTRAINT x_role_ref_grp_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_role_ref_grp_FK_role_id FOREIGN KEY (role_id) REFERENCES x_role (id),
CONSTRAINT x_role_ref_grp_FK_group_id FOREIGN KEY (group_id) REFERENCES x_group (id)
);
@@ -1619,17 +1541,11 @@ commit;
CREATE TABLE x_policy_ref_role(
id NUMBER(20) NOT NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
policy_id NUMBER(20) NOT NULL,
role_id NUMBER(20) NOT NULL,
role_name varchar(255) DEFAULT NULL NULL,
PRIMARY KEY (id),
CONSTRAINT x_pol_ref_role_UK_polId_roleId UNIQUE(policy_id,role_id),
- CONSTRAINT x_pol_ref_role_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
- CONSTRAINT x_pol_ref_role_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_pol_ref_role_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
CONSTRAINT x_pol_ref_role_FK_role_id FOREIGN KEY (role_id) REFERENCES x_role (id)
);
@@ -1637,33 +1553,21 @@ commit;
CREATE TABLE x_role_ref_role(
id NUMBER(20) NOT NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
role_ref_id NUMBER(20) DEFAULT NULL NULL,
role_id NUMBER(20) NOT NULL,
role_name varchar(255) DEFAULT NULL NULL,
priv_type NUMBER(10) DEFAULT NULL NULL,
PRIMARY KEY (id),
- CONSTRAINT x_role_ref_role_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
- CONSTRAINT x_role_ref_role_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_role_ref_role_FK_role_ref_id FOREIGN KEY (role_ref_id) REFERENCES x_role (id)
);
commit;
CREATE TABLE x_security_zone_ref_resource (
id NUMBER(20) NOT NULL,
-create_time DATE DEFAULT NULL NULL,
-update_time DATE DEFAULT NULL NULL,
-added_by_id NUMBER(20) DEFAULT NULL NULL,
-upd_by_id NUMBER(20) DEFAULT NULL NULL,
zone_id NUMBER(20) DEFAULT NULL NULL,
resource_def_id NUMBER(20) DEFAULT NULL NULL,
resource_name VARCHAR(255) DEFAULT NULL NULL,
primary key (id),
-CONSTRAINT x_sz_ref_res_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_ref_res_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_ref_res_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_ref_res_FK_res_def_id FOREIGN KEY (resource_def_id) REFERENCES x_resource_def (id)
);
@@ -2240,6 +2144,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, '074',sys_extract_utc(systimestamp),'Ranger 3.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, '075',sys_extract_utc(systimestamp),'Ranger 3.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, '076',sys_extract_utc(systimestamp),'Ranger 3.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, '077',sys_extract_utc(systimestamp),'Ranger 3.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/077-drop-audit-columns-from-policy-ref-tables.sql b/security-admin/db/oracle/patches/077-drop-audit-columns-from-policy-ref-tables.sql
new file mode 100644
index 000000000..d5e1b3011
--- /dev/null
+++ b/security-admin/db/oracle/patches/077-drop-audit-columns-from-policy-ref-tables.sql
@@ -0,0 +1,110 @@
+-- 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.
+
+-- Commented because dropping this column would break high-availability setups
+-- We can uncomment this after the next major version upgrade
+
+CREATE OR REPLACE PROCEDURE spdroptablecolumn(TableName IN varchar2, ColumnName IN varchar2)
+IS
+ v_column_exists number := 0;
+BEGIN
+ select count(*) into v_column_exists from user_tab_cols where table_name = upper(TableName) and column_name = upper(ColumnName);
+ if (v_column_exists > 0) then
+ execute immediate 'ALTER TABLE ' || TableName || ' DROP COLUMN ' || ColumnName || ' CASCADE CONSTRAINTS';
+ commit;
+ end if;
+END;/
+/
+
+call spdroptablecolumn('x_policy_ref_resource', 'guid');
+call spdroptablecolumn('x_policy_ref_resource', 'create_time');
+call spdroptablecolumn('x_policy_ref_resource', 'update_time');
+call spdroptablecolumn('x_policy_ref_resource', 'added_by_id');
+call spdroptablecolumn('x_policy_ref_resource', 'upd_by_id');
+
+call spdroptablecolumn('x_policy_ref_role', 'create_time');
+call spdroptablecolumn('x_policy_ref_role', 'update_time');
+call spdroptablecolumn('x_policy_ref_role', 'added_by_id');
+call spdroptablecolumn('x_policy_ref_role', 'upd_by_id');
+
+call spdroptablecolumn('x_policy_ref_group', 'guid');
+call spdroptablecolumn('x_policy_ref_group', 'create_time');
+call spdroptablecolumn('x_policy_ref_group', 'update_time');
+call spdroptablecolumn('x_policy_ref_group', 'added_by_id');
+call spdroptablecolumn('x_policy_ref_group', 'upd_by_id');
+
+call spdroptablecolumn('x_policy_ref_user', 'guid');
+call spdroptablecolumn('x_policy_ref_user', 'create_time');
+call spdroptablecolumn('x_policy_ref_user', 'update_time');
+call spdroptablecolumn('x_policy_ref_user', 'added_by_id');
+call spdroptablecolumn('x_policy_ref_user', 'upd_by_id');
+
+call spdroptablecolumn('x_policy_ref_access_type', 'guid');
+call spdroptablecolumn('x_policy_ref_access_type', 'create_time');
+call spdroptablecolumn('x_policy_ref_access_type', 'update_time');
+call spdroptablecolumn('x_policy_ref_access_type', 'added_by_id');
+call spdroptablecolumn('x_policy_ref_access_type', 'upd_by_id');
+
+call spdroptablecolumn('x_policy_ref_condition', 'guid');
+call spdroptablecolumn('x_policy_ref_condition', 'create_time');
+call spdroptablecolumn('x_policy_ref_condition', 'update_time');
+call spdroptablecolumn('x_policy_ref_condition', 'added_by_id');
+call spdroptablecolumn('x_policy_ref_condition', 'upd_by_id');
+
+call spdroptablecolumn('x_policy_ref_datamask_type', 'guid');
+call spdroptablecolumn('x_policy_ref_datamask_type', 'create_time');
+call spdroptablecolumn('x_policy_ref_datamask_type', 'update_time');
+call spdroptablecolumn('x_policy_ref_datamask_type', 'added_by_id');
+call spdroptablecolumn('x_policy_ref_datamask_type', 'upd_by_id');
+
+call spdroptablecolumn('x_security_zone_ref_service', 'create_time');
+call spdroptablecolumn('x_security_zone_ref_service', 'update_time');
+call spdroptablecolumn('x_security_zone_ref_service', 'added_by_id');
+call spdroptablecolumn('x_security_zone_ref_service', 'upd_by_id');
+
+call spdroptablecolumn('x_security_zone_ref_tag_srvc', 'create_time');
+call spdroptablecolumn('x_security_zone_ref_tag_srvc', 'update_time');
+call spdroptablecolumn('x_security_zone_ref_tag_srvc', 'added_by_id');
+call spdroptablecolumn('x_security_zone_ref_tag_srvc', 'upd_by_id');
+
+call spdroptablecolumn('x_security_zone_ref_user', 'create_time');
+call spdroptablecolumn('x_security_zone_ref_user', 'update_time');
+call spdroptablecolumn('x_security_zone_ref_user', 'added_by_id');
+call spdroptablecolumn('x_security_zone_ref_user', 'upd_by_id');
+
+call spdroptablecolumn('x_security_zone_ref_group', 'create_time');
+call spdroptablecolumn('x_security_zone_ref_group', 'update_time');
+call spdroptablecolumn('x_security_zone_ref_group', 'added_by_id');
+call spdroptablecolumn('x_security_zone_ref_group', 'upd_by_id');
+
+call spdroptablecolumn('x_security_zone_ref_resource', 'create_time');
+call spdroptablecolumn('x_security_zone_ref_resource', 'update_time');
+call spdroptablecolumn('x_security_zone_ref_resource', 'added_by_id');
+call spdroptablecolumn('x_security_zone_ref_resource', 'upd_by_id');
+
+call spdroptablecolumn('x_role_ref_user', 'create_time');
+call spdroptablecolumn('x_role_ref_user', 'update_time');
+call spdroptablecolumn('x_role_ref_user', 'added_by_id');
+call spdroptablecolumn('x_role_ref_user', 'upd_by_id');
+
+call spdroptablecolumn('x_role_ref_group', 'create_time');
+call spdroptablecolumn('x_role_ref_group', 'update_time');
+call spdroptablecolumn('x_role_ref_group', 'added_by_id');
+call spdroptablecolumn('x_role_ref_group', 'upd_by_id');
+
+call spdroptablecolumn('x_role_ref_role', 'create_time');
+call spdroptablecolumn('x_role_ref_role', 'update_time');
+call spdroptablecolumn('x_role_ref_role', 'added_by_id');
+call spdroptablecolumn('x_role_ref_role', 'upd_by_id');
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 49a956ebf..8aa20a8dd 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
@@ -1268,40 +1268,26 @@ primary key (id)
CREATE SEQUENCE x_policy_ref_resource_seq;
CREATE TABLE x_policy_ref_resource(
id BIGINT DEFAULT nextval('x_policy_ref_resource_seq'::regclass),
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
policy_id BIGINT NOT NULL,
resource_def_id BIGINT NOT NULL,
resource_name varchar(4000) DEFAULT NULL,
primary key(id),
CONSTRAINT x_p_ref_res_UK_polId_resDefId UNIQUE (policy_id, resource_def_id),
CONSTRAINT x_p_ref_res_FK_policy_id FOREIGN KEY(policy_id) REFERENCES x_policy(id),
-CONSTRAINT x_p_ref_res_FK_resource_def_id FOREIGN KEY(resource_def_id) REFERENCES x_resource_def(id),
-CONSTRAINT x_p_ref_res_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES x_portal_user(id),
-CONSTRAINT x_p_ref_res_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES x_portal_user(id)
+CONSTRAINT x_p_ref_res_FK_resource_def_id FOREIGN KEY(resource_def_id) REFERENCES x_resource_def(id)
);
commit;
CREATE SEQUENCE x_policy_ref_access_type_seq;
CREATE TABLE x_policy_ref_access_type(
id BIGINT DEFAULT nextval('x_policy_ref_access_type_seq'::regclass),
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
policy_id BIGINT NOT NULL,
access_def_id BIGINT NOT NULL,
access_type_name varchar(4000) DEFAULT NULL,
primary key(id),
CONSTRAINT x_p_ref_acc_UK_polId_accDefId UNIQUE(policy_id, access_def_id),
CONSTRAINT x_p_ref_acc_FK_policy_id FOREIGN KEY(policy_id) REFERENCES x_policy(id),
-CONSTRAINT x_p_ref_acc_FK_acc_def_id FOREIGN KEY(access_def_id) REFERENCES x_access_type_def(id),
-CONSTRAINT x_p_ref_acc_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES x_portal_user(id),
-CONSTRAINT x_p_ref_acc_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES x_portal_user(id)
+CONSTRAINT x_p_ref_acc_FK_acc_def_id FOREIGN KEY(access_def_id) REFERENCES x_access_type_def(id)
);
commit;
DROP TABLE IF EXISTS x_policy_ref_condition CASCADE;
@@ -1309,96 +1295,62 @@ DROP SEQUENCE IF EXISTS x_policy_ref_condition_seq;
CREATE SEQUENCE x_policy_ref_condition_seq;
CREATE TABLE x_policy_ref_condition(
id BIGINT DEFAULT nextval('x_policy_ref_condition_seq'::regclass),
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
policy_id BIGINT NOT NULL,
condition_def_id BIGINT NOT NULL,
condition_name varchar(4000) DEFAULT NULL,
primary key(id),
CONSTRAINT x_p_ref_cond_UK_polId_cDefId UNIQUE(policy_id, condition_def_id),
CONSTRAINT x_p_ref_cond_FK_policy_id FOREIGN KEY(policy_id) REFERENCES x_policy(id),
-CONSTRAINT x_p_ref_cond_FK_cond_def_id FOREIGN KEY(condition_def_id) REFERENCES x_policy_condition_def(id),
-CONSTRAINT x_p_ref_cond_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES x_portal_user(id),
-CONSTRAINT x_p_ref_cond_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES x_portal_user(id)
+CONSTRAINT x_p_ref_cond_FK_cond_def_id FOREIGN KEY(condition_def_id) REFERENCES x_policy_condition_def(id)
);
commit;
CREATE SEQUENCE x_policy_ref_datamask_type_seq;
CREATE TABLE x_policy_ref_datamask_type(
id BIGINT DEFAULT nextval('x_policy_ref_datamask_type_seq'::regclass),
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
policy_id BIGINT NOT NULL,
datamask_def_id BIGINT NOT NULL,
datamask_type_name varchar(4000) DEFAULT NULL,
primary key(id),
CONSTRAINT x_p_ref_dmk_UK_polId_dDefId UNIQUE(policy_id, datamask_def_id),
CONSTRAINT x_p_ref_dmk_FK_policy_id FOREIGN KEY(policy_id) REFERENCES x_policy(id),
-CONSTRAINT x_p_ref_dmk_FK_dmk_def_id FOREIGN KEY(datamask_def_id) REFERENCES x_datamask_type_def(id),
-CONSTRAINT x_p_ref_dmk_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES x_portal_user(id),
-CONSTRAINT x_p_ref_dmk_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES x_portal_user(id)
+CONSTRAINT x_p_ref_dmk_FK_dmk_def_id FOREIGN KEY(datamask_def_id) REFERENCES x_datamask_type_def(id)
);
commit;
CREATE SEQUENCE x_policy_ref_user_seq;
CREATE TABLE x_policy_ref_user(
id BIGINT DEFAULT nextval('x_policy_ref_user_seq'::regclass),
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
policy_id BIGINT NOT NULL,
user_id BIGINT NOT NULL,
user_name varchar(4000) DEFAULT NULL,
primary key(id),
CONSTRAINT x_p_ref_usr_UK_polId_userId UNIQUE(policy_id, user_id),
CONSTRAINT x_p_ref_usr_FK_policy_id FOREIGN KEY(policy_id) REFERENCES x_policy(id),
-CONSTRAINT x_p_ref_usr_FK_user_id FOREIGN KEY(user_id) REFERENCES x_user(id),
-CONSTRAINT x_p_ref_usr_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES x_portal_user(id),
-CONSTRAINT x_p_ref_usr_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES x_portal_user(id)
+CONSTRAINT x_p_ref_usr_FK_user_id FOREIGN KEY(user_id) REFERENCES x_user(id)
);
commit;
CREATE SEQUENCE x_policy_ref_group_seq;
CREATE TABLE x_policy_ref_group(
id BIGINT DEFAULT nextval('x_policy_ref_group_seq'::regclass),
-guid VARCHAR(1024) DEFAULT NULL NULL,
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
policy_id BIGINT NOT NULL,
group_id BIGINT NOT NULL,
group_name varchar(4000) DEFAULT NULL,
primary key(id),
CONSTRAINT x_p_ref_grp_UK_polId_grpId UNIQUE(policy_id, group_id),
CONSTRAINT x_p_ref_grp_FK_policy_id FOREIGN KEY(policy_id) REFERENCES x_policy(id),
-CONSTRAINT x_p_ref_grp_FK_group_id FOREIGN KEY(group_id) REFERENCES x_group(id),
-CONSTRAINT x_p_ref_grp_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES x_portal_user(id),
-CONSTRAINT x_p_ref_grp_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES x_portal_user(id)
+CONSTRAINT x_p_ref_grp_FK_group_id FOREIGN KEY(group_id) REFERENCES x_group(id)
);
commit;
CREATE SEQUENCE x_sec_zone_ref_service_seq;
CREATE TABLE x_security_zone_ref_service (
id BIGINT DEFAULT nextval('x_sec_zone_ref_service_seq'::regclass),
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
zone_id BIGINT DEFAULT NULL NULL,
service_id BIGINT DEFAULT NULL NULL,
service_name varchar(255) NULL DEFAULT NULL::character varying,
primary key (id),
-CONSTRAINT x_sz_ref_service_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_ref_service_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_ref_service_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_ref_service_FK_service_id FOREIGN KEY (service_id) REFERENCES x_service (id),
CONSTRAINT x_sz_ref_service_FK_service_name FOREIGN KEY (service_name) REFERENCES x_service (name)
@@ -1407,16 +1359,10 @@ CONSTRAINT x_sz_ref_service_FK_service_name FOREIGN KEY (service_name) REFERENCE
CREATE SEQUENCE x_sec_zone_ref_tag_srvc_seq;
CREATE TABLE x_security_zone_ref_tag_srvc (
id BIGINT DEFAULT nextval('x_sec_zone_ref_tag_srvc_SEQ'::regclass),
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
zone_id BIGINT DEFAULT NULL NULL,
tag_srvc_id BIGINT DEFAULT NULL NULL,
tag_srvc_name varchar(255) NULL DEFAULT NULL::character varying,
primary key (id),
-CONSTRAINT x_sz_refTagSrvc_FK_aded_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_refTagSrvc_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_refTagSrvc_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_refTagSrvc_FK_tag_srvc_id FOREIGN KEY (tag_srvc_id) REFERENCES x_service (id),
CONSTRAINT x_sz_refTagSrvc_FK_tag_srvc_name FOREIGN KEY (tag_srvc_name) REFERENCES x_service (name)
@@ -1425,16 +1371,10 @@ CONSTRAINT x_sz_refTagSrvc_FK_tag_srvc_name FOREIGN KEY (tag_srvc_name) REFERENC
CREATE SEQUENCE x_sec_zone_ref_resource_seq;
CREATE TABLE x_security_zone_ref_resource (
id BIGINT DEFAULT nextval('x_sec_zone_ref_resource_seq'::regclass),
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
zone_id BIGINT DEFAULT NULL NULL,
resource_def_id BIGINT DEFAULT NULL NULL,
resource_name varchar(255) NULL DEFAULT NULL::character varying,
primary key (id),
-CONSTRAINT x_sz_ref_res_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_ref_res_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_ref_service_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_ref_res_FK_resource_def_id FOREIGN KEY (resource_def_id) REFERENCES x_resource_def (id)
);
@@ -1442,17 +1382,11 @@ CONSTRAINT x_sz_ref_res_FK_resource_def_id FOREIGN KEY (resource_def_id) REFEREN
CREATE SEQUENCE x_sec_zone_ref_user_seq;
CREATE TABLE x_security_zone_ref_user (
id BIGINT DEFAULT nextval('x_sec_zone_ref_user_seq'::regclass),
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
zone_id BIGINT DEFAULT NULL NULL,
user_id BIGINT DEFAULT NULL NULL,
user_name varchar(255) NULL DEFAULT NULL::character varying,
user_type SMALLINT DEFAULT NULL NULL,
primary key (id),
-CONSTRAINT x_sz_ref_user_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_ref_user_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_ref_user_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_ref_user_FK_user_id FOREIGN KEY (user_id) REFERENCES x_user (id),
CONSTRAINT x_sz_ref_user_FK_user_name FOREIGN KEY (user_name) REFERENCES x_user (user_name)
@@ -1461,17 +1395,11 @@ CONSTRAINT x_sz_ref_user_FK_user_name FOREIGN KEY (user_name) REFERENCES x_user
CREATE SEQUENCE x_sec_zone_ref_group_seq;
CREATE TABLE x_security_zone_ref_group (
id BIGINT DEFAULT nextval('x_sec_zone_ref_group_seq'::regclass),
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
zone_id BIGINT DEFAULT NULL NULL,
group_id BIGINT DEFAULT NULL NULL,
group_name varchar(255) NULL DEFAULT NULL::character varying,
group_type SMALLINT DEFAULT NULL NULL,
primary key (id),
-CONSTRAINT x_sz_ref_group_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
-CONSTRAINT x_sz_ref_group_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_sz_ref_group_FK_zone_id FOREIGN KEY (zone_id) REFERENCES x_security_zone (id),
CONSTRAINT x_sz_ref_group_FK_group_id FOREIGN KEY (group_id) REFERENCES x_group (id)
);
@@ -1515,17 +1443,11 @@ commit;
CREATE SEQUENCE x_role_ref_user_SEQ;
CREATE TABLE x_role_ref_user(
id BIGINT DEFAULT nextval('x_role_ref_user_SEQ'::regclass),
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
role_id BIGINT NOT NULL,
user_id BIGINT DEFAULT NULL NULL,
user_name varchar(767) DEFAULT NULL NULL,
priv_type INT DEFAULT NULL NULL,
PRIMARY KEY (id),
- CONSTRAINT x_role_ref_user_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
- CONSTRAINT x_role_ref_user_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_role_ref_user_FK_role_id FOREIGN KEY (role_id) REFERENCES x_role (id),
CONSTRAINT x_role_ref_user_FK_user_id FOREIGN KEY (user_id) REFERENCES x_user (id)
);
@@ -1534,17 +1456,11 @@ commit;
CREATE SEQUENCE x_role_ref_group_SEQ;
CREATE TABLE x_role_ref_group(
id BIGINT DEFAULT nextval('x_role_ref_group_SEQ'::regclass),
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
role_id BIGINT NOT NULL,
group_id BIGINT DEFAULT NULL NULL,
group_name varchar(767) DEFAULT NULL NULL,
priv_type INT DEFAULT NULL NULL,
PRIMARY KEY (id),
- CONSTRAINT x_role_ref_grp_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
- CONSTRAINT x_role_ref_grp_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_role_ref_grp_FK_role_id FOREIGN KEY (role_id) REFERENCES x_role (id),
CONSTRAINT x_role_ref_grp_FK_group_id FOREIGN KEY (group_id) REFERENCES x_group (id)
);
@@ -1553,17 +1469,11 @@ commit;
CREATE SEQUENCE x_policy_ref_role_SEQ;
CREATE TABLE x_policy_ref_role(
id BIGINT DEFAULT nextval('x_policy_ref_role_SEQ'::regclass),
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
policy_id BIGINT NOT NULL,
role_id BIGINT NOT NULL,
role_name varchar(255) DEFAULT NULL,
PRIMARY KEY (id),
CONSTRAINT x_pol_ref_role_UK_polId_roleId UNIQUE(policy_id,role_id),
- CONSTRAINT x_pol_ref_role_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
- CONSTRAINT x_pol_ref_role_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_pol_ref_role_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
CONSTRAINT x_pol_ref_role_FK_role_id FOREIGN KEY (role_id) REFERENCES x_role (id)
);
@@ -1572,17 +1482,11 @@ commit;
CREATE SEQUENCE x_role_ref_role_SEQ;
CREATE TABLE x_role_ref_role(
id BIGINT DEFAULT nextval('x_role_ref_role_SEQ'::regclass),
-create_time TIMESTAMP DEFAULT NULL NULL,
-update_time TIMESTAMP DEFAULT NULL NULL,
-added_by_id BIGINT DEFAULT NULL NULL,
-upd_by_id BIGINT DEFAULT NULL NULL,
role_ref_id BIGINT DEFAULT NULL NULL,
role_id BIGINT NOT NULL,
role_name varchar(255) DEFAULT NULL NULL,
priv_type INT DEFAULT NULL NULL,
PRIMARY KEY (id),
- CONSTRAINT x_role_ref_role_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
- CONSTRAINT x_role_ref_role_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
CONSTRAINT x_role_ref_role_FK_role_ref_id FOREIGN KEY (role_ref_id) REFERENCES x_role (id)
);
commit;
@@ -2154,6 +2058,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 ('074',current_timestamp,'Ranger 3.0.0',current_timestamp,'localhost','Y');
INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('075',current_timestamp,'Ranger 3.0.0',current_timestamp,'localhost','Y');
INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('076',current_timestamp,'Ranger 3.0.0',current_timestamp,'localhost','Y');
+INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('077',current_timestamp,'Ranger 3.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/077-drop-audit-columns-from-policy-ref-tables.sql b/security-admin/db/postgres/patches/077-drop-audit-columns-from-policy-ref-tables.sql
new file mode 100644
index 000000000..8f7115c1c
--- /dev/null
+++ b/security-admin/db/postgres/patches/077-drop-audit-columns-from-policy-ref-tables.sql
@@ -0,0 +1,99 @@
+-- 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.
+
+-- Commented because dropping this column would break high-availability setups
+-- We can uncomment this after the next major version upgrade
+
+ALTER TABLE x_policy_ref_resource DROP COLUMN IF EXISTS guid CASCADE;
+ALTER TABLE x_policy_ref_resource DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_policy_ref_resource DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_policy_ref_resource DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_policy_ref_resource DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_policy_ref_role DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_policy_ref_role DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_policy_ref_role DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_policy_ref_role DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_policy_ref_group DROP COLUMN IF EXISTS guid CASCADE;
+ALTER TABLE x_policy_ref_group DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_policy_ref_group DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_policy_ref_group DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_policy_ref_group DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_policy_ref_user DROP COLUMN IF EXISTS guid CASCADE;
+ALTER TABLE x_policy_ref_user DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_policy_ref_user DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_policy_ref_user DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_policy_ref_user DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_policy_ref_access_type DROP COLUMN IF EXISTS guid CASCADE;
+ALTER TABLE x_policy_ref_access_type DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_policy_ref_access_type DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_policy_ref_access_type DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_policy_ref_access_type DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_policy_ref_condition DROP COLUMN IF EXISTS guid CASCADE;
+ALTER TABLE x_policy_ref_condition DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_policy_ref_condition DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_policy_ref_condition DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_policy_ref_condition DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_policy_ref_datamask_type DROP COLUMN IF EXISTS guid CASCADE;
+ALTER TABLE x_policy_ref_datamask_type DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_policy_ref_datamask_type DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_policy_ref_datamask_type DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_policy_ref_datamask_type DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_security_zone_ref_service DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_security_zone_ref_service DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_security_zone_ref_service DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_security_zone_ref_service DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_security_zone_ref_tag_srvc DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_security_zone_ref_tag_srvc DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_security_zone_ref_tag_srvc DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_security_zone_ref_tag_srvc DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_security_zone_ref_user DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_security_zone_ref_user DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_security_zone_ref_user DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_security_zone_ref_user DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_security_zone_ref_group DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_security_zone_ref_group DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_security_zone_ref_group DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_security_zone_ref_group DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_security_zone_ref_resource DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_security_zone_ref_resource DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_security_zone_ref_resource DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_security_zone_ref_resource DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_role_ref_user DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_role_ref_user DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_role_ref_user DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_role_ref_user DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_role_ref_group DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_role_ref_group DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_role_ref_group DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_role_ref_group DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
+ALTER TABLE x_role_ref_role DROP COLUMN IF EXISTS create_time CASCADE;
+ALTER TABLE x_role_ref_role DROP COLUMN IF EXISTS update_time CASCADE;
+ALTER TABLE x_role_ref_role DROP COLUMN IF EXISTS added_by_id CASCADE;
+ALTER TABLE x_role_ref_role DROP COLUMN IF EXISTS upd_by_id CASCADE;
+
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 d1c35a5f4..df950c85c 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
@@ -1616,50 +1616,26 @@ ALTER TABLE dbo.x_policy_ref_resource ADD CONSTRAINT x_policy_ref_resource_FK_po
GO
ALTER TABLE dbo.x_policy_ref_resource ADD CONSTRAINT x_policy_ref_resource_FK_resource_def_id FOREIGN KEY (resource_def_id) REFERENCES dbo.x_resource_def (id)
GO
-ALTER TABLE dbo.x_policy_ref_resource ADD CONSTRAINT x_policy_ref_resource_FK_added_by FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_policy_ref_resource ADD CONSTRAINT x_policy_ref_resource_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_policy_ref_access_type ADD CONSTRAINT x_policy_ref_access_type_FK_policy_id FOREIGN KEY (policy_id) REFERENCES dbo.x_policy (id)
GO
ALTER TABLE dbo.x_policy_ref_access_type ADD CONSTRAINT x_policy_ref_access_type_FK_access_def_id FOREIGN KEY (access_def_id) REFERENCES dbo.x_access_type_def (id)
GO
-ALTER TABLE dbo.x_policy_ref_access_type ADD CONSTRAINT x_policy_ref_access_type_FK_added_by FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_policy_ref_access_type ADD CONSTRAINT x_policy_ref_access_type_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_policy_ref_condition ADD CONSTRAINT x_policy_ref_condition_FK_policy_id FOREIGN KEY (policy_id) REFERENCES dbo.x_policy (id)
GO
ALTER TABLE dbo.x_policy_ref_condition ADD CONSTRAINT x_policy_ref_condition_FK_condition_def_id FOREIGN KEY (condition_def_id) REFERENCES dbo.x_policy_condition_def (id)
GO
-ALTER TABLE dbo.x_policy_ref_condition ADD CONSTRAINT x_policy_ref_condition_FK_added_by FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_policy_ref_condition ADD CONSTRAINT x_policy_ref_condition_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_policy_ref_datamask_type ADD CONSTRAINT x_policy_ref_datamask_type_FK_policy_id FOREIGN KEY (policy_id) REFERENCES dbo.x_policy (id)
GO
ALTER TABLE dbo.x_policy_ref_datamask_type ADD CONSTRAINT x_policy_ref_datamask_type_FK_datamask_def_id FOREIGN KEY (datamask_def_id) REFERENCES dbo.x_datamask_type_def (id)
GO
-ALTER TABLE dbo.x_policy_ref_datamask_type ADD CONSTRAINT x_policy_ref_datamask_type_FK_added_by FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_policy_ref_datamask_type ADD CONSTRAINT x_policy_ref_datamask_type_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_policy_ref_user ADD CONSTRAINT x_policy_ref_user_FK_policy_id FOREIGN KEY (policy_id) REFERENCES dbo.x_policy (id)
GO
ALTER TABLE dbo.x_policy_ref_user ADD CONSTRAINT x_policy_ref_user_FK_user_id FOREIGN KEY (user_id) REFERENCES dbo.x_user (id)
GO
-ALTER TABLE dbo.x_policy_ref_user ADD CONSTRAINT x_policy_ref_user_FK_added_by FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_policy_ref_user ADD CONSTRAINT x_policy_ref_user_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_policy_ref_group ADD CONSTRAINT x_policy_ref_group_FK_policy_id FOREIGN KEY (policy_id) REFERENCES dbo.x_policy (id)
GO
ALTER TABLE dbo.x_policy_ref_group ADD CONSTRAINT x_policy_ref_group_FK_group_id FOREIGN KEY (group_id) REFERENCES dbo.x_group (id)
GO
-ALTER TABLE dbo.x_policy_ref_group ADD CONSTRAINT x_policy_ref_group_FK_added_by FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_policy_ref_group ADD CONSTRAINT x_policy_ref_group_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_security_zone ADD CONSTRAINT x_security_zone_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES dbo.x_portal_user (id)
GO
ALTER TABLE dbo.x_security_zone ADD CONSTRAINT x_security_zone_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES dbo.x_portal_user (id)
@@ -1670,48 +1646,28 @@ ALTER TABLE dbo.x_ranger_global_state ADD CONSTRAINT x_ranger_global_state_FK_up
GO
ALTER TABLE dbo.x_policy ADD CONSTRAINT x_policy_FK_zone_id FOREIGN KEY(zone_id) REFERENCES dbo.x_security_zone (id)
GO
-ALTER TABLE dbo.x_security_zone_ref_service ADD CONSTRAINT x_sz_ref_service_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_security_zone_ref_service ADD CONSTRAINT x_sz_ref_service_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_security_zone_ref_service ADD CONSTRAINT x_sz_ref_service_FK_zone_id FOREIGN KEY(zone_id) REFERENCES dbo.x_security_zone (id)
GO
ALTER TABLE dbo.x_security_zone_ref_service ADD CONSTRAINT x_sz_ref_service_FK_service_id FOREIGN KEY(service_id) REFERENCES dbo.x_service (id)
GO
ALTER TABLE dbo.x_security_zone_ref_service ADD CONSTRAINT x_sz_ref_service_FK_service_name FOREIGN KEY(service_name) REFERENCES dbo.x_service (name)
GO
-ALTER TABLE dbo.x_security_zone_ref_tag_srvc ADD CONSTRAINT x_sz_ref_tag_service_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_security_zone_ref_tag_srvc ADD CONSTRAINT x_sz_ref_tag_service_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_security_zone_ref_tag_srvc ADD CONSTRAINT x_sz_ref_tag_service_FK_zone_id FOREIGN KEY(zone_id) REFERENCES dbo.x_security_zone (id)
GO
ALTER TABLE dbo.x_security_zone_ref_tag_srvc ADD CONSTRAINT x_sz_ref_tag_service_FK_tag_service_id FOREIGN KEY(tag_service_id) REFERENCES dbo.x_service (id)
GO
ALTER TABLE dbo.x_security_zone_ref_tag_srvc ADD CONSTRAINT x_sz_ref_tag_service_FK_tag_service_name FOREIGN KEY(tag_service_name) REFERENCES dbo.x_service (name)
GO
-ALTER TABLE dbo.x_security_zone_ref_resource ADD CONSTRAINT x_sz_ref_resource_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_security_zone_ref_resource ADD CONSTRAINT x_sz_ref_resource_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_security_zone_ref_resource ADD CONSTRAINT x_sz_ref_resource_FK_zone_id FOREIGN KEY(zone_id) REFERENCES dbo.x_security_zone (id)
GO
ALTER TABLE dbo.x_security_zone_ref_resource ADD CONSTRAINT x_sz_ref_resource_FK_service_id FOREIGN KEY(resource_def_id) REFERENCES dbo.x_resource_def (id)
GO
-ALTER TABLE dbo.x_security_zone_ref_user ADD CONSTRAINT x_sz_ref_user_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_security_zone_ref_user ADD CONSTRAINT x_sz_ref_user_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_security_zone_ref_user ADD CONSTRAINT x_sz_ref_user_FK_zone_id FOREIGN KEY(zone_id) REFERENCES dbo.x_security_zone (id)
GO
ALTER TABLE dbo.x_security_zone_ref_user ADD CONSTRAINT x_sz_ref_user_FK_user_id FOREIGN KEY(user_id) REFERENCES dbo.x_user (id)
GO
ALTER TABLE dbo.x_security_zone_ref_user ADD CONSTRAINT x_sz_ref_user_FK_user_name FOREIGN KEY(user_name) REFERENCES dbo.x_user (user_name)
GO
-ALTER TABLE dbo.x_security_zone_ref_group ADD CONSTRAINT x_sz_ref_grp_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_security_zone_ref_group ADD CONSTRAINT x_sz_ref_grp_FK_upd_by_id FOREIGN KEY(upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_security_zone_ref_group ADD CONSTRAINT x_sz_ref_grp_FK_zone_id FOREIGN KEY(zone_id) REFERENCES dbo.x_security_zone (id)
GO
ALTER TABLE dbo.x_security_zone_ref_group ADD CONSTRAINT x_sz_ref_grp_FK_group_id FOREIGN KEY(group_id) REFERENCES dbo.x_group (id)
@@ -1725,32 +1681,16 @@ GO
ALTER TABLE dbo.x_security_zone_ref_role ADD CONSTRAINT x_sz_ref_role_FK_role_id FOREIGN KEY(role_id) REFERENCES dbo.x_role (id)
GO
-ALTER TABLE dbo.x_role_ref_role ADD CONSTRAINT x_role_ref_role_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_role_ref_role ADD CONSTRAINT x_role_ref_role_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_role_ref_role ADD CONSTRAINT x_role_ref_role_FK_role_ref_id FOREIGN KEY (role_ref_id) REFERENCES dbo.x_role (id)
GO
-ALTER TABLE dbo.x_policy_ref_role ADD CONSTRAINT x_pol_ref_role_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_policy_ref_role ADD CONSTRAINT x_pol_ref_role_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_policy_ref_role ADD CONSTRAINT x_pol_ref_role_FK_policy_id FOREIGN KEY (policy_id) REFERENCES dbo.x_policy (id)
GO
ALTER TABLE dbo.x_policy_ref_role ADD CONSTRAINT x_pol_ref_role_FK_role_id FOREIGN KEY (role_id) REFERENCES dbo.x_role (id)
GO
-ALTER TABLE dbo.x_role_ref_group ADD CONSTRAINT x_role_ref_grp_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_role_ref_group ADD CONSTRAINT x_role_ref_grp_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_role_ref_group ADD CONSTRAINT x_role_ref_grp_FK_role_id FOREIGN KEY (role_id) REFERENCES dbo.x_role (id)
GO
ALTER TABLE dbo.x_role_ref_group ADD CONSTRAINT x_role_ref_grp_FK_group_id FOREIGN KEY (group_id) REFERENCES dbo.x_group (id)
GO
-ALTER TABLE dbo.x_role_ref_user ADD CONSTRAINT x_role_ref_user_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES dbo.x_portal_user (id)
-GO
-ALTER TABLE dbo.x_role_ref_user ADD CONSTRAINT x_role_ref_user_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES dbo.x_portal_user (id)
-GO
ALTER TABLE dbo.x_role_ref_user ADD CONSTRAINT x_role_ref_user_FK_role_id FOREIGN KEY (role_id) REFERENCES dbo.x_role (id)
GO
ALTER TABLE dbo.x_role_ref_user ADD CONSTRAINT x_role_ref_user_FK_user_id FOREIGN KEY (user_id) REFERENCES dbo.x_user (id)
@@ -2294,6 +2234,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 ('076',CURRENT_TIMESTAMP,'Ranger 3.0.0',CURRENT_TIMESTAMP,'localhost','Y');
GO
+INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('077',CURRENT_TIMESTAMP,'Ranger 3.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/077-drop-audit-columns-from-policy-ref-tables.sql b/security-admin/db/sqlanywhere/patches/077-drop-audit-columns-from-policy-ref-tables.sql
new file mode 100644
index 000000000..60f815e0a
--- /dev/null
+++ b/security-admin/db/sqlanywhere/patches/077-drop-audit-columns-from-policy-ref-tables.sql
@@ -0,0 +1,248 @@
+-- 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.
+
+-- Commented because dropping this column would break high-availability setups
+-- We can uncomment this after the next major version upgrade
+
+CREATE OR REPLACE PROCEDURE dbo.dropTableColumn (@table_name varchar(100), @column_name varchar(100))
+AS
+BEGIN
+ DECLARE @stmt VARCHAR(300)
+ IF EXISTS(select * from SYS.SYSCOLUMNS where tname = @table_name and cname = @column_name)
+ BEGIN
+ SET @stmt = 'ALTER TABLE dbo.' + @table_name + ' DROP ' + @column_name;
+ execute(@stmt)
+ END
+END
+GO
+
+CREATE OR REPLACE PROCEDURE dbo.dropTableConstraint (@table_name varchar(100), @constraint_name varchar(100))
+AS
+BEGIN
+ DECLARE @stmt VARCHAR(300)
+ IF EXISTS(select * from SYS.SYSCONSTRAINT where constraint_name = @constraint_name)
+ BEGIN
+ SET @stmt = 'ALTER TABLE dbo.' + @table_name + ' DROP CONSTRAINT ' + @constraint_name;
+ execute(@stmt)
+ END
+END
+GO
+
+call dbo.dropTableColumn('x_policy_ref_resource', 'guid')
+GO
+call dbo.dropTableColumn('x_policy_ref_resource', 'create_time')
+GO
+call dbo.dropTableColumn('x_policy_ref_resource', 'update_time')
+GO
+call dbo.dropTableConstraint('x_policy_ref_resource', 'x_policy_ref_resource_FK_added_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_resource', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_policy_ref_resource', 'x_policy_ref_resource_FK_upd_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_resource', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_policy_ref_role', 'create_time')
+GO
+call dbo.dropTableColumn('x_policy_ref_role', 'update_time')
+GO
+call dbo.dropTableConstraint('x_policy_ref_role', 'x_pol_ref_role_FK_added_by_id')
+GO
+call dbo.dropTableColumn('x_policy_ref_role', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_policy_ref_role', 'x_pol_ref_role_FK_upd_by_id')
+GO
+call dbo.dropTableColumn('x_policy_ref_role', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_policy_ref_group', 'guid')
+GO
+call dbo.dropTableColumn('x_policy_ref_group', 'create_time')
+GO
+call dbo.dropTableColumn('x_policy_ref_group', 'update_time')
+GO
+call dbo.dropTableConstraint('x_policy_ref_group', 'x_policy_ref_group_FK_added_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_group', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_policy_ref_group', 'x_policy_ref_group_FK_upd_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_group', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_policy_ref_user', 'guid')
+GO
+call dbo.dropTableColumn('x_policy_ref_user', 'create_time')
+GO
+call dbo.dropTableColumn('x_policy_ref_user', 'update_time')
+GO
+call dbo.dropTableConstraint('x_policy_ref_user', 'x_policy_ref_user_FK_added_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_user', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_policy_ref_user', 'x_policy_ref_user_FK_upd_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_user', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_policy_ref_access_type', 'guid')
+GO
+call dbo.dropTableColumn('x_policy_ref_access_type', 'create_time')
+GO
+call dbo.dropTableColumn('x_policy_ref_access_type', 'update_time')
+GO
+call dbo.dropTableConstraint('x_policy_ref_access_type', 'x_policy_ref_access_type_FK_added_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_access_type', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_policy_ref_access_type', 'x_policy_ref_access_type_FK_upd_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_access_type', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_policy_ref_condition', 'guid')
+GO
+call dbo.dropTableColumn('x_policy_ref_condition', 'create_time')
+GO
+call dbo.dropTableColumn('x_policy_ref_condition', 'update_time')
+GO
+call dbo.dropTableConstraint('x_policy_ref_condition', 'x_policy_ref_condition_FK_added_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_condition', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_policy_ref_condition', 'x_policy_ref_condition_FK_upd_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_condition', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_policy_ref_datamask_type', 'guid')
+GO
+call dbo.dropTableColumn('x_policy_ref_datamask_type', 'create_time')
+GO
+call dbo.dropTableColumn('x_policy_ref_datamask_type', 'update_time')
+GO
+call dbo.dropTableConstraint('x_policy_ref_datamask_type', 'x_policy_ref_datamask_type_FK_added_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_datamask_type', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_policy_ref_datamask_type', 'x_policy_ref_datamask_type_FK_upd_by')
+GO
+call dbo.dropTableColumn('x_policy_ref_datamask_type', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_security_zone_ref_service', 'create_time')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_service', 'update_time')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_service', 'x_sz_ref_service_FK_added_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_service', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_service', 'x_sz_ref_service_FK_upd_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_service', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_security_zone_ref_tag_srvc', 'create_time')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_tag_srvc', 'update_time')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_tag_srvc', 'x_sz_ref_tag_service_FK_added_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_tag_srvc', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_tag_srvc', 'x_sz_ref_tag_service_FK_upd_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_tag_srvc', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_security_zone_ref_user', 'create_time')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_user', 'update_time')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_user', 'x_sz_ref_user_FK_added_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_user', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_user', 'x_sz_ref_user_FK_upd_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_user', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_security_zone_ref_group', 'create_time')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_group', 'update_time')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_group', 'x_sz_ref_grp_FK_added_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_group', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_group', 'x_sz_ref_grp_FK_upd_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_group', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_security_zone_ref_resource', 'create_time')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_resource', 'update_time')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_resource', 'x_sz_ref_resource_FK_added_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_resource', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_security_zone_ref_resource', 'x_sz_ref_resource_FK_upd_by_id')
+GO
+call dbo.dropTableColumn('x_security_zone_ref_resource', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_role_ref_user', 'create_time')
+GO
+call dbo.dropTableColumn('x_role_ref_user', 'update_time')
+GO
+call dbo.dropTableConstraint('x_role_ref_user', 'x_role_ref_user_FK_added_by_id')
+GO
+call dbo.dropTableColumn('x_role_ref_user', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_role_ref_user', 'x_role_ref_user_FK_upd_by_id')
+GO
+call dbo.dropTableColumn('x_role_ref_user', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_role_ref_group', 'create_time')
+GO
+call dbo.dropTableColumn('x_role_ref_group', 'update_time')
+GO
+call dbo.dropTableConstraint('x_role_ref_group', 'x_role_ref_grp_FK_added_by_id')
+GO
+call dbo.dropTableColumn('x_role_ref_group', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_role_ref_group', 'x_role_ref_grp_FK_upd_by_id')
+GO
+call dbo.dropTableColumn('x_role_ref_group', 'upd_by_id')
+GO
+
+call dbo.dropTableColumn('x_role_ref_role', 'create_time')
+GO
+call dbo.dropTableColumn('x_role_ref_role', 'update_time')
+GO
+call dbo.dropTableConstraint('x_role_ref_role', 'x_role_ref_role_FK_added_by_id')
+GO
+call dbo.dropTableColumn('x_role_ref_role', 'added_by_id')
+GO
+call dbo.dropTableConstraint('x_role_ref_role', 'x_role_ref_role_FK_upd_by_id')
+GO
+call dbo.dropTableColumn('x_role_ref_role', 'upd_by_id')
+GO
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 b01132410..315a3bc50 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
@@ -2294,11 +2294,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_policy_ref_resource] (
[id] [bigint] IDENTITY (1, 1) NOT NULL,
- [guid] [varchar](1024) DEFAULT NULL NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[policy_id] [bigint] NOT NULL,
[resource_def_id] [bigint] NOT NULL,
[resource_name] [varchar](4000) DEFAULT NULL NULL,
@@ -2316,11 +2311,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_policy_ref_access_type] (
[id] [bigint] IDENTITY (1, 1) NOT NULL,
- [guid] [varchar](1024) DEFAULT NULL NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[policy_id] [bigint] NOT NULL,
[access_def_id] [bigint] NOT NULL,
[access_type_name] [varchar](4000) DEFAULT NULL NULL,
@@ -2338,11 +2328,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_policy_ref_condition] (
[id] [bigint] IDENTITY (1, 1) NOT NULL,
- [guid] [varchar](1024) DEFAULT NULL NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[policy_id] [bigint] NOT NULL,
[condition_def_id] [bigint] NOT NULL,
[condition_name] [varchar](4000) DEFAULT NULL NULL,
@@ -2360,11 +2345,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_policy_ref_datamask_type] (
[id] [bigint] IDENTITY (1, 1) NOT NULL,
- [guid] [varchar](1024) DEFAULT NULL NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[policy_id] [bigint] NOT NULL,
[datamask_def_id] [bigint] NOT NULL,
[datamask_type_name] [varchar](4000) DEFAULT NULL NULL,
@@ -2382,11 +2362,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_policy_ref_user] (
[id] [bigint] IDENTITY (1, 1) NOT NULL,
- [guid] [varchar](1024) DEFAULT NULL NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[policy_id] [bigint] NOT NULL,
[user_id] [bigint] NOT NULL,
[user_name] [nvarchar](4000) DEFAULT NULL NULL,
@@ -2404,11 +2379,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_policy_ref_group] (
[id] [bigint] IDENTITY (1, 1) NOT NULL,
- [guid] [varchar](1024) DEFAULT NULL NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[policy_id] [bigint] NOT NULL,
[group_id] [bigint] NOT NULL,
[group_name] [nvarchar](4000) DEFAULT NULL NULL,
@@ -2426,10 +2396,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_security_zone_ref_service](
[id] [bigint] IDENTITY(1,1) NOT NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[zone_id] [bigint] DEFAULT NULL NULL,
[service_id] [bigint] DEFAULT NULL NULL,
[service_name] [varchar](255) DEFAULT NULL NULL,
@@ -2439,10 +2405,6 @@ CREATE TABLE [dbo].[x_security_zone_ref_service](
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_security_zone_ref_service] WITH CHECK ADD CONSTRAINT [x_sz_ref_service_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_security_zone_ref_service] WITH CHECK ADD CONSTRAINT [x_sz_ref_service_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_security_zone_ref_service] WITH CHECK ADD CONSTRAINT [x_sz_ref_service_FK_zone_id] FOREIGN KEY([zone_id]) REFERENCES [dbo].[x_security_zone] ([id])
GO
ALTER TABLE [dbo].[x_security_zone_ref_service] WITH CHECK ADD CONSTRAINT [x_sz_ref_service_FK_service_id] FOREIGN KEY([service_id]) REFERENCES [dbo].[x_service] ([id])
@@ -2464,10 +2426,6 @@ CREATE TABLE [dbo].[x_security_zone_ref_tag_srvc](
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_security_zone_ref_tag_srvc] WITH CHECK ADD CONSTRAINT [x_sz_ref_tag_service_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_security_zone_ref_tag_srvc] WITH CHECK ADD CONSTRAINT [x_sz_ref_tag_service_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_security_zone_ref_tag_srvc] WITH CHECK ADD CONSTRAINT [x_sz_ref_tag_service_FK_zone_id] FOREIGN KEY([zone_id]) REFERENCES [dbo].[x_security_zone] ([id])
GO
ALTER TABLE [dbo].[x_security_zone_ref_tag_srvc] WITH CHECK ADD CONSTRAINT [x_sz_ref_tag_service_FK_tag_srvc_id] FOREIGN KEY([tag_srvc_id]) REFERENCES [dbo].[x_service] ([id])
@@ -2479,10 +2437,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_security_zone_ref_resource](
[id] [bigint] IDENTITY(1,1) NOT NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[zone_id] [bigint] DEFAULT NULL NULL,
[resource_def_id] [bigint] DEFAULT NULL NULL,
[resource_name] [varchar](255) DEFAULT NULL NULL,
@@ -2492,10 +2446,6 @@ CREATE TABLE [dbo].[x_security_zone_ref_resource](
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_security_zone_ref_resource] WITH CHECK ADD CONSTRAINT [x_sz_ref_resource_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_security_zone_ref_resource] WITH CHECK ADD CONSTRAINT [x_sz_ref_resource_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_security_zone_ref_resource] WITH CHECK ADD CONSTRAINT [x_sz_ref_resource_FK_zone_id] FOREIGN KEY([zone_id]) REFERENCES [dbo].[x_security_zone] ([id])
GO
ALTER TABLE [dbo].[x_security_zone_ref_resource] WITH CHECK ADD CONSTRAINT [x_sz_ref_resource_FK_resource_def_id] FOREIGN KEY([resource_def_id]) REFERENCES [dbo].[x_resource_def] ([id])
@@ -2505,10 +2455,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_security_zone_ref_user](
[id] [bigint] IDENTITY(1,1) NOT NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[zone_id] [bigint] DEFAULT NULL NULL,
[user_id] [bigint] DEFAULT NULL NULL,
[user_name] [nvarchar](767) DEFAULT NULL NULL,
@@ -2519,10 +2465,6 @@ CREATE TABLE [dbo].[x_security_zone_ref_user](
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_security_zone_ref_user] WITH CHECK ADD CONSTRAINT [x_sz_ref_user_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_security_zone_ref_user] WITH CHECK ADD CONSTRAINT [x_sz_ref_user_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_security_zone_ref_user] WITH CHECK ADD CONSTRAINT [x_sz_ref_user_FK_zone_id] FOREIGN KEY([zone_id]) REFERENCES [dbo].[x_security_zone] ([id])
GO
ALTER TABLE [dbo].[x_security_zone_ref_user] WITH CHECK ADD CONSTRAINT [x_sz_ref_user_FK_user_id] FOREIGN KEY([user_id]) REFERENCES [dbo].[x_user] ([id])
@@ -2534,10 +2476,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_security_zone_ref_group](
[id] [bigint] IDENTITY(1,1) NOT NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[zone_id] [bigint] DEFAULT NULL NULL,
[group_id] [bigint] DEFAULT NULL NULL,
[group_name] [nvarchar](767) DEFAULT NULL NULL,
@@ -2548,10 +2486,6 @@ CREATE TABLE [dbo].[x_security_zone_ref_group](
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_security_zone_ref_group] WITH CHECK ADD CONSTRAINT [x_sz_ref_group_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_security_zone_ref_group] WITH CHECK ADD CONSTRAINT [x_sz_ref_group_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_security_zone_ref_group] WITH CHECK ADD CONSTRAINT [x_sz_ref_group_FK_zone_id] FOREIGN KEY([zone_id]) REFERENCES [dbo].[x_security_zone] ([id])
GO
ALTER TABLE [dbo].[x_security_zone_ref_group] WITH CHECK ADD CONSTRAINT [x_sz_ref_group_FK_group_id] FOREIGN KEY([group_id]) REFERENCES [dbo].[x_group] ([id])
@@ -2561,7 +2495,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_policy_change_log](
[id] [bigint] IDENTITY(1,1) NOT NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
[service_id] [bigint] NOT NULL,
[change_type] [int] NOT NULL,
[policy_version] [bigint] DEFAULT 0 NOT NULL,
@@ -2599,10 +2532,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_role](
[id] [bigint] IDENTITY(1,1) NOT NULL,
-[create_time] [datetime2] DEFAULT NULL NULL,
-[update_time] [datetime2] DEFAULT NULL NULL,
-[added_by_id] [bigint] DEFAULT NULL NULL,
-[upd_by_id] [bigint] DEFAULT NULL NULL,
[version] [bigint] DEFAULT NULL NULL,
[name] [nvarchar](255) NOT NULL,
[description] [nvarchar](1024) DEFAULT NULL NULL,
@@ -2619,20 +2548,12 @@ CREATE TABLE [dbo].[x_role](
)WITH (PAD_INDEX = OFF,STATISTICS_NORECOMPUTE = OFF,IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_role] WITH CHECK ADD CONSTRAINT [x_role_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_role] WITH CHECK ADD CONSTRAINT [x_role_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_role_ref_user](
[id] [bigint] IDENTITY(1,1) NOT NULL,
-[create_time] [datetime2] DEFAULT NULL NULL,
-[update_time] [datetime2] DEFAULT NULL NULL,
-[added_by_id] [bigint] DEFAULT NULL NULL,
-[upd_by_id] [bigint] DEFAULT NULL NULL,
[role_id] [bigint] NOT NULL,
[user_id] [bigint] DEFAULT NULL NULL,
[user_name] [nvarchar](767) DEFAULT NULL NULL,
@@ -2643,10 +2564,6 @@ CREATE TABLE [dbo].[x_role_ref_user](
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_role_ref_user] WITH CHECK ADD CONSTRAINT [x_role_ref_user_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_role_ref_user] WITH CHECK ADD CONSTRAINT [x_role_ref_user_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_role_ref_user] WITH CHECK ADD CONSTRAINT [x_role_ref_user_FK_role_id] FOREIGN KEY([role_id]) REFERENCES [dbo].[x_role] ([id])
GO
ALTER TABLE [dbo].[x_role_ref_user] WITH CHECK ADD CONSTRAINT [x_role_ref_user_FK_user_id] FOREIGN KEY([user_id]) REFERENCES [dbo].[x_user] ([id])
@@ -2657,10 +2574,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_role_ref_group](
[id] [bigint] IDENTITY(1,1) NOT NULL,
-[create_time] [datetime2] DEFAULT NULL NULL,
-[update_time] [datetime2] DEFAULT NULL NULL,
-[added_by_id] [bigint] DEFAULT NULL NULL,
-[upd_by_id] [bigint] DEFAULT NULL NULL,
[role_id] [bigint] NOT NULL,
[group_id] [bigint] DEFAULT NULL NULL,
[group_name] [nvarchar](767) DEFAULT NULL NULL,
@@ -2671,10 +2584,6 @@ CREATE TABLE [dbo].[x_role_ref_group](
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_role_ref_group] WITH CHECK ADD CONSTRAINT [x_role_ref_group_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_role_ref_group] WITH CHECK ADD CONSTRAINT [x_role_ref_group_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_role_ref_group] WITH CHECK ADD CONSTRAINT [x_role_ref_group_FK_role_id] FOREIGN KEY([role_id]) REFERENCES [dbo].[x_role] ([id])
GO
ALTER TABLE [dbo].[x_role_ref_group] WITH CHECK ADD CONSTRAINT [x_role_ref_group_FK_group_id] FOREIGN KEY([group_id]) REFERENCES [dbo].[x_group] ([id])
@@ -2685,10 +2594,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_policy_ref_role](
[id] [bigint] IDENTITY(1,1) NOT NULL,
-[create_time] [datetime2] DEFAULT NULL NULL,
-[update_time] [datetime2] DEFAULT NULL NULL,
-[added_by_id] [bigint] DEFAULT NULL NULL,
-[upd_by_id] [bigint] DEFAULT NULL NULL,
[policy_id] [bigint] NOT NULL,
[role_id] [bigint] NOT NULL,
[role_name] [nvarchar](255) DEFAULT NULL NULL,
@@ -2702,10 +2607,6 @@ CREATE TABLE [dbo].[x_policy_ref_role](
)WITH (PAD_INDEX = OFF,STATISTICS_NORECOMPUTE = OFF,IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_policy_ref_role] WITH CHECK ADD CONSTRAINT [x_policy_ref_role_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_policy_ref_role] WITH CHECK ADD CONSTRAINT [x_policy_ref_role_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_policy_ref_role] WITH CHECK ADD CONSTRAINT [x_policy_ref_role_FK_policy_id] FOREIGN KEY([policy_id]) REFERENCES [dbo].[x_policy] ([id])
GO
ALTER TABLE [dbo].[x_policy_ref_role] WITH CHECK ADD CONSTRAINT [x_policy_ref_role_FK_role_id] FOREIGN KEY([role_id]) REFERENCES [dbo].[x_role] ([id])
@@ -2716,10 +2617,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_role_ref_role](
[id] [bigint] IDENTITY(1,1) NOT NULL,
-[create_time] [datetime2] DEFAULT NULL NULL,
-[update_time] [datetime2] DEFAULT NULL NULL,
-[added_by_id] [bigint] DEFAULT NULL NULL,
-[upd_by_id] [bigint] DEFAULT NULL NULL,
[role_ref_id] [bigint] DEFAULT NULL NULL,
[role_id] [bigint] NOT NULL,
[role_name] [nvarchar](255) DEFAULT NULL NULL,
@@ -2730,10 +2627,6 @@ CREATE TABLE [dbo].[x_role_ref_role](
) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
)ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_role_ref_role] WITH CHECK ADD CONSTRAINT [x_role_ref_role_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_role_ref_role] WITH CHECK ADD CONSTRAINT [x_role_ref_role_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_role_ref_role] WITH CHECK ADD CONSTRAINT [x_role_ref_role_FK_role_ref_id] FOREIGN KEY([role_ref_id]) REFERENCES [dbo].[x_role] ([id])
GO
@@ -2742,10 +2635,6 @@ SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_security_zone_ref_role](
[id] [bigint] IDENTITY(1,1) NOT NULL,
- [create_time] [datetime2] DEFAULT NULL NULL,
- [update_time] [datetime2] DEFAULT NULL NULL,
- [added_by_id] [bigint] DEFAULT NULL NULL,
- [upd_by_id] [bigint] DEFAULT NULL NULL,
[zone_id] [bigint] DEFAULT NULL NULL,
[role_id] [bigint] DEFAULT NULL NULL,
[role_name] [nvarchar](767) DEFAULT NULL NULL
@@ -2755,10 +2644,6 @@ CREATE TABLE [dbo].[x_security_zone_ref_role](
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
) ON [PRIMARY]
GO
-ALTER TABLE [dbo].[x_security_zone_ref_role] WITH CHECK ADD CONSTRAINT [x_sz_ref_role_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
-ALTER TABLE [dbo].[x_security_zone_ref_role] WITH CHECK ADD CONSTRAINT [x_sz_ref_role_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
-GO
ALTER TABLE [dbo].[x_security_zone_ref_role] WITH CHECK ADD CONSTRAINT [x_sz_ref_role_FK_zone_id] FOREIGN KEY([zone_id]) REFERENCES [dbo].[x_security_zone] ([id])
GO
ALTER TABLE [dbo].[x_security_zone_ref_role] WITH CHECK ADD CONSTRAINT [x_sz_ref_role_FK_role_id] FOREIGN KEY([role_id]) REFERENCES [dbo].[x_role] ([id])
@@ -2770,7 +2655,6 @@ SET ANSI_PADDING ON
CREATE TABLE [dbo].[x_tag_change_log] (
[id] [bigint] IDENTITY(1,1) NOT NULL,
-[create_time] [datetime2] DEFAULT NULL NULL,
[service_id] [bigint] NOT NULL,
[change_type] [int] NOT NULL,
[service_tags_version] [bigint] DEFAULT 0 NOT NULL,
@@ -3159,44 +3043,27 @@ ALTER TABLE [dbo].[x_policy_ref_resource] CHECK CONSTRAINT [x_policy_ref_resourc
ALTER TABLE [dbo].[x_policy_ref_resource] WITH CHECK ADD CONSTRAINT [x_policy_ref_resource_FK_res_def_id] FOREIGN KEY ([resource_def_id])
REFERENCES [dbo].[x_resource_def] ([id])
ALTER TABLE [dbo].[x_policy_ref_resource] CHECK CONSTRAINT [x_policy_ref_resource_FK_res_def_id]
-ALTER TABLE [dbo].[x_policy_ref_resource] WITH CHECK ADD CONSTRAINT [x_policy_ref_resource_FK_added_by] FOREIGN KEY ([added_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
-ALTER TABLE [dbo].[x_policy_ref_resource] CHECK CONSTRAINT [x_policy_ref_resource_FK_added_by]
-ALTER TABLE [dbo].[x_policy_ref_resource] WITH CHECK ADD CONSTRAINT [x_policy_ref_resource_FK_upd_by] FOREIGN KEY ([upd_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
+
ALTER TABLE [dbo].[x_policy_ref_access_type] WITH CHECK ADD CONSTRAINT [x_policy_ref_access_type_FK_policy_id] FOREIGN KEY ([policy_id])
REFERENCES [dbo].[x_policy] ([id])
ALTER TABLE [dbo].[x_policy_ref_access_type] CHECK CONSTRAINT [x_policy_ref_access_type_FK_policy_id]
ALTER TABLE [dbo].[x_policy_ref_access_type] WITH CHECK ADD CONSTRAINT [x_policy_ref_access_type_FK_access_def_id] FOREIGN KEY ([access_def_id])
REFERENCES [dbo].[x_access_type_def] ([id])
ALTER TABLE [dbo].[x_policy_ref_access_type] CHECK CONSTRAINT [x_policy_ref_access_type_FK_access_def_id]
-ALTER TABLE [dbo].[x_policy_ref_access_type] WITH CHECK ADD CONSTRAINT [x_policy_ref_access_type_FK_added_by] FOREIGN KEY ([added_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
-ALTER TABLE [dbo].[x_policy_ref_access_type] CHECK CONSTRAINT [x_policy_ref_access_type_FK_added_by]
-ALTER TABLE [dbo].[x_policy_ref_access_type] WITH CHECK ADD CONSTRAINT [x_policy_ref_access_type_FK_upd_by] FOREIGN KEY ([upd_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
+
ALTER TABLE [dbo].[x_policy_ref_condition] WITH CHECK ADD CONSTRAINT [x_policy_ref_condition_FK_policy_id] FOREIGN KEY ([policy_id])
REFERENCES [dbo].[x_policy] ([id])
ALTER TABLE [dbo].[x_policy_ref_condition] CHECK CONSTRAINT [x_policy_ref_condition_FK_policy_id]
ALTER TABLE [dbo].[x_policy_ref_condition] WITH CHECK ADD CONSTRAINT [x_policy_ref_condition_FK_res_def_id] FOREIGN KEY ([condition_def_id])
REFERENCES [dbo].[x_policy_condition_def] ([id])
ALTER TABLE [dbo].[x_policy_ref_condition] CHECK CONSTRAINT [x_policy_ref_condition_FK_res_def_id]
-ALTER TABLE [dbo].[x_policy_ref_condition] WITH CHECK ADD CONSTRAINT [x_policy_ref_condition_FK_added_by] FOREIGN KEY ([added_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
-ALTER TABLE [dbo].[x_policy_ref_condition] CHECK CONSTRAINT [x_policy_ref_condition_FK_added_by]
-ALTER TABLE [dbo].[x_policy_ref_condition] WITH CHECK ADD CONSTRAINT [x_policy_ref_condition_FK_upd_by] FOREIGN KEY ([upd_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
+
ALTER TABLE [dbo].[x_policy_ref_datamask_type] WITH CHECK ADD CONSTRAINT [x_policy_ref_datamask_type_FK_policy_id] FOREIGN KEY ([policy_id])
REFERENCES [dbo].[x_policy] ([id])
ALTER TABLE [dbo].[x_policy_ref_datamask_type] CHECK CONSTRAINT [x_policy_ref_datamask_type_FK_policy_id]
ALTER TABLE [dbo].[x_policy_ref_datamask_type] WITH CHECK ADD CONSTRAINT [x_policy_ref_datamask_type_FK_res_def_id] FOREIGN KEY ([datamask_def_id])
REFERENCES [dbo].[x_datamask_type_def] ([id])
ALTER TABLE [dbo].[x_policy_ref_datamask_type] CHECK CONSTRAINT [x_policy_ref_datamask_type_FK_res_def_id]
-ALTER TABLE [dbo].[x_policy_ref_datamask_type] WITH CHECK ADD CONSTRAINT [x_policy_ref_datamask_type_FK_added_by] FOREIGN KEY ([added_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
-ALTER TABLE [dbo].[x_policy_ref_datamask_type] CHECK CONSTRAINT [x_policy_ref_datamask_type_FK_added_by]
-ALTER TABLE [dbo].[x_policy_ref_datamask_type] WITH CHECK ADD CONSTRAINT [x_policy_ref_datamask_type_FK_upd_by] FOREIGN KEY ([upd_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
ALTER TABLE [dbo].[x_policy_ref_user] WITH CHECK ADD CONSTRAINT [x_policy_ref_user_FK_policy_id] FOREIGN KEY ([policy_id])
REFERENCES [dbo].[x_policy] ([id])
@@ -3206,12 +3073,6 @@ ALTER TABLE [dbo].[x_policy_ref_user] WITH CHECK ADD CONSTRAINT [x_policy_ref_us
REFERENCES [dbo].[x_user] ([id])
ALTER TABLE [dbo].[x_policy_ref_user] CHECK CONSTRAINT [x_policy_ref_user_FK_user_id]
-ALTER TABLE [dbo].[x_policy_ref_user] WITH CHECK ADD CONSTRAINT [x_policy_ref_user_FK_added_by] FOREIGN KEY ([added_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
-ALTER TABLE [dbo].[x_policy_ref_user] CHECK CONSTRAINT [x_policy_ref_user_FK_added_by]
-
-ALTER TABLE [dbo].[x_policy_ref_user] WITH CHECK ADD CONSTRAINT [x_policy_ref_user_FK_upd_by] FOREIGN KEY ([upd_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
ALTER TABLE [dbo].[x_policy_ref_user] CHECK CONSTRAINT [x_policy_ref_user_FK_upd_by]
ALTER TABLE [dbo].[x_policy_ref_group] WITH CHECK ADD CONSTRAINT [x_policy_ref_group_FK_policy_id] FOREIGN KEY ([policy_id])
@@ -3220,11 +3081,6 @@ ALTER TABLE [dbo].[x_policy_ref_group] CHECK CONSTRAINT [x_policy_ref_group_FK_p
ALTER TABLE [dbo].[x_policy_ref_group] WITH CHECK ADD CONSTRAINT [x_policy_ref_group_FK_group_id] FOREIGN KEY ([group_id])
REFERENCES [dbo].[x_group] ([id])
ALTER TABLE [dbo].[x_policy_ref_group] CHECK CONSTRAINT [x_policy_ref_group_FK_group_id]
-ALTER TABLE [dbo].[x_policy_ref_group] WITH CHECK ADD CONSTRAINT [x_policy_ref_group_FK_added_by] FOREIGN KEY ([added_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
-ALTER TABLE [dbo].[x_policy_ref_group] CHECK CONSTRAINT [x_policy_ref_group_FK_added_by]
-ALTER TABLE [dbo].[x_policy_ref_group] WITH CHECK ADD CONSTRAINT [x_policy_ref_group_FK_upd_by] FOREIGN KEY ([upd_by_id])
-REFERENCES [dbo].[x_portal_user] ([id])
ALTER TABLE [dbo].[x_security_zone] WITH CHECK ADD CONSTRAINT [x_security_zone_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
ALTER TABLE [dbo].[x_security_zone] WITH CHECK ADD CONSTRAINT [x_security_zone_FK_upd_by_id] FOREIGN KEY([upd_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
ALTER TABLE [dbo].[x_ranger_global_state] WITH CHECK ADD CONSTRAINT [x_ranger_global_state_FK_added_by_id] FOREIGN KEY([added_by_id]) REFERENCES [dbo].[x_portal_user] ([id])
@@ -4655,6 +4511,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 ('074',CURRENT_TIMESTAMP,'Ranger 3.0.0',CURRENT_TIMESTAMP,'localhost','Y');
INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('075',CURRENT_TIMESTAMP,'Ranger 3.0.0',CURRENT_TIMESTAMP,'localhost','Y');
INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('076',CURRENT_TIMESTAMP,'Ranger 3.0.0',CURRENT_TIMESTAMP,'localhost','Y');
+INSERT INTO x_db_version_h (version,inst_at,inst_by,updated_at,updated_by,active) VALUES ('077',CURRENT_TIMESTAMP,'Ranger 3.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/077-drop-audit-columns-from-policy-ref-tables.sql b/security-admin/db/sqlserver/patches/077-drop-audit-columns-from-policy-ref-tables.sql
new file mode 100644
index 000000000..0be599d6a
--- /dev/null
+++ b/security-admin/db/sqlserver/patches/077-drop-audit-columns-from-policy-ref-tables.sql
@@ -0,0 +1,316 @@
+-- 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.
+
+-- Commented because dropping this column would break high-availability setups
+-- We can uncomment this after the next major version upgrade
+
+SET ANSI_NULLS ON
+GO
+SET QUOTED_IDENTIFIER ON
+GO
+SET ANSI_PADDING ON
+GO
+IF EXISTS (
+ SELECT type_desc, type
+ FROM sys.procedures WITH(NOLOCK)
+ WHERE NAME = 'dropTableColumn'
+ AND type = 'P'
+ )
+BEGIN
+ PRINT 'Proc exist with name dbo.dropTableColumn'
+ DROP PROCEDURE dbo.dropTableColumn
+ PRINT 'Proc dropped dbo.dropTableColumn'
+END
+GO
+CREATE PROCEDURE dbo.dropTableColumn
+ -- Add the parameters for the stored procedure here
+ @tablename nvarchar(100),
+ @columnname nvarchar(100)
+AS
+BEGIN
+ IF EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = @tablename and column_name = @columnname)
+ BEGIN
+ DECLARE @stmt VARCHAR(300);
+ SET @stmt = 'ALTER TABLE [dbo].[' + @tablename + '] DROP COLUMN [' + @columnname + ']'
+ EXEC (@stmt);
+ END
+END
+GO
+
+SET ANSI_NULLS ON
+GO
+SET QUOTED_IDENTIFIER ON
+GO
+SET ANSI_PADDING ON
+GO
+IF EXISTS (
+ SELECT type_desc, type
+ FROM sys.procedures WITH(NOLOCK)
+ WHERE NAME = 'dropTableConstraint'
+ AND type = 'P'
+ )
+BEGIN
+ PRINT 'Proc exist with name dbo.dropTableConstraint'
+ DROP PROCEDURE dbo.dropTableConstraint
+ PRINT 'Proc dropped dbo.dropTableConstraint'
+END
+GO
+CREATE PROCEDURE dbo.dropTableConstraint
+ -- Add the parameters for the stored procedure here
+ @tablename nvarchar(100),
+ @constraintname nvarchar(100)
+AS
+BEGIN
+ IF (OBJECT_ID(@constraintname) IS NOT NULL)
+ BEGIN
+ DECLARE @stmt VARCHAR(300);
+ SET @stmt = 'ALTER TABLE [dbo].[' + @tablename + '] DROP CONSTRAINT ' + @constraintname
+ EXEC (@stmt);
+ END
+END
+GO
+
+EXEC dbo.dropTableColumn 'x_policy_ref_resource', 'guid'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_resource', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_resource', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_resource', 'x_policy_ref_resource_FK_added_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_resource', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_resource', 'x_policy_ref_resource_FK_upd_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_resource', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_policy_ref_role', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_role', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_role', 'x_policy_ref_role_FK_added_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_role', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_role', 'x_policy_ref_role_FK_upd_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_role', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_policy_ref_group', 'guid'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_group', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_group', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_group', 'x_policy_ref_group_FK_added_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_group', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_group', 'x_policy_ref_group_FK_upd_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_group', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_policy_ref_user', 'guid'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_user', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_user', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_user', 'x_policy_ref_user_FK_added_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_user', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_user', 'x_policy_ref_user_FK_upd_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_user', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_policy_ref_access_type', 'guid'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_access_type', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_access_type', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_access_type', 'x_policy_ref_access_type_FK_added_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_access_type', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_access_type', 'x_policy_ref_access_type_FK_upd_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_access_type', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_policy_ref_condition', 'guid'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_condition', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_condition', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_condition', 'x_policy_ref_condition_FK_added_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_condition', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_condition', 'x_policy_ref_condition_FK_upd_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_condition', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_policy_ref_datamask_type', 'guid'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_datamask_type', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_datamask_type', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_datamask_type', 'x_policy_ref_datamask_type_FK_added_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_datamask_type', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_policy_ref_datamask_type', 'x_policy_ref_datamask_type_FK_upd_by'
+GO
+EXEC dbo.dropTableColumn 'x_policy_ref_datamask_type', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_security_zone_ref_service', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_service', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_service', 'x_sz_ref_service_FK_added_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_service', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_service', 'x_sz_ref_service_FK_upd_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_service', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_security_zone_ref_tag_srvc', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_tag_srvc', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_tag_srvc', 'x_sz_ref_tag_service_FK_added_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_tag_srvc', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_tag_srvc', 'x_sz_ref_tag_service_FK_upd_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_tag_srvc', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_security_zone_ref_user', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_user', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_user', 'x_sz_ref_user_FK_added_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_user', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_user', 'x_sz_ref_user_FK_upd_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_user', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_security_zone_ref_group', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_group', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_group', 'x_sz_ref_group_FK_added_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_group', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_group', 'x_sz_ref_group_FK_upd_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_group', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_security_zone_ref_resource', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_resource', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_resource', 'x_sz_ref_resource_FK_added_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_resource', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_security_zone_ref_resource', 'x_sz_ref_resource_FK_upd_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_security_zone_ref_resource', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_role_ref_user', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_role_ref_user', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_role_ref_user', 'x_role_ref_user_FK_added_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_role_ref_user', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_role_ref_user', 'x_role_ref_user_FK_upd_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_role_ref_user', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_role_ref_group', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_role_ref_group', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_role_ref_group', 'x_role_ref_group_FK_added_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_role_ref_group', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_role_ref_group', 'x_role_ref_group_FK_upd_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_role_ref_group', 'upd_by_id'
+GO
+
+EXEC dbo.dropTableColumn 'x_role_ref_role', 'create_time'
+GO
+EXEC dbo.dropTableColumn 'x_role_ref_role', 'update_time'
+GO
+EXEC dbo.dropTableConstraint 'x_role_ref_role', 'x_role_ref_role_FK_added_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_role_ref_role', 'added_by_id'
+GO
+EXEC dbo.dropTableConstraint 'x_role_ref_role', 'x_role_ref_role_FK_upd_by_id'
+GO
+EXEC dbo.dropTableColumn 'x_role_ref_role', 'upd_by_id'
+GO
+
+IF EXISTS (
+ SELECT type_desc, type
+ FROM sys.procedures WITH(NOLOCK)
+ WHERE NAME = 'dropTableColumn'
+ AND type = 'P'
+ )
+BEGIN
+ PRINT 'Proc exist with name dbo.dropTableColumn'
+ DROP PROCEDURE dbo.dropTableColumn
+ PRINT 'Proc dropped dbo.dropTableColumn'
+END
+GO
+
+IF EXISTS (
+ SELECT type_desc, type
+ FROM sys.procedures WITH(NOLOCK)
+ WHERE NAME = 'dropTableConstraint'
+ AND type = 'P'
+ )
+BEGIN
+ PRINT 'Proc exist with name dbo.dropTableConstraint'
+ DROP PROCEDURE dbo.dropTableConstraint
+ PRINT 'Proc dropped dbo.dropTableConstraint'
+END
+GO
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/PolicyRefUpdater.java b/security-admin/src/main/java/org/apache/ranger/biz/PolicyRefUpdater.java
index e0f0ccc20..face43681 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/PolicyRefUpdater.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/PolicyRefUpdater.java
@@ -48,7 +48,6 @@
import org.apache.ranger.plugin.model.RangerPolicy.RangerPolicyItemDataMaskInfo;
import org.apache.ranger.plugin.model.RangerRole;
import org.apache.ranger.plugin.util.ServiceDefUtil;
-import org.apache.ranger.service.RangerAuditFields;
import org.apache.ranger.service.XGroupService;
import org.apache.ranger.view.VXGroup;
import org.apache.ranger.view.VXResponse;
@@ -74,9 +73,6 @@ public class PolicyRefUpdater {
@Autowired
RangerDaoManager daoMgr;
- @Autowired
- RangerAuditFields<?> rangerAuditFields;
-
@Autowired
XUserMgr xUserMgr;
@@ -188,7 +184,7 @@ public void createNewPolMappingForRefTable(RangerPolicy policy, XXPolicy xPolicy
throw new Exception(resource + ": is not a valid resource-type. policy='" + policy.getName() + "' service='" + policy.getService() + "'");
}
- XXPolicyRefResource xPolRes = rangerAuditFields.populateAuditFields(new XXPolicyRefResource(), xPolicy);
+ XXPolicyRefResource xPolRes = new XXPolicyRefResource();
xPolRes.setPolicyId(policy.getId());
xPolRes.setResourceDefId(xResDef.getId());
@@ -286,7 +282,7 @@ public void createNewPolMappingForRefTable(RangerPolicy policy, XXPolicy xPolicy
throw new Exception(accessType + ": is not a valid access-type. policy='" + policy.getName() + "' service='" + policy.getService() + "'");
}
- XXPolicyRefAccessType xPolAccess = rangerAuditFields.populateAuditFields(new XXPolicyRefAccessType(), xPolicy);
+ XXPolicyRefAccessType xPolAccess = new XXPolicyRefAccessType();
xPolAccess.setPolicyId(policy.getId());
xPolAccess.setAccessDefId(xAccTypeDef.getId());
@@ -310,7 +306,7 @@ public void createNewPolMappingForRefTable(RangerPolicy policy, XXPolicy xPolicy
throw new Exception(condition + ": is not a valid condition-type. policy='" + xPolicy.getName() + "' service='" + xPolicy.getService() + "'");
}
- XXPolicyRefCondition xPolCond = rangerAuditFields.populateAuditFields(new XXPolicyRefCondition(), xPolicy);
+ XXPolicyRefCondition xPolCond = new XXPolicyRefCondition();
xPolCond.setPolicyId(policy.getId());
xPolCond.setConditionDefId(xPolCondDef.getId());
@@ -521,7 +517,7 @@ private void createPolicyAssociation(Long id, String name) {
switch (type) {
case USER: {
- XXPolicyRefUser xPolUser = rangerAuditFields.populateAuditFields(new XXPolicyRefUser(), xPolicy);
+ XXPolicyRefUser xPolUser = new XXPolicyRefUser();
xPolUser.setPolicyId(xPolicy.getId());
xPolUser.setUserId(id);
@@ -531,7 +527,7 @@ private void createPolicyAssociation(Long id, String name) {
}
break;
case GROUP: {
- XXPolicyRefGroup xPolGroup = rangerAuditFields.populateAuditFields(new XXPolicyRefGroup(), xPolicy);
+ XXPolicyRefGroup xPolGroup = new XXPolicyRefGroup();
xPolGroup.setPolicyId(xPolicy.getId());
xPolGroup.setGroupId(id);
@@ -541,7 +537,7 @@ private void createPolicyAssociation(Long id, String name) {
}
break;
case ROLE: {
- XXPolicyRefRole xPolRole = rangerAuditFields.populateAuditFields(new XXPolicyRefRole(), xPolicy);
+ XXPolicyRefRole xPolRole = new XXPolicyRefRole();
xPolRole.setPolicyId(xPolicy.getId());
xPolRole.setRoleId(id);
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/RoleRefUpdater.java b/security-admin/src/main/java/org/apache/ranger/biz/RoleRefUpdater.java
index 0ddc5b3a8..c83e0c31f 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/RoleRefUpdater.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/RoleRefUpdater.java
@@ -36,7 +36,6 @@
import org.apache.ranger.entity.XXRoleRefUser;
import org.apache.ranger.entity.XXUser;
import org.apache.ranger.plugin.model.RangerRole;
-import org.apache.ranger.service.RangerAuditFields;
import org.apache.ranger.service.XGroupService;
import org.apache.ranger.view.VXGroup;
import org.apache.ranger.view.VXUser;
@@ -58,9 +57,6 @@ public class RoleRefUpdater {
@Autowired
RangerDaoManager daoMgr;
- @Autowired
- RangerAuditFields<?> rangerAuditFields;
-
@Autowired
RESTErrorUtil restErrorUtil;
@@ -350,7 +346,7 @@ private void createRoleAssociation(Long id, String name) {
switch (type) {
case USER: {
- XXRoleRefUser xRoleRefUser = rangerAuditFields.populateAuditFieldsForCreate(new XXRoleRefUser());
+ XXRoleRefUser xRoleRefUser = new XXRoleRefUser();
xRoleRefUser.setRoleId(roleId);
xRoleRefUser.setUserId(id);
@@ -361,7 +357,7 @@ private void createRoleAssociation(Long id, String name) {
}
break;
case GROUP: {
- XXRoleRefGroup xRoleRefGroup = rangerAuditFields.populateAuditFieldsForCreate(new XXRoleRefGroup());
+ XXRoleRefGroup xRoleRefGroup = new XXRoleRefGroup();
xRoleRefGroup.setRoleId(roleId);
xRoleRefGroup.setGroupId(id);
@@ -372,7 +368,7 @@ private void createRoleAssociation(Long id, String name) {
}
break;
case ROLE: {
- XXRoleRefRole xRoleRefRole = rangerAuditFields.populateAuditFieldsForCreate(new XXRoleRefRole());
+ XXRoleRefRole xRoleRefRole = new XXRoleRefRole();
xRoleRefRole.setRoleId(roleId);
xRoleRefRole.setSubRoleId(id);
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/SecurityZoneRefUpdater.java b/security-admin/src/main/java/org/apache/ranger/biz/SecurityZoneRefUpdater.java
index 0903cf442..f8bd6852d 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/SecurityZoneRefUpdater.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/SecurityZoneRefUpdater.java
@@ -48,7 +48,6 @@
import org.apache.ranger.plugin.model.RangerSecurityZone;
import org.apache.ranger.plugin.model.RangerSecurityZone.RangerSecurityZoneService;
import org.apache.ranger.plugin.model.RangerService;
-import org.apache.ranger.service.RangerAuditFields;
import org.apache.ranger.service.RangerPolicyService;
import org.apache.ranger.service.RangerServiceService;
import org.slf4j.Logger;
@@ -68,9 +67,6 @@ public class SecurityZoneRefUpdater {
@Autowired
RangerDaoManager daoMgr;
- @Autowired
- RangerAuditFields<?> rangerAuditFields;
-
@Autowired
RangerServiceService svcService;
@@ -112,7 +108,7 @@ public void createNewZoneMappingForRefTable(RangerSecurityZone rangerSecurityZon
XXService xService = daoMgr.getXXService().findByName(serviceName);
RangerService rService = svcService.getPopulatedViewObject(xService);
XXServiceDef xServiceDef = daoMgr.getXXServiceDef().findByName(rService.getType());
- XXSecurityZoneRefService xZoneService = rangerAuditFields.populateAuditFieldsForCreate(new XXSecurityZoneRefService());
+ XXSecurityZoneRefService xZoneService = new XXSecurityZoneRefService();
xZoneService.setZoneId(zoneId);
xZoneService.setServiceId(xService.getId());
@@ -136,7 +132,7 @@ public void createNewZoneMappingForRefTable(RangerSecurityZone rangerSecurityZon
for (String resourceName : resourceDefNames) {
XXResourceDef xResourceDef = daoMgr.getXXResourceDef().findByNameAndServiceDefId(resourceName, xServiceDef.getId());
- XXSecurityZoneRefResource xZoneResource = rangerAuditFields.populateAuditFieldsForCreate(new XXSecurityZoneRefResource());
+ XXSecurityZoneRefResource xZoneResource = new XXSecurityZoneRefResource();
xZoneResource.setZoneId(zoneId);
xZoneResource.setResourceDefId(xResourceDef.getId());
@@ -158,7 +154,7 @@ public void createNewZoneMappingForRefTable(RangerSecurityZone rangerSecurityZon
throw restErrorUtil.createRESTException("Tag Service named: " + tagService + " does not exist ", MessageEnums.INVALID_INPUT_DATA);
}
- XXSecurityZoneRefTagService xZoneTagService = rangerAuditFields.populateAuditFieldsForCreate(new XXSecurityZoneRefTagService());
+ XXSecurityZoneRefTagService xZoneTagService = new XXSecurityZoneRefTagService();
xZoneTagService.setZoneId(zoneId);
xZoneTagService.setTagServiceId(xService.getId());
@@ -180,7 +176,7 @@ public void createNewZoneMappingForRefTable(RangerSecurityZone rangerSecurityZon
throw restErrorUtil.createRESTException("user with name: " + user + " does not exist ", MessageEnums.INVALID_INPUT_DATA);
}
- XXSecurityZoneRefUser xZoneUser = rangerAuditFields.populateAuditFieldsForCreate(new XXSecurityZoneRefUser());
+ XXSecurityZoneRefUser xZoneUser = new XXSecurityZoneRefUser();
xZoneUser.setZoneId(zoneId);
xZoneUser.setUserId(xUser.getId());
@@ -203,7 +199,7 @@ public void createNewZoneMappingForRefTable(RangerSecurityZone rangerSecurityZon
throw restErrorUtil.createRESTException("group with name: " + userGroup + " does not exist ", MessageEnums.INVALID_INPUT_DATA);
}
- XXSecurityZoneRefGroup xZoneGroup = rangerAuditFields.populateAuditFieldsForCreate(new XXSecurityZoneRefGroup());
+ XXSecurityZoneRefGroup xZoneGroup = new XXSecurityZoneRefGroup();
xZoneGroup.setZoneId(zoneId);
xZoneGroup.setGroupId(xGroup.getId());
@@ -226,7 +222,7 @@ public void createNewZoneMappingForRefTable(RangerSecurityZone rangerSecurityZon
throw restErrorUtil.createRESTException("role with name: " + role + " does not exist ", MessageEnums.INVALID_INPUT_DATA);
}
- XXSecurityZoneRefRole xZoneRole = rangerAuditFields.populateAuditFieldsForCreate(new XXSecurityZoneRefRole());
+ XXSecurityZoneRefRole xZoneRole = new XXSecurityZoneRefRole();
xZoneRole.setZoneId(zoneId);
xZoneRole.setRoleId(xRole.getId());
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefAccessType.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefAccessType.java
index 13bf1d8f1..165f41d42 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefAccessType.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefAccessType.java
@@ -32,7 +32,7 @@
@Entity
@Cacheable
@Table(name = "x_policy_ref_access_type")
-public class XXPolicyRefAccessType extends XXDBBase implements java.io.Serializable {
+public class XXPolicyRefAccessType implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefCondition.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefCondition.java
index d060aefd4..c2de65ca7 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefCondition.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefCondition.java
@@ -32,7 +32,7 @@
@Entity
@Cacheable
@Table(name = "x_policy_ref_condition")
-public class XXPolicyRefCondition extends XXDBBase implements java.io.Serializable {
+public class XXPolicyRefCondition implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefDataMaskType.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefDataMaskType.java
index 66e138e8c..b85c6949c 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefDataMaskType.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefDataMaskType.java
@@ -32,7 +32,7 @@
@Entity
@Cacheable
@Table(name = "x_policy_ref_datamask_type")
-public class XXPolicyRefDataMaskType extends XXDBBase implements java.io.Serializable {
+public class XXPolicyRefDataMaskType implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefGroup.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefGroup.java
index b73d02232..4fb0d90ec 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefGroup.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefGroup.java
@@ -37,7 +37,7 @@
@Entity
@Cacheable
@Table(name = "x_policy_ref_group")
-public class XXPolicyRefGroup extends XXDBBase implements Serializable {
+public class XXPolicyRefGroup implements Serializable {
private static final long serialVersionUID = 1L;
/**
@@ -96,7 +96,7 @@ public void setId(Long id) {
@Override
public int hashCode() {
- return Objects.hash(super.hashCode(), id, policyId, groupId, groupName);
+ return Objects.hash(id, policyId, groupId, groupName);
}
/*
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefResource.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefResource.java
index 4f04b035c..86db21f23 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefResource.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefResource.java
@@ -32,7 +32,7 @@
@Entity
@Cacheable
@Table(name = "x_policy_ref_resource")
-public class XXPolicyRefResource extends XXDBBase implements java.io.Serializable {
+public class XXPolicyRefResource implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefRole.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefRole.java
index 3a3a4b7a5..846104035 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefRole.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefRole.java
@@ -37,7 +37,7 @@
@Entity
@Cacheable
@Table(name = "x_policy_ref_role")
-public class XXPolicyRefRole extends XXDBBase implements Serializable {
+public class XXPolicyRefRole implements Serializable {
private static final long serialVersionUID = 1L;
/**
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefUser.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefUser.java
index c7d3d27b8..5c8db4a82 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefUser.java
@@ -32,7 +32,7 @@
@Entity
@Cacheable
@Table(name = "x_policy_ref_user")
-public class XXPolicyRefUser extends XXDBBase implements java.io.Serializable {
+public class XXPolicyRefUser implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefGroup.java b/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefGroup.java
index 6fd26af1b..8ba6a58e3 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefGroup.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefGroup.java
@@ -36,7 +36,7 @@
@Entity
@Cacheable
@Table(name = "x_role_ref_group")
-public class XXRoleRefGroup extends XXDBBase implements Serializable {
+public class XXRoleRefGroup implements Serializable {
private static final long serialVersionUID = 1L;
/**
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefRole.java b/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefRole.java
index a9e740760..608834090 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefRole.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefRole.java
@@ -36,7 +36,7 @@
@Entity
@Cacheable
@Table(name = "x_role_ref_role")
-public class XXRoleRefRole extends XXDBBase implements Serializable {
+public class XXRoleRefRole implements Serializable {
private static final long serialVersionUID = 1L;
/**
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefUser.java b/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefUser.java
index 4223647ed..2733d2996 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXRoleRefUser.java
@@ -36,7 +36,7 @@
@Entity
@Cacheable
@Table(name = "x_role_ref_user")
-public class XXRoleRefUser extends XXDBBase implements Serializable {
+public class XXRoleRefUser implements Serializable {
private static final long serialVersionUID = 1L;
/**
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefResource.java b/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefResource.java
index ac5b13383..67dd74a9b 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefResource.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefResource.java
@@ -33,7 +33,7 @@
@Entity
@Cacheable
@Table(name = "x_security_zone_ref_resource")
-public class XXSecurityZoneRefResource extends XXDBBase implements java.io.Serializable {
+public class XXSecurityZoneRefResource implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
@@ -66,7 +66,6 @@ public class XXSecurityZoneRefResource extends XXDBBase implements java.io.Seria
@Column(name = "resource_name")
protected String resourceName;
- @Override
public Long getId() {
return id;
}
@@ -78,7 +77,6 @@ public Long getId() {
* @param id Value to set member attribute <b> id</b>
*/
- @Override
public void setId(Long id) {
this.id = id;
}
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefService.java b/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefService.java
index dff80e93b..5c6dbfe2a 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefService.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefService.java
@@ -33,7 +33,7 @@
@Entity
@Cacheable
@Table(name = "x_security_zone_ref_service")
-public class XXSecurityZoneRefService extends XXDBBase implements java.io.Serializable {
+public class XXSecurityZoneRefService implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
@@ -66,7 +66,6 @@ public class XXSecurityZoneRefService extends XXDBBase implements java.io.Serial
@Column(name = "service_name")
protected String serviceName;
- @Override
public Long getId() {
return id;
}
@@ -78,7 +77,6 @@ public Long getId() {
* @param id Value to set member attribute <b> id</b>
*/
- @Override
public void setId(Long id) {
this.id = id;
}
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefTagService.java b/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefTagService.java
index aaa44b3fd..6efb3ddb4 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefTagService.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefTagService.java
@@ -32,7 +32,7 @@
@Entity
@Cacheable
@Table(name = "x_security_zone_ref_tag_srvc")
-public class XXSecurityZoneRefTagService extends XXDBBase implements java.io.Serializable {
+public class XXSecurityZoneRefTagService implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
@@ -50,12 +50,10 @@ public class XXSecurityZoneRefTagService extends XXDBBase implements java.io.Ser
@Column(name = "tag_srvc_name")
protected String tagServiceName;
- @Override
public Long getId() {
return id;
}
- @Override
public void setId(Long id) {
this.id = id;
}
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefUser.java b/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefUser.java
index 6564455ab..5cbc972b5 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXSecurityZoneRefUser.java
@@ -33,7 +33,7 @@
@Entity
@Cacheable
@Table(name = "x_security_zone_ref_user")
-public class XXSecurityZoneRefUser extends XXDBBase implements java.io.Serializable {
+public class XXSecurityZoneRefUser implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
@@ -74,7 +74,6 @@ public class XXSecurityZoneRefUser extends XXDBBase implements java.io.Serializa
@Column(name = "user_type")
protected Integer userType;
- @Override
public Long getId() {
return id;
}
@@ -86,7 +85,6 @@ public Long getId() {
* @param id Value to set member attribute <b> id</b>
*/
- @Override
public void setId(Long id) {
this.id = id;
}
diff --git a/security-admin/src/main/java/org/apache/ranger/service/XPortalUserService.java b/security-admin/src/main/java/org/apache/ranger/service/XPortalUserService.java
index 3c1294e08..1642a7e12 100644
--- a/security-admin/src/main/java/org/apache/ranger/service/XPortalUserService.java
+++ b/security-admin/src/main/java/org/apache/ranger/service/XPortalUserService.java
@@ -120,43 +120,12 @@ public void updateXXPortalUserReferences(long xXPortalUserId) {
daoManager.getXXPolicyLabels().updateUserIDReference("added_by_id", xXPortalUserId);
daoManager.getXXPolicyLabels().updateUserIDReference("upd_by_id", xXPortalUserId);
daoManager.getXXPolicyLabelMap().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXPolicyLabelMap().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefCondition().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefCondition().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefGroup().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefGroup().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefDataMaskType().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefDataMaskType().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefResource().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefResource().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefUser().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefUser().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefAccessType().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefAccessType().updateUserIDReference("upd_by_id", xXPortalUserId);
- //2.0
+ daoManager.getXXPolicyLabelMap().updateUserIDReference("upd_by_id", xXPortalUserId); //2.0
//Note: skipping x_policy_change_log table as it does not have 'added_by_id' and 'upd_by_id' fields
- daoManager.getXXSecurityZoneRefGroup().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXSecurityZoneRefGroup().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXSecurityZoneRefUser().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXSecurityZoneRefUser().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXSecurityZoneRefResource().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXSecurityZoneRefResource().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXSecurityZoneRefTagService().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXSecurityZoneRefTagService().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXSecurityZoneRefService().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXSecurityZoneRefService().updateUserIDReference("upd_by_id", xXPortalUserId);
daoManager.getXXGlobalState().updateUserIDReference("added_by_id", xXPortalUserId);
daoManager.getXXGlobalState().updateUserIDReference("upd_by_id", xXPortalUserId);
daoManager.getXXSecurityZoneDao().updateUserIDReference("added_by_id", xXPortalUserId);
daoManager.getXXSecurityZoneDao().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXRoleRefRole().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXRoleRefRole().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXRoleRefGroup().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXRoleRefGroup().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXRoleRefUser().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXRoleRefUser().updateUserIDReference("upd_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefRole().updateUserIDReference("added_by_id", xXPortalUserId);
- daoManager.getXXPolicyRefRole().updateUserIDReference("upd_by_id", xXPortalUserId);
daoManager.getXXRole().updateUserIDReference("added_by_id", xXPortalUserId);
daoManager.getXXRole().updateUserIDReference("upd_by_id", xXPortalUserId);
daoManager.getXXGdsDataset().updateUserIDReference("added_by_id", xXPortalUserId);
diff --git a/security-admin/src/test/java/org/apache/ranger/biz/TestRoleRefUpdater.java b/security-admin/src/test/java/org/apache/ranger/biz/TestRoleRefUpdater.java
index 0c09ca1bf..96cb3a6ef 100644
--- a/security-admin/src/test/java/org/apache/ranger/biz/TestRoleRefUpdater.java
+++ b/security-admin/src/test/java/org/apache/ranger/biz/TestRoleRefUpdater.java
@@ -34,7 +34,6 @@
import org.apache.ranger.entity.XXRoleRefUser;
import org.apache.ranger.entity.XXUser;
import org.apache.ranger.plugin.model.RangerRole;
-import org.apache.ranger.service.RangerAuditFields;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
@@ -121,18 +120,13 @@ public void test02_createNewRoleMapping_createsAssociationsForExistingPrincipals
XXRoleRefUserDao urd = mock(XXRoleRefUserDao.class);
XXRoleRefGroupDao grd = mock(XXRoleRefGroupDao.class);
XXRoleRefRoleDao rrd = mock(XXRoleRefRoleDao.class);
- RangerAuditFields<?> audit = (RangerAuditFields<?>) mock(RangerAuditFields.class);
when(dao.getXXUser()).thenReturn(xUserDao);
when(dao.getXXGroup()).thenReturn(xGroupDao);
when(dao.getXXRole()).thenReturn(xRoleDao);
when(dao.getXXRoleRefUser()).thenReturn(urd);
when(dao.getXXRoleRefGroup()).thenReturn(grd);
when(dao.getXXRoleRefRole()).thenReturn(rrd);
- when(audit.populateAuditFieldsForCreate(any(XXRoleRefUser.class))).thenAnswer(a -> a.getArgument(0));
- when(audit.populateAuditFieldsForCreate(any(XXRoleRefGroup.class))).thenAnswer(a -> a.getArgument(0));
- when(audit.populateAuditFieldsForCreate(any(XXRoleRefRole.class))).thenAnswer(a -> a.getArgument(0));
setField(updater, RoleRefUpdater.class, "daoMgr", dao);
- setField(updater, RoleRefUpdater.class, "rangerAuditFields", audit);
setField(updater, RoleRefUpdater.class, "rangerTransactionSynchronizationAdapter",
mock(RangerTransactionSynchronizationAdapter.class));
setField(updater, RoleRefUpdater.class, "xaBizUtil", mock(RangerBizUtil.class));
diff --git a/security-admin/src/test/java/org/apache/ranger/biz/TestSecurityZoneRefUpdater.java b/security-admin/src/test/java/org/apache/ranger/biz/TestSecurityZoneRefUpdater.java
index 6b3c58675..518b516ee 100644
--- a/security-admin/src/test/java/org/apache/ranger/biz/TestSecurityZoneRefUpdater.java
+++ b/security-admin/src/test/java/org/apache/ranger/biz/TestSecurityZoneRefUpdater.java
@@ -50,7 +50,6 @@
import org.apache.ranger.plugin.model.RangerPolicy;
import org.apache.ranger.plugin.model.RangerSecurityZone;
import org.apache.ranger.plugin.model.RangerService;
-import org.apache.ranger.service.RangerAuditFields;
import org.apache.ranger.service.RangerPolicyService;
import org.apache.ranger.service.RangerServiceService;
import org.junit.jupiter.api.Assertions;
@@ -130,11 +129,9 @@ public void test02_createNewZoneMapping_happyPath_createsAllRefs() throws Except
SecurityZoneRefUpdater up = new SecurityZoneRefUpdater();
RangerDaoManager dao = mock(RangerDaoManager.class);
RangerServiceService svcService = mock(RangerServiceService.class);
- RangerAuditFields<?> audit = (RangerAuditFields<?>) mock(RangerAuditFields.class);
RESTErrorUtil rest = mock(RESTErrorUtil.class);
setField(up, SecurityZoneRefUpdater.class, "daoMgr", dao);
setField(up, SecurityZoneRefUpdater.class, "svcService", svcService);
- setField(up, SecurityZoneRefUpdater.class, "rangerAuditFields", audit);
setField(up, SecurityZoneRefUpdater.class, "restErrorUtil", rest);
// zone-ref DAOs for create() verifications
@@ -173,14 +170,6 @@ public void test02_createNewZoneMapping_happyPath_createsAllRefs() throws Except
when(svcService.getPopulatedViewObject(xsvc)).thenReturn(rs);
when(xServiceDefDao.findByName("hdfs")).thenReturn(xsd);
when(xResourceDefDao.findByNameAndServiceDefId("path", 100L)).thenReturn(xrd);
- when(audit.populateAuditFieldsForCreate(any(XXSecurityZoneRefService.class))).thenAnswer(a -> a.getArgument(0));
- when(audit.populateAuditFieldsForCreate(any(XXSecurityZoneRefResource.class)))
- .thenAnswer(a -> a.getArgument(0));
- when(audit.populateAuditFieldsForCreate(any(XXSecurityZoneRefTagService.class)))
- .thenAnswer(a -> a.getArgument(0));
- when(audit.populateAuditFieldsForCreate(any(XXSecurityZoneRefUser.class))).thenAnswer(a -> a.getArgument(0));
- when(audit.populateAuditFieldsForCreate(any(XXSecurityZoneRefGroup.class))).thenAnswer(a -> a.getArgument(0));
- when(audit.populateAuditFieldsForCreate(any(XXSecurityZoneRefRole.class))).thenAnswer(a -> a.getArgument(0));
RangerSecurityZone zone = new RangerSecurityZone();
zone.setId(5L);
@@ -257,11 +246,9 @@ public void test04_createNewZoneMapping_invalidTagService_throws() throws Except
SecurityZoneRefUpdater up = new SecurityZoneRefUpdater();
RangerDaoManager dao = mock(RangerDaoManager.class);
RangerServiceService svcService = mock(RangerServiceService.class);
- RangerAuditFields<?> audit = (RangerAuditFields<?>) mock(RangerAuditFields.class);
RESTErrorUtil rest = mock(RESTErrorUtil.class);
setField(up, SecurityZoneRefUpdater.class, "daoMgr", dao);
setField(up, SecurityZoneRefUpdater.class, "svcService", svcService);
- setField(up, SecurityZoneRefUpdater.class, "rangerAuditFields", audit);
setField(up, SecurityZoneRefUpdater.class, "restErrorUtil", rest);
// Mocks for cleanupRefTables and service lookup
diff --git a/security-admin/src/test/java/org/apache/ranger/biz/TestServiceDBStore.java b/security-admin/src/test/java/org/apache/ranger/biz/TestServiceDBStore.java
index 5051c4052..879db134a 100644
--- a/security-admin/src/test/java/org/apache/ranger/biz/TestServiceDBStore.java
+++ b/security-admin/src/test/java/org/apache/ranger/biz/TestServiceDBStore.java
@@ -684,32 +684,21 @@ public void test13deleteServiceDef() throws Exception {
policyRefAccessType.setId(Id);
policyRefAccessType.setAccessTypeName("myAccessType");
policyRefAccessType.setPolicyId(Id);
- policyRefAccessType.setCreateTime(new Date());
- policyRefAccessType.setUpdateTime(new Date());
- policyRefAccessType.setAddedByUserId(Id);
- policyRefAccessType.setUpdatedByUserId(Id);
policyRefAccessTypeList.add(policyRefAccessType);
List<XXPolicyRefCondition> policyRefConditionsList = new ArrayList<>();
XXPolicyRefCondition policyRefCondition = new XXPolicyRefCondition();
policyRefCondition.setId(Id);
- policyRefCondition.setAddedByUserId(Id);
policyRefCondition.setConditionDefId(Id);
policyRefCondition.setConditionName("myConditionName");
policyRefCondition.setPolicyId(Id);
- policyRefCondition.setUpdatedByUserId(Id);
- policyRefCondition.setCreateTime(new Date());
- policyRefCondition.setUpdateTime(new Date());
policyRefConditionsList.add(policyRefCondition);
List<XXPolicyRefResource> policyRefResourcesList = new ArrayList<>();
XXPolicyRefResource policyRefResource = new XXPolicyRefResource();
- policyRefResource.setAddedByUserId(Id);
- policyRefResource.setCreateTime(new Date());
policyRefResource.setId(Id);
policyRefResource.setPolicyId(Id);
policyRefResource.setResourceDefId(Id);
- policyRefResource.setUpdateTime(new Date());
policyRefResource.setResourceName("myresourceName");
policyRefResourcesList.add(policyRefResource);
diff --git a/security-admin/src/test/java/org/apache/ranger/service/TestXPortalUserService.java b/security-admin/src/test/java/org/apache/ranger/service/TestXPortalUserService.java
index ed29d7e0a..aedc02e2e 100644
--- a/security-admin/src/test/java/org/apache/ranger/service/TestXPortalUserService.java
+++ b/security-admin/src/test/java/org/apache/ranger/service/TestXPortalUserService.java
@@ -54,13 +54,6 @@
import org.apache.ranger.db.XXPolicyItemUserPermDao;
import org.apache.ranger.db.XXPolicyLabelDao;
import org.apache.ranger.db.XXPolicyLabelMapDao;
-import org.apache.ranger.db.XXPolicyRefAccessTypeDao;
-import org.apache.ranger.db.XXPolicyRefConditionDao;
-import org.apache.ranger.db.XXPolicyRefDataMaskTypeDao;
-import org.apache.ranger.db.XXPolicyRefGroupDao;
-import org.apache.ranger.db.XXPolicyRefResourceDao;
-import org.apache.ranger.db.XXPolicyRefRoleDao;
-import org.apache.ranger.db.XXPolicyRefUserDao;
import org.apache.ranger.db.XXPolicyResourceDao;
import org.apache.ranger.db.XXPolicyResourceMapDao;
import org.apache.ranger.db.XXPortalUserDao;
@@ -68,15 +61,7 @@
import org.apache.ranger.db.XXResourceDao;
import org.apache.ranger.db.XXResourceDefDao;
import org.apache.ranger.db.XXRoleDao;
-import org.apache.ranger.db.XXRoleRefGroupDao;
-import org.apache.ranger.db.XXRoleRefRoleDao;
-import org.apache.ranger.db.XXRoleRefUserDao;
import org.apache.ranger.db.XXSecurityZoneDao;
-import org.apache.ranger.db.XXSecurityZoneRefGroupDao;
-import org.apache.ranger.db.XXSecurityZoneRefResourceDao;
-import org.apache.ranger.db.XXSecurityZoneRefServiceDao;
-import org.apache.ranger.db.XXSecurityZoneRefTagServiceDao;
-import org.apache.ranger.db.XXSecurityZoneRefUserDao;
import org.apache.ranger.db.XXServiceConfigDefDao;
import org.apache.ranger.db.XXServiceConfigMapDao;
import org.apache.ranger.db.XXServiceDao;
@@ -156,23 +141,8 @@ public class TestXPortalUserService {
@Mock private XXUgsyncAuditInfoDao xxUgsyncAuditInfoDao;
@Mock private XXPolicyLabelDao xxPolicyLabelDao;
@Mock private XXPolicyLabelMapDao xxPolicyLabelMapDao;
- @Mock private XXPolicyRefConditionDao xxPolicyRefConditionDao;
- @Mock private XXPolicyRefGroupDao xxPolicyRefGroupDao;
- @Mock private XXPolicyRefDataMaskTypeDao xxPolicyRefDataMaskTypeDao;
- @Mock private XXPolicyRefResourceDao xxPolicyRefResourceDao;
- @Mock private XXPolicyRefUserDao xxPolicyRefUserDao;
- @Mock private XXPolicyRefAccessTypeDao xxPolicyRefAccessTypeDao;
- @Mock private XXSecurityZoneRefGroupDao xxSecurityZoneRefGroupDao;
- @Mock private XXSecurityZoneRefUserDao xxSecurityZoneRefUserDao;
- @Mock private XXSecurityZoneRefResourceDao xxSecurityZoneRefResourceDao;
- @Mock private XXSecurityZoneRefTagServiceDao xxSecurityZoneRefTagServiceDao;
- @Mock private XXSecurityZoneRefServiceDao xxSecurityZoneRefServiceDao;
@Mock private XXGlobalStateDao xxGlobalStateDao;
@Mock private XXSecurityZoneDao xxSecurityZoneDao;
- @Mock private XXRoleRefRoleDao xxRoleRefRoleDao;
- @Mock private XXRoleRefGroupDao xxRoleRefGroupDao;
- @Mock private XXRoleRefUserDao xxRoleRefUserDao;
- @Mock private XXPolicyRefRoleDao xxPolicyRefRoleDao;
@Mock private XXRoleDao xxRoleDao;
@Mock private XXGdsDatasetDao xxGdsDatasetDao;
@Mock private XXGdsDataShareDao xxGdsDataShareDao;
@@ -230,23 +200,8 @@ public void testUpdateXXPortalUserReferences_invokesAllDaosForAddedAndUpdatedBy(
when(daoManager.getXXUgsyncAuditInfo()).thenReturn(xxUgsyncAuditInfoDao);
when(daoManager.getXXPolicyLabels()).thenReturn(xxPolicyLabelDao);
when(daoManager.getXXPolicyLabelMap()).thenReturn(xxPolicyLabelMapDao);
- when(daoManager.getXXPolicyRefCondition()).thenReturn(xxPolicyRefConditionDao);
- when(daoManager.getXXPolicyRefGroup()).thenReturn(xxPolicyRefGroupDao);
- when(daoManager.getXXPolicyRefDataMaskType()).thenReturn(xxPolicyRefDataMaskTypeDao);
- when(daoManager.getXXPolicyRefResource()).thenReturn(xxPolicyRefResourceDao);
- when(daoManager.getXXPolicyRefUser()).thenReturn(xxPolicyRefUserDao);
- when(daoManager.getXXPolicyRefAccessType()).thenReturn(xxPolicyRefAccessTypeDao);
- when(daoManager.getXXSecurityZoneRefGroup()).thenReturn(xxSecurityZoneRefGroupDao);
- when(daoManager.getXXSecurityZoneRefUser()).thenReturn(xxSecurityZoneRefUserDao);
- when(daoManager.getXXSecurityZoneRefResource()).thenReturn(xxSecurityZoneRefResourceDao);
- when(daoManager.getXXSecurityZoneRefTagService()).thenReturn(xxSecurityZoneRefTagServiceDao);
- when(daoManager.getXXSecurityZoneRefService()).thenReturn(xxSecurityZoneRefServiceDao);
when(daoManager.getXXGlobalState()).thenReturn(xxGlobalStateDao);
when(daoManager.getXXSecurityZoneDao()).thenReturn(xxSecurityZoneDao);
- when(daoManager.getXXRoleRefRole()).thenReturn(xxRoleRefRoleDao);
- when(daoManager.getXXRoleRefGroup()).thenReturn(xxRoleRefGroupDao);
- when(daoManager.getXXRoleRefUser()).thenReturn(xxRoleRefUserDao);
- when(daoManager.getXXPolicyRefRole()).thenReturn(xxPolicyRefRoleDao);
when(daoManager.getXXRole()).thenReturn(xxRoleDao);
when(daoManager.getXXGdsDataset()).thenReturn(xxGdsDatasetDao);
when(daoManager.getXXGdsDataShare()).thenReturn(xxGdsDataShareDao);
@@ -266,8 +221,7 @@ public void testUpdateXXPortalUserReferences_invokesAllDaosForAddedAndUpdatedBy(
verify(xxServiceDefDao).updateUserIDReference("upd_by_id", uid);
verify(xxPolicyDao).updateUserIDReference("added_by_id", uid);
verify(xxPolicyDao).updateUserIDReference("upd_by_id", uid);
- verify(xxSecurityZoneRefGroupDao).updateUserIDReference("added_by_id", uid);
- verify(xxSecurityZoneRefGroupDao).updateUserIDReference("upd_by_id", uid);
+ // Note: security zone ref and role ref tables no longer have audit fields
verify(xxGdsDatasetInProjectDao).updateUserIDReference("approver_id", uid);
verify(xxGdsDataShareInDatasetDao).updateUserIDReference("approver_id", uid);
}