You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ve...@apache.org on 2015/02/19 21:11:45 UTC
[1/5] incubator-ranger git commit: RANGER-239: Support JDBC based SQL
invocation for setup process
Repository: incubator-ranger
Updated Branches:
refs/heads/master 1283c9652 -> 9c2f0d1fb
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/xa_db.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/xa_db.sql b/security-admin/db/xa_db.sql
deleted file mode 100644
index 4b2919f..0000000
--- a/security-admin/db/xa_db.sql
+++ /dev/null
@@ -1,778 +0,0 @@
--- 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.
-
--- MySQL dump 10.13 Distrib 5.1.50, for apple-darwin10.3.0 (i386)
---
--- Host: localhost Database: xa_db
--- ------------------------------------------------------
--- Server version 5.1.50
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Current Database: `xa_db`
---
-
-/*!40000 DROP DATABASE IF EXISTS `xa_db`*/;
-
-CREATE DATABASE /*!32312 IF NOT EXISTS*/ `xa_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
-
-USE `xa_db`;
-
---
--- Temporary table structure for view `vx_trx_log`
---
-
-DROP TABLE IF EXISTS `vx_trx_log`;
-/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE TABLE `vx_trx_log` (
- `id` bigint(20),
- `create_time` datetime,
- `update_time` datetime,
- `added_by_id` bigint(20),
- `upd_by_id` bigint(20),
- `class_type` int(11),
- `object_id` bigint(20),
- `parent_object_id` bigint(20),
- `parent_object_class_type` int(11),
- `attr_name` varchar(255),
- `parent_object_name` varchar(1024),
- `object_name` varchar(1024),
- `prev_val` varchar(1024),
- `new_val` varchar(1024),
- `trx_id` varchar(1024),
- `action` varchar(255),
- `sess_id` varchar(512),
- `req_id` varchar(30),
- `sess_type` varchar(30)
-) ENGINE=MyISAM */;
-SET character_set_client = @saved_cs_client;
-
---
--- Table structure for table `x_asset`
---
-
-DROP TABLE IF EXISTS `x_asset`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_asset` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `asset_name` varchar(1024) NOT NULL,
- `descr` varchar(4000) NOT NULL,
- `act_status` int(11) NOT NULL DEFAULT '0',
- `asset_type` int(11) NOT NULL DEFAULT '0',
- `config` text,
- `sup_native` tinyint(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `x_asset_FK_added_by_id` (`added_by_id`),
- KEY `x_asset_FK_upd_by_id` (`upd_by_id`),
- KEY `x_asset_cr_time` (`create_time`),
- KEY `x_asset_up_time` (`update_time`),
- CONSTRAINT `x_asset_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_asset_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_asset`
---
-
-LOCK TABLES `x_asset` WRITE;
-/*!40000 ALTER TABLE `x_asset` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_asset` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_audit_map`
---
-
-DROP TABLE IF EXISTS `x_audit_map`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_audit_map` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `res_id` bigint(20) DEFAULT NULL,
- `group_id` bigint(20) DEFAULT NULL,
- `user_id` bigint(20) DEFAULT NULL,
- `audit_type` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `x_audit_map_FK_added_by_id` (`added_by_id`),
- KEY `x_audit_map_FK_upd_by_id` (`upd_by_id`),
- KEY `x_audit_map_FK_res_id` (`res_id`),
- KEY `x_audit_map_FK_group_id` (`group_id`),
- KEY `x_audit_map_FK_user_id` (`user_id`),
- KEY `x_audit_map_cr_time` (`create_time`),
- KEY `x_audit_map_up_time` (`update_time`),
- CONSTRAINT `x_audit_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_audit_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_audit_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`),
- CONSTRAINT `x_audit_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_audit_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_audit_map`
---
-
-LOCK TABLES `x_audit_map` WRITE;
-/*!40000 ALTER TABLE `x_audit_map` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_audit_map` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_auth_sess`
---
-
-DROP TABLE IF EXISTS `x_auth_sess`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_auth_sess` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `login_id` varchar(767) NOT NULL,
- `user_id` bigint(20) DEFAULT NULL,
- `ext_sess_id` varchar(512) DEFAULT NULL,
- `auth_time` datetime NOT NULL,
- `auth_status` int(11) NOT NULL DEFAULT '0',
- `auth_type` int(11) NOT NULL DEFAULT '0',
- `auth_provider` int(11) NOT NULL DEFAULT '0',
- `device_type` int(11) NOT NULL DEFAULT '0',
- `req_ip` varchar(48) NOT NULL,
- `req_ua` varchar(1024) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_auth_sess_FK_added_by_id` (`added_by_id`),
- KEY `x_auth_sess_FK_upd_by_id` (`upd_by_id`),
- KEY `x_auth_sess_FK_user_id` (`user_id`),
- KEY `x_auth_sess_cr_time` (`create_time`),
- KEY `x_auth_sess_up_time` (`update_time`),
- CONSTRAINT `x_auth_sess_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_auth_sess_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_auth_sess_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_auth_sess`
---
-
-LOCK TABLES `x_auth_sess` WRITE;
-/*!40000 ALTER TABLE `x_auth_sess` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_auth_sess` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_cred_store`
---
-
-DROP TABLE IF EXISTS `x_cred_store`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_cred_store` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `store_name` varchar(1024) NOT NULL,
- `descr` varchar(4000) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `x_cred_store_FK_added_by_id` (`added_by_id`),
- KEY `x_cred_store_FK_upd_by_id` (`upd_by_id`),
- KEY `x_cred_store_cr_time` (`create_time`),
- KEY `x_cred_store_up_time` (`update_time`),
- CONSTRAINT `x_cred_store_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_cred_store_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_cred_store`
---
-
-LOCK TABLES `x_cred_store` WRITE;
-/*!40000 ALTER TABLE `x_cred_store` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_cred_store` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_db_base`
---
-
-DROP TABLE IF EXISTS `x_db_base`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_db_base` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_db_base_FK_added_by_id` (`added_by_id`),
- KEY `x_db_base_FK_upd_by_id` (`upd_by_id`),
- KEY `x_db_base_cr_time` (`create_time`),
- KEY `x_db_base_up_time` (`update_time`),
- CONSTRAINT `x_db_base_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_db_base_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_db_base`
---
-
-LOCK TABLES `x_db_base` WRITE;
-/*!40000 ALTER TABLE `x_db_base` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_db_base` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_group`
---
-
-DROP TABLE IF EXISTS `x_group`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_group` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `group_name` varchar(1024) NOT NULL,
- `descr` varchar(4000) NOT NULL,
- `status` int(11) NOT NULL DEFAULT '0',
- `group_type` int(11) NOT NULL DEFAULT '0',
- `group_src` int(11) NOT NULL DEFAULT '0',
- `cred_store_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_group_FK_added_by_id` (`added_by_id`),
- KEY `x_group_FK_upd_by_id` (`upd_by_id`),
- KEY `x_group_FK_cred_store_id` (`cred_store_id`),
- KEY `x_group_cr_time` (`create_time`),
- KEY `x_group_up_time` (`update_time`),
- CONSTRAINT `x_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_group_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`),
- CONSTRAINT `x_group_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_group`
---
-
-LOCK TABLES `x_group` WRITE;
-/*!40000 ALTER TABLE `x_group` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_group` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_group_groups`
---
-
-DROP TABLE IF EXISTS `x_group_groups`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_group_groups` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `group_name` varchar(1024) NOT NULL,
- `p_group_id` bigint(20) DEFAULT NULL,
- `group_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_group_groups_FK_added_by_id` (`added_by_id`),
- KEY `x_group_groups_FK_upd_by_id` (`upd_by_id`),
- KEY `x_group_groups_FK_p_group_id` (`p_group_id`),
- KEY `x_group_groups_FK_group_id` (`group_id`),
- KEY `x_group_groups_cr_time` (`create_time`),
- KEY `x_group_groups_up_time` (`update_time`),
- CONSTRAINT `x_group_groups_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_group_groups_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_group_groups_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_group_groups_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_group_groups`
---
-
-LOCK TABLES `x_group_groups` WRITE;
-/*!40000 ALTER TABLE `x_group_groups` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_group_groups` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_group_users`
---
-
-DROP TABLE IF EXISTS `x_group_users`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_group_users` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `group_name` varchar(1024) NOT NULL,
- `p_group_id` bigint(20) DEFAULT NULL,
- `user_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_group_users_FK_added_by_id` (`added_by_id`),
- KEY `x_group_users_FK_upd_by_id` (`upd_by_id`),
- KEY `x_group_users_FK_p_group_id` (`p_group_id`),
- KEY `x_group_users_FK_user_id` (`user_id`),
- KEY `x_group_users_cr_time` (`create_time`),
- KEY `x_group_users_up_time` (`update_time`),
- CONSTRAINT `x_group_users_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_group_users_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_group_users_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_group_users_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_group_users`
---
-
-LOCK TABLES `x_group_users` WRITE;
-/*!40000 ALTER TABLE `x_group_users` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_group_users` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_perm_map`
---
-
-DROP TABLE IF EXISTS `x_perm_map`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_perm_map` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `perm_group` varchar(1024) DEFAULT NULL,
- `res_id` bigint(20) DEFAULT NULL,
- `group_id` bigint(20) DEFAULT NULL,
- `user_id` bigint(20) DEFAULT NULL,
- `perm_for` int(11) NOT NULL DEFAULT '0',
- `perm_type` int(11) NOT NULL DEFAULT '0',
- `is_recursive` int(11) NOT NULL DEFAULT '0',
- `is_wild_card` tinyint(1) NOT NULL DEFAULT '1',
- `grant_revoke` tinyint(1) NOT NULL DEFAULT '1',
- `ip_address` text,
- PRIMARY KEY (`id`),
- KEY `x_perm_map_FK_added_by_id` (`added_by_id`),
- KEY `x_perm_map_FK_upd_by_id` (`upd_by_id`),
- KEY `x_perm_map_FK_res_id` (`res_id`),
- KEY `x_perm_map_FK_group_id` (`group_id`),
- KEY `x_perm_map_FK_user_id` (`user_id`),
- KEY `x_perm_map_cr_time` (`create_time`),
- KEY `x_perm_map_up_time` (`update_time`),
- CONSTRAINT `x_perm_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_perm_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_perm_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`),
- CONSTRAINT `x_perm_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_perm_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_perm_map`
---
-
-LOCK TABLES `x_perm_map` WRITE;
-/*!40000 ALTER TABLE `x_perm_map` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_perm_map` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_policy_export_audit`
---
-
-DROP TABLE IF EXISTS `x_policy_export_audit`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_policy_export_audit` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `client_ip` varchar(255) NOT NULL,
- `agent_id` varchar(255) DEFAULT NULL,
- `req_epoch` bigint(20) NOT NULL,
- `last_updated` datetime DEFAULT NULL,
- `repository_name` varchar(1024) DEFAULT NULL,
- `exported_json` text,
- `http_ret_code` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `x_policy_export_audit_FK_added_by_id` (`added_by_id`),
- KEY `x_policy_export_audit_FK_upd_by_id` (`upd_by_id`),
- KEY `x_policy_export_audit_cr_time` (`create_time`),
- KEY `x_policy_export_audit_up_time` (`update_time`),
- CONSTRAINT `x_policy_export_audit_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_policy_export_audit_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_policy_export_audit`
---
-
-LOCK TABLES `x_policy_export_audit` WRITE;
-/*!40000 ALTER TABLE `x_policy_export_audit` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_policy_export_audit` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_portal_user`
---
-
-DROP TABLE IF EXISTS `x_portal_user`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_portal_user` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `first_name` varchar(1022) DEFAULT NULL,
- `last_name` varchar(1022) DEFAULT NULL,
- `pub_scr_name` varchar(2048) DEFAULT NULL,
- `login_id` varchar(767) DEFAULT NULL,
- `password` varchar(512) NOT NULL,
- `email` varchar(512) DEFAULT NULL,
- `status` int(11) NOT NULL DEFAULT '0',
- `user_src` int(11) NOT NULL DEFAULT '0',
- `notes` varchar(4000) DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `x_portal_user_UK_login_id` (`login_id`),
- UNIQUE KEY `x_portal_user_UK_email` (`email`),
- KEY `x_portal_user_FK_added_by_id` (`added_by_id`),
- KEY `x_portal_user_FK_upd_by_id` (`upd_by_id`),
- KEY `x_portal_user_cr_time` (`create_time`),
- KEY `x_portal_user_up_time` (`update_time`),
- KEY `x_portal_user_name` (`first_name`(767)),
- KEY `x_portal_user_email` (`email`),
- CONSTRAINT `x_portal_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_portal_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_portal_user`
---
-
-LOCK TABLES `x_portal_user` WRITE;
-/*!40000 ALTER TABLE `x_portal_user` DISABLE KEYS */;
-INSERT INTO `x_portal_user` VALUES (1,'2014-05-25 00:07:26','2014-05-25 00:07:26',NULL,NULL,'Admin','','Admin','admin','ceb4f32325eda6142bd65215f4c0f371','',1,0,NULL);
-/*!40000 ALTER TABLE `x_portal_user` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_portal_user_role`
---
-
-DROP TABLE IF EXISTS `x_portal_user_role`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_portal_user_role` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `user_id` bigint(20) NOT NULL,
- `user_role` varchar(128) DEFAULT NULL,
- `status` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `x_portal_user_role_FK_added_by_id` (`added_by_id`),
- KEY `x_portal_user_role_FK_upd_by_id` (`upd_by_id`),
- KEY `x_portal_user_role_FK_user_id` (`user_id`),
- KEY `x_portal_user_role_cr_time` (`create_time`),
- KEY `x_portal_user_role_up_time` (`update_time`),
- CONSTRAINT `x_portal_user_role_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_portal_user_role_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_portal_user_role_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_portal_user_role`
---
-
-LOCK TABLES `x_portal_user_role` WRITE;
-/*!40000 ALTER TABLE `x_portal_user_role` DISABLE KEYS */;
-INSERT INTO `x_portal_user_role` VALUES (1,'2014-05-25 00:07:26','2014-05-25 00:07:26',NULL,NULL,1,'ROLE_SYS_ADMIN',1);
-/*!40000 ALTER TABLE `x_portal_user_role` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_resource`
---
-
-DROP TABLE IF EXISTS `x_resource`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_resource` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `res_name` varchar(4000) DEFAULT NULL,
- `policy_name` varchar(500) DEFAULT NULL,
- `descr` varchar(4000) DEFAULT NULL,
- `res_type` int(11) NOT NULL DEFAULT '0',
- `asset_id` bigint(20) NOT NULL,
- `parent_id` bigint(20) DEFAULT NULL,
- `parent_path` varchar(4000) DEFAULT NULL,
- `is_encrypt` int(11) NOT NULL DEFAULT '0',
- `is_recursive` int(11) NOT NULL DEFAULT '0',
- `res_group` varchar(1024) DEFAULT NULL,
- `res_dbs` text,
- `res_tables` text,
- `res_col_fams` text,
- `res_cols` text,
- `res_udfs` text,
- `res_status` int(11) NOT NULL DEFAULT '1',
- `table_type` int(11) NOT NULL DEFAULT '0',
- `col_type` int(11) NOT NULL DEFAULT '0',
- `res_topologies` text,
- `res_services` text,
- PRIMARY KEY (`id`),
- UNIQUE KEY `policy_name` (`policy_name`),
- KEY `x_resource_FK_added_by_id` (`added_by_id`),
- KEY `x_resource_FK_upd_by_id` (`upd_by_id`),
- KEY `x_resource_FK_asset_id` (`asset_id`),
- KEY `x_resource_FK_parent_id` (`parent_id`),
- KEY `x_resource_cr_time` (`create_time`),
- KEY `x_resource_up_time` (`update_time`),
- CONSTRAINT `x_resource_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_resource_FK_asset_id` FOREIGN KEY (`asset_id`) REFERENCES `x_asset` (`id`),
- CONSTRAINT `x_resource_FK_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `x_resource` (`id`),
- CONSTRAINT `x_resource_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_resource`
---
-
-LOCK TABLES `x_resource` WRITE;
-/*!40000 ALTER TABLE `x_resource` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_resource` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_trx_log`
---
-
-DROP TABLE IF EXISTS `x_trx_log`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_trx_log` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `class_type` int(11) NOT NULL DEFAULT '0',
- `object_id` bigint(20) DEFAULT NULL,
- `parent_object_id` bigint(20) DEFAULT NULL,
- `parent_object_class_type` int(11) NOT NULL DEFAULT '0',
- `parent_object_name` varchar(1024) DEFAULT NULL,
- `object_name` varchar(1024) DEFAULT NULL,
- `attr_name` varchar(255) DEFAULT NULL,
- `prev_val` varchar(1024) DEFAULT NULL,
- `new_val` varchar(1024) DEFAULT NULL,
- `trx_id` varchar(1024) DEFAULT NULL,
- `action` varchar(255) DEFAULT NULL,
- `sess_id` varchar(512) DEFAULT NULL,
- `req_id` varchar(30) DEFAULT NULL,
- `sess_type` varchar(30) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_trx_log_FK_added_by_id` (`added_by_id`),
- KEY `x_trx_log_FK_upd_by_id` (`upd_by_id`),
- KEY `x_trx_log_cr_time` (`create_time`),
- KEY `x_trx_log_up_time` (`update_time`),
- CONSTRAINT `x_trx_log_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_trx_log_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_trx_log`
---
-
-LOCK TABLES `x_trx_log` WRITE;
-/*!40000 ALTER TABLE `x_trx_log` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_trx_log` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_user`
---
-
-DROP TABLE IF EXISTS `x_user`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_user` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `user_name` varchar(1024) NOT NULL,
- `descr` varchar(4000) NOT NULL,
- `status` int(11) NOT NULL DEFAULT '0',
- `cred_store_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_user_FK_added_by_id` (`added_by_id`),
- KEY `x_user_FK_upd_by_id` (`upd_by_id`),
- KEY `x_user_FK_cred_store_id` (`cred_store_id`),
- KEY `x_user_cr_time` (`create_time`),
- KEY `x_user_up_time` (`update_time`),
- CONSTRAINT `x_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_user_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`),
- CONSTRAINT `x_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_user`
---
-
-LOCK TABLES `x_user` WRITE;
-/*!40000 ALTER TABLE `x_user` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_user` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `xa_access_audit`
---
-
-DROP TABLE IF EXISTS `xa_access_audit`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `xa_access_audit` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `audit_type` int(11) NOT NULL DEFAULT '0',
- `access_result` int(11) DEFAULT '0',
- `access_type` varchar(255) DEFAULT NULL,
- `acl_enforcer` varchar(255) DEFAULT NULL,
- `agent_id` varchar(255) DEFAULT NULL,
- `client_ip` varchar(255) DEFAULT NULL,
- `client_type` varchar(255) DEFAULT NULL,
- `policy_id` bigint(20) DEFAULT '0',
- `repo_name` varchar(255) DEFAULT NULL,
- `repo_type` int(11) DEFAULT '0',
- `result_reason` varchar(255) DEFAULT NULL,
- `session_id` varchar(255) DEFAULT NULL,
- `event_time` datetime DEFAULT NULL,
- `request_user` varchar(255) DEFAULT NULL,
- `action` varchar(2000) DEFAULT NULL,
- `request_data` varchar(2000) DEFAULT NULL,
- `resource_path` varchar(2000) DEFAULT NULL,
- `resource_type` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `xa_access_audit_FK_added_by_id` (`added_by_id`),
- KEY `xa_access_audit_FK_upd_by_id` (`upd_by_id`),
- KEY `xa_access_audit_cr_time` (`create_time`),
- KEY `xa_access_audit_up_time` (`update_time`),
- CONSTRAINT `xa_access_audit_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `xa_access_audit_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `xa_access_audit`
---
-
-LOCK TABLES `xa_access_audit` WRITE;
-/*!40000 ALTER TABLE `xa_access_audit` DISABLE KEYS */;
-/*!40000 ALTER TABLE `xa_access_audit` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Current Database: `xa_db`
---
-
-USE `xa_db`;
-
---
--- Final view structure for view `vx_trx_log`
---
-
-/*!50001 DROP TABLE IF EXISTS `vx_trx_log`*/;
-/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = latin1 */;
-/*!50001 SET character_set_results = latin1 */;
-/*!50001 SET collation_connection = latin1_swedish_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`xaadmin`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `vx_trx_log` AS select `x_trx_log`.`id` AS `id`,`x_trx_log`.`create_time` AS `create_time`,`x_trx_log`.`update_time` AS `update_time`,`x_trx_log`.`added_by_id` AS `added_by_id`,`x_trx_log`.`upd_by_id` AS `upd_by_id`,`x_trx_log`.`class_type` AS `class_type`,`x_trx_log`.`object_id` AS `object_id`,`x_trx_log`.`parent_object_id` AS `parent_object_id`,`x_trx_log`.`parent_object_class_type` AS `parent_object_class_type`,`x_trx_log`.`attr_name` AS `attr_name`,`x_trx_log`.`parent_object_name` AS `parent_object_name`,`x_trx_log`.`object_name` AS `object_name`,`x_trx_log`.`prev_val` AS `prev_val`,`x_trx_log`.`new_val` AS `new_val`,`x_trx_log`.`trx_id` AS `trx_id`,`x_trx_log`.`action` AS `action`,`x_trx_log`.`sess_id` AS `sess_id`,`x_trx_log`.`req_id` AS `req_id`,`x_trx_log`.`sess_type` AS `sess_type` from `x_trx_log` group by `x_trx_log`.`trx_id` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2014-05-25 0:07:27
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/xa_db_bare.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/xa_db_bare.sql b/security-admin/db/xa_db_bare.sql
deleted file mode 100644
index 8204f1d..0000000
--- a/security-admin/db/xa_db_bare.sql
+++ /dev/null
@@ -1,15 +0,0 @@
--- 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.
-
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/pom.xml
----------------------------------------------------------------------
diff --git a/security-admin/pom.xml b/security-admin/pom.xml
index 97606b6..6d313b6 100644
--- a/security-admin/pom.xml
+++ b/security-admin/pom.xml
@@ -257,11 +257,13 @@
<artifactId>log4jdbc</artifactId>
<version>${googlecode.log4jdbc.version}</version>
</dependency>
+ <!--
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
+ -->
<dependency>
<groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
<artifactId>owasp-java-html-sanitizer</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/scripts/db_setup.py
----------------------------------------------------------------------
diff --git a/security-admin/scripts/db_setup.py b/security-admin/scripts/db_setup.py
new file mode 100644
index 0000000..e488403
--- /dev/null
+++ b/security-admin/scripts/db_setup.py
@@ -0,0 +1,757 @@
+#
+# Licensed 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. See accompanying LICENSE file.
+#
+
+import os
+import re
+import sys
+import errno
+import shlex
+import logging
+import subprocess
+import fileinput
+from os.path import basename
+#import commands
+from datetime import date
+globalDict = {}
+
+def check_output(query):
+ p = subprocess.Popen(query, stdout=subprocess.PIPE)
+ output = p.communicate ()[0]
+ return output
+
+def log(msg,type):
+ if type == 'info':
+ logging.info(" %s",msg)
+ if type == 'debug':
+ logging.debug(" %s",msg)
+ if type == 'warning':
+ logging.warning(" %s",msg)
+ if type == 'exception':
+ logging.exception(" %s",msg)
+
+#'''
+def populate_global_dict():
+ global globalDict
+ #RANGER_ADMIN_HOME = os.getenv("RANGER_ADMIN_HOME")
+ read_config_file = open(os.path.join(os.getcwd(),'install.properties'))
+ #library_path = os.path.join(RANGER_ADMIN_HOME,"cred","lib","*")
+ for each_line in read_config_file.read().split('\n') :
+ if len(each_line) == 0 : continue
+ if re.search('=', each_line):
+ key , value = each_line.strip().split("=",1)
+ key = key.strip()
+
+ if 'PASSWORD' in key:
+ jceks_file_path = os.path.join(os.getenv('RANGER_HOME'), 'jceks','ranger_db.jceks')
+ statuscode,value = call_keystore(library_path,key,'',jceks_file_path,'get')
+ if statuscode == 1:
+ value = ''
+ value = value.strip()
+ globalDict[key] = value
+#'''
+#----------------------------------------------
+class BaseDB(object):
+
+ def init_logfiles(self):
+ FORMAT = '%(asctime)-15s %(message)s'
+ logging.basicConfig(format=FORMAT, level=logging.DEBUG)
+
+ def create_rangerdb_user(self, root_user, db_user, db_password, db_root_password):
+ log("---------- Creating User ----------", "info")
+
+ def check_table(self, db_name, root_user, db_root_password, TABLE_NAME):
+ log("---------- Verifying table ----------", "info")
+ def import_file_to_db(self, root_user, db_name, db_user, db_password, db_root_password, file_name):
+ log("---------- Importing db schema ----------", "info")
+
+ def upgrade_db(self, db_name, root_user, db_user, db_password, db_root_password, DBVERSION_CATALOG_CREATION):
+ log("\nCreating Baseline DB upgrade ... \n", "debug")
+ self.import_db_file(db_name, root_user, db_user, db_password, db_root_password, DBVERSION_CATALOG_CREATION)
+ log("\nBaseline DB upgraded successfully\n", "info")
+
+
+ def apply_patches(self, db_name, root_user, db_user, db_password ,db_root_password, PATCHES_PATH):
+ #first get all patches and then apply each patch
+ files = os.listdir(PATCHES_PATH)
+ # files: coming from os.listdir() sorted alphabetically, thus not numerically
+ if files:
+ sorted_files = sorted(files, key=lambda x: str(x.split('.')[0]))
+ for filename in sorted_files:
+ currentPatch = PATCHES_PATH + "/"+filename
+ self.import_db_patches(db_name, root_user, db_user, db_password ,db_root_password, currentPatch)
+ else:
+ log("No Patches to apply.","info")
+
+ def create_auditdb_user(self, xa_db_host , audit_db_host , db_name ,audit_db_name, xa_db_root_user, audit_db_root_user, db_user, audit_db_user, xa_db_root_password, audit_db_root_password, db_password, audit_db_password, file_name , TABLE_NAME):
+ log("----------------- Create Audit User ------------", "info")
+
+
+
+class MysqlConf(BaseDB):
+ # Constructor
+ def __init__(self, host,SQL_CONNECTOR_JAR,JAVA_BIN):
+ self.host = host
+ self.SQL_CONNECTOR_JAR = SQL_CONNECTOR_JAR
+ self.JAVA_BIN = JAVA_BIN
+ BaseDB.init_logfiles(self)
+
+ def get_jisql_cmd(self, user, password ,db_name):
+ #TODO: User array for forming command
+ jisql_cmd = "%s -cp %s:jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://%s/%s -u %s -p %s -noheader -trim -c \;" %(self.JAVA_BIN,self.SQL_CONNECTOR_JAR,self.host,db_name,user,password)
+ return jisql_cmd
+
+
+ def create_rangerdb_user(self, root_user, db_user, db_password, db_root_password):
+ hosts_arr =["%", "localhost"]
+ for host in hosts_arr:
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password ,'mysql')
+ query = get_cmd + " -query \"select user from mysql.user where user='%s' and host='%s';\"" %(db_user,host)
+ output = check_output(shlex.split(query))
+ if output.strip(db_user + " |"):
+ log( "\nMYSQL User: " + db_user + " already exists!", "debug")
+ else:
+ log("User does not exists", "info")
+ if db_password == "":
+ log ("Creating MySQL user: "+ db_user +" with DB password blank\n", "info")
+ query = get_cmd + " -query \"create user '%s'@'%s';\"" %(db_user, host)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ query = get_cmd + " -query \"select user from mysql.user where user='%s' and host='%s';\"" %(db_user,host)
+ output = check_output(shlex.split(query))
+ if output.strip(db_user + " |"):
+ log("Mysql user " + db_user +" created","info")
+ else:
+ log("Creating Mysql user " + db_user +" Failed","info")
+ sys.exit(1)
+ else:
+ log ("Creating MySQL user: "+ db_user +" with DB password\n", "info")
+ query = get_cmd + " -query \"create user '%s'@'%s' identified by '%s';\"" %(db_user, host, db_password)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log("Mysql user " + db_user +" created","info")
+ else:
+ log("Creating Mysql user " + db_user +" Failed","info")
+ sys.exit(1)
+
+ def verify_db(self, root_user, db_root_password, db_name):
+ log("\nVerifying Database: " + db_name + "\n", "debug")
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password, 'mysql')
+ query = get_cmd + " -query \"show databases like '%s';\"" %(db_name)
+ output = check_output(shlex.split(query))
+ if output.strip(db_name + " |"):
+ return True
+ else:
+ return False
+
+
+ def import_file_to_db(self, root_user, db_name, db_user, db_password, db_root_password, file_name):
+ log ("\nImporting db schema to Database: " + db_name,"debug");
+ if self.verify_db(root_user, db_root_password, db_name):
+ log("\nDatabase: "+db_name + " already exists. Ignoring import_db\n","info")
+ else:
+ log("\nDatabase does not exist. Creating database : " + db_name,"info")
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password, 'mysql')
+ query = get_cmd + " -query \"create database %s;\"" %(db_name)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret != 0:
+ log("\nDatabase creation failed!!\n","info")
+ sys.exit(1)
+ else:
+ if self.verify_db(root_user, db_root_password, db_name):
+ log("Creating database: " + db_name + " succeeded", "info")
+ self.import_db_file(db_name, root_user , db_user, db_password, db_root_password, file_name)
+ else:
+ log("\nDatabase creation failed!!\n","info")
+ sys.exit(1)
+
+
+ def grant_xa_db_user(self, root_user, db_name, db_user, db_password, db_root_password , is_revoke):
+ hosts_arr =["%", "localhost"]
+ if is_revoke:
+ for host in hosts_arr:
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password, 'mysql')
+ query = get_cmd + " -query \"REVOKE ALL PRIVILEGES,GRANT OPTION FROM '%s'@'%s';\"" %(db_user, host)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ query = get_cmd + " -query \"FLUSH PRIVILEGES;\""
+ ret = subprocess.check_call(shlex.split(query))
+ if ret != 0:
+ sys.exit(1)
+ else:
+ sys.exit(1)
+
+ for host in hosts_arr:
+ log ("---------------GRANTING PRIVILEGES TO user '"+db_user+"'@'"+host+"' on db '"+db_name+"'-------------" , "info")
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password, 'mysql')
+ query = get_cmd + " -query \"grant all privileges on %s.* to '%s'@'%s' with grant option;\"" %(db_name,db_user, host)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log ("---------------FLUSH PRIVILEGES -------------" , "info")
+ query = get_cmd + " -query \"FLUSH PRIVILEGES;\""
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log("Privileges granted to '" + db_user + "' on '"+db_name+"'\n", "info")
+ else:
+ log("Granting privileges to '" +db_user+"' FAILED on '"+db_name+"'\n", "info")
+ sys.exit(1)
+ else:
+ log("\nGranting privileges to '" +db_user+"' FAILED on '"+db_name+"'\n", "info")
+ sys.exit(1)
+
+
+ def grant_audit_db_user(self, audit_root_user, audit_db_name, audit_db_user, audit_db_password, audit_db_root_password,TABLE_NAME, is_revoke):
+ hosts_arr =["%", "localhost"]
+ if is_revoke == True:
+ for host in hosts_arr:
+ get_cmd = self.get_jisql_cmd(audit_root_user, audit_db_root_password, 'mysql')
+ query = get_cmd + " -query \"REVOKE ALL PRIVILEGES,GRANT OPTION FROM '%s'@'%s';\"" %(audit_db_user, host)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ query = get_cmd + " -query \"FLUSH PRIVILEGES;\""
+ ret = subprocess.check_call(shlex.split(query))
+ if ret != 0:
+ sys.exit(1)
+ else:
+ sys.exit(1)
+
+ for host in hosts_arr:
+ log ("---------------GRANTING PRIVILEGES TO '"+ audit_db_user + "' on '" + audit_db_name+"'-------------" , "info")
+ get_cmd = self.get_jisql_cmd(audit_root_user, audit_db_root_password, 'mysql')
+ query = get_cmd + " -query \"GRANT INSERT ON %s.%s TO '%s'@'%s';\"" %(audit_db_name,TABLE_NAME,audit_db_user,host)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ get_cmd = self.get_jisql_cmd(audit_root_user, audit_db_root_password, 'mysql')
+ query = get_cmd + " -query \"FLUSH PRIVILEGES;\""
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log("Granting privileges to '" + audit_db_user+"' Done on '"+ audit_db_name+"'\n", "info")
+ else:
+ log("Granting privileges to '" +audit_db_user+"' Failed on '" + audit_db_name+"'\n", "info")
+ sys.exit(1)
+ else:
+ log("\nGranting privileges to '" + audit_db_user+"' Failed on '" + audit_db_name+"'\n", "info")
+ sys.exit(1)
+
+
+ def import_db_file(self, db_name, root_user, db_user, db_password, db_root_password, file_name):
+ name = basename(file_name)
+ if os.path.isfile(file_name):
+ log("Importing db schema to database : " + db_name + " from file: " + name,"info")
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password, db_name)
+ query = get_cmd + " -input %s" %file_name
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log(name + " DB schema imported successfully\n","info")
+ else:
+ log(name + " DB Schema import failed!\n","info")
+ sys.exit(1)
+ else:
+ log("\nDB Schema file " + name+ " not found\n","exception")
+ sys.exit(1)
+
+ def import_db_patches(self, db_name, root_user, db_user, db_password, db_root_password, file_name):
+ name = basename(file_name)
+ if os.path.isfile(file_name):
+ version = name.split('-')[0]
+ log("Executing patch on : " + db_name + " from file: " + name,"info")
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password, db_name)
+ query = get_cmd + " -query \"select version from x_db_version_h where version = '%s' and active = 'Y';\"" %(version)
+ output = check_output(shlex.split(query))
+ if output.strip(version + " |"):
+ log("Patch "+ name +" is already Applied" ,"info")
+ else:
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password, db_name)
+ query = get_cmd + " -input %s" %file_name
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log(name + " Patch Applied\n","info")
+ query = get_cmd + " -query \"insert into x_db_version_h (version, inst_at, inst_by, updated_at, updated_by) values ('%s', now(), user(), now(), user()) ;\"" %(version)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log("Patch version updated", "info")
+ else:
+ log("Updating Patch version failed", "info")
+ sys.exit(1)
+ else:
+ log(name + "\n Import failed!\n","info")
+ sys.exit(1)
+ else:
+ log("\nImport " +name + " file not found\n","exception")
+ sys.exit(1)
+
+
+ def check_table(self, db_name, root_user, db_root_password, TABLE_NAME):
+ if self.verify_db(root_user, db_root_password, db_name):
+ log("Verifying table " + TABLE_NAME +" in database " + db_name, "debug")
+
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password, db_name)
+ query = get_cmd + " -query \"show tables like '%s';\"" %(TABLE_NAME)
+ output = check_output(shlex.split(query))
+ if output.strip(TABLE_NAME + " |"):
+ log("Table " + TABLE_NAME +" already exists in database " + db_name + "\n","info")
+ return True
+ else:
+ log("Table " + TABLE_NAME +" does not exist in database " + db_name + "\n","info")
+ return False
+ else:
+ log("Database " + db_name +" does not exist\n","info")
+ return False
+
+
+ def create_auditdb_user(self, xa_db_host, audit_db_host, db_name, audit_db_name, xa_db_root_user, audit_db_root_user, db_user, audit_db_user, xa_db_root_password, audit_db_root_password, db_password, audit_db_password, file_name , TABLE_NAME):
+ hosts_arr =["%", "localhost"]
+ for host in hosts_arr:
+ get_cmd = self.get_jisql_cmd(audit_db_root_user, audit_db_root_password ,'mysql')
+ query = get_cmd + " -query \"select user from mysql.user where user='%s' and host='%s';\"" %(audit_db_user,host)
+ output = check_output(shlex.split(query))
+ if output.strip(audit_db_user + " |"):
+ log( "\nMYSQL User: " + audit_db_user + " already exists!", "debug")
+ else:
+ log("User does not exists", "info")
+ if audit_db_password == "":
+ log ("Creating MySQL user: "+ audit_db_user +" with DB password blank\n", "info")
+ query = get_cmd + " -query \" create user '%s'@'%s';\"" %(audit_db_user, host)
+ ret = subprocess.check_call(shlex.split(query))
+ else:
+ log ("Creating MySQL user: "+ audit_db_user +" with DB password\n", "info")
+ query = get_cmd + " -query \"create user '%s'@'%s' identified by '%s';\"" %(audit_db_user,host,audit_db_password)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log( "\nMYSQL User: " + audit_db_user + " Created", "info")
+ else:
+ sys.exit(1)
+
+ query = get_cmd + " -query \"REVOKE ALL PRIVILEGES,GRANT OPTION FROM '%s'@'%s';\"" %(audit_db_user, host)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ query = get_cmd + " -query \"FLUSH PRIVILEGES;\""
+ ret = subprocess.check_call(shlex.split(query))
+ else:
+ sys.exit(1)
+
+ log("\n--------- Check audit table exists --------- \n","info")
+ output = self.check_table(audit_db_name,audit_db_root_user,audit_db_root_password,TABLE_NAME)
+ if output == False:
+ self.import_file_to_db(audit_db_root_user, audit_db_name ,audit_db_user, audit_db_password, audit_db_root_password, file_name)
+ self.grant_xa_db_user(audit_db_root_user, audit_db_name, db_user, db_password, audit_db_root_password, False)
+ if audit_db_user == db_user:
+ is_revoke = False
+ else:
+ is_revoke = True
+ self.grant_audit_db_user(audit_db_root_user, audit_db_name, audit_db_user, audit_db_password, audit_db_root_password,TABLE_NAME, is_revoke)
+
+
+
+class OracleConf(BaseDB):
+ # Constructor
+ def __init__(self, host,SQL_CONNECTOR_JAR,JAVA_BIN):
+ self.host = host
+ self.SQL_CONNECTOR_JAR = SQL_CONNECTOR_JAR
+ self.JAVA_BIN = JAVA_BIN
+ BaseDB.init_logfiles(self)
+
+ def get_jisql_cmd(self, user, password):
+ #TODO: User array for forming command
+ jisql_cmd = "%s -cp %s:jisql/lib/* org.apache.util.sql.Jisql -driver oraclethin -cstring jdbc:oracle:thin:@%s -u '%s' -p '%s' -noheader -trim" %(self.JAVA_BIN,self.SQL_CONNECTOR_JAR,self.host, user, password)
+ return jisql_cmd
+
+
+ def create_rangerdb_user(self, root_user, db_user, db_password, db_root_password):
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password)
+ query = get_cmd + " -c \; -query \"select username from all_users where UPPER(username)=UPPER('%s');\"" %(db_user)
+ output = check_output(shlex.split(query))
+ if output.strip(db_user+" |"):
+ log( "Oracle User: " + db_user + " already exists!", "debug")
+ else:
+ log("User does not exists, Creating User : " + db_user, "info")
+ query = get_cmd + " -c \; -query 'create user %s identified by \"%s\";'" %(db_user, db_password)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ query = get_cmd + " -c \; -query \"select username from all_users where UPPER(username)=UPPER('%s');\"" %(db_user)
+ output = check_output(shlex.split(query))
+ if output.strip(db_user+" |"):
+ log("Granting Permission to " + db_user, "info")
+ query = get_cmd + " -c \; -query 'GRANT CREATE SESSION,CREATE PROCEDURE,CREATE TABLE,CREATE VIEW,CREATE SEQUENCE,CREATE PUBLIC SYNONYM,CREATE TRIGGER,UNLIMITED Tablespace TO %s WITH ADMIN OPTION;'" % (db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log("\nGranting permissions to oracle user '" + db_user + "' for %s DONE\n" %(self.host), "info")
+ else:
+ log("\nGranting permissions to oracle user '" + db_user + "' FAILED\n", "info")
+ sys.exit(1)
+ else:
+ log("\nCreating ORACLE user '" + db_user + "' FAILED\n", "info")
+ sys.exit(1)
+
+
+ def verify_user(self, root_user, db_user, db_root_password):
+ log("Verifying User: " + db_user +"\n","debug")
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password)
+ query = get_cmd + " -c \; -query \"select count(*) from all_users where upper(username)=upper('%s');\"" %(db_user)
+ output = check_output(shlex.split(query))
+ if output.strip(db_user+" |"):
+ return True
+ else:
+ return False
+
+
+ def verify_tablespace(self, root_user,db_user, db_root_password, db_name):
+ log("Verifying Tablespace: " + db_name+"\n","debug")
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password)
+ query = get_cmd + " -c \; -query \"SELECT DISTINCT UPPER(TABLESPACE_NAME) FROM USER_TablespaceS where UPPER(Tablespace_Name)=UPPER(\'%s\');\"" %(db_name)
+ output = check_output(shlex.split(query))
+ if output.strip(db_name+' |'):
+ return True
+ else:
+ return False
+
+
+ def import_file_to_db(self, root_user ,db_name, db_user, db_password, db_root_password,file_name):
+ #Verifying Users
+ if self.verify_user(root_user,db_user, db_root_password):
+ log("User : " +db_user + " already exists.", "info")
+ else:
+ log("User does not exist " + db_user, "info")
+ sys.exit(1)
+
+ if self.verify_tablespace(root_user, db_user, db_root_password, db_name):
+ log("Tablespace " + db_name + " already exists.","info")
+ if re.search('xa_core_db' , file_name):
+ status = False
+ else:
+ status = True
+ else:
+ log("Tablespace does not exist. Creating Tablespace: " + db_name,"info")
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password)
+ query = get_cmd + " -c \; -query \"create tablespace %s datafile '%s.dat' size 10M autoextend on;\"" %(db_name, db_name)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret != 0:
+ log("Tablespace creation failed!!\n","exception" )
+ sys.exit(1)
+ else:
+ log("Creating Tablespace "+db_name+" succeeded", "info")
+ status = self.verify_tablespace(root_user, db_user, db_root_password, db_name)
+ if status == False:
+ sys.exit(1)
+
+ if status == True:
+ log("ASSIGN DEFAULT Tablespace :" +db_name , "info")
+ # ASSIGN DEFAULT Tablespace db_name
+ get_cmd = self.get_jisql_cmd(root_user , db_root_password)
+ query = get_cmd +" -c \; -query 'alter user %s identified by \"%s\" DEFAULT Tablespace %s;'" %(db_user, db_password, db_name)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log("Granting Permission to " + db_user, "info")
+ query = get_cmd + " -c \; -query 'GRANT CREATE SESSION,CREATE PROCEDURE,CREATE TABLE,CREATE VIEW,CREATE SEQUENCE,CREATE PUBLIC SYNONYM,CREATE TRIGGER,UNLIMITED Tablespace TO %s WITH ADMIN OPTION;'" % (db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ self.import_db_file(db_name, root_user ,db_user, db_password, db_root_password ,file_name)
+ return True
+ else:
+ log("\nGranting Oracle user '" + db_user + "' FAILED\n", "info")
+ sys.exit(1)
+ else:
+ return False
+
+ def import_audit_file_to_db(self, audit_db_root_user, db_name ,audit_db_name, db_user, audit_db_user, db_password, audit_db_password, audit_db_root_password, file_name, TABLE_NAME):
+ #Verifying Users
+ if self.verify_user(audit_db_root_user, db_user, audit_db_root_password):
+ log("User : " +db_user + " already exists.", "info")
+ else:
+ log("User does not exist " + db_user, "info")
+ sys.exit(1)
+
+ if self.verify_user(audit_db_root_user, audit_db_user, audit_db_root_password):
+ log("User : " +audit_db_user + " already exists.", "info")
+ else:
+ log("User does not exist " + audit_db_user, "info")
+ sys.exit(1)
+
+ if self.verify_tablespace(audit_db_root_user, db_user, audit_db_root_password, audit_db_name):
+ log("\nTablespace " + audit_db_name + " already exists.","info")
+ status1 = True
+ else:
+ log("\nTablespace does not exist. Creating Tablespace: \n" + audit_db_name,"info")
+ get_cmd = self.get_jisql_cmd(audit_db_root_user, audit_db_root_password)
+ query = get_cmd + " -c \; -query \"create tablespace %s datafile '%s.dat' size 10M autoextend on;\"" %(audit_db_name, audit_db_name)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret != 0:
+ log("\nTablespace creation failed!!\n","info")
+ sys.exit(1)
+ else:
+ log("Creating Tablespace "+ audit_db_name + " succeeded", "info")
+ status1 = True
+
+ if self.verify_tablespace(audit_db_root_user, db_user, audit_db_root_password, db_name):
+ log("Tablespace " + db_name + " already exists.","info")
+ status2 = True
+ else:
+ log("Tablespace does not exist. Creating Tablespace: " + db_name,"info")
+ get_cmd = self.get_jisql_cmd(audit_db_root_user, audit_db_root_password)
+ query = get_cmd + " -c \; -query \"create tablespace %s datafile '%s.dat' size 10M autoextend on;\"" %(db_name, db_name)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret != 0:
+ log("\nTablespace creation failed!!\n","info")
+ sys.exit(1)
+ else:
+ log("Creating Tablespace "+ db_name + " succeeded", "info")
+ status2 = True
+
+ if (status1 == True and status2 == True):
+ log("ASSIGN DEFAULT Tablespace :" + db_name , "info")
+ # ASSIGN DEFAULT Tablespace db_name
+ get_cmd = self.get_jisql_cmd(audit_db_root_user , audit_db_root_password)
+ query = get_cmd +" -c \; -query 'alter user %s identified by \"%s\" DEFAULT Tablespace %s;'" %(audit_db_user, audit_db_password, db_name)
+ ret1 = subprocess.check_call(shlex.split(query))
+
+ log("ASSIGN DEFAULT Tablespace :" + audit_db_name , "info")
+ # ASSIGN DEFAULT Tablespace db_name
+ get_cmd = self.get_jisql_cmd(audit_db_root_user , audit_db_root_password)
+ query = get_cmd +" -c \; -query 'alter user %s identified by \"%s\" DEFAULT Tablespace %s;'" %(audit_db_user, audit_db_password, audit_db_name)
+ ret2 = subprocess.check_call(shlex.split(query))
+
+ if (ret1 == 0 and ret2 == 0):
+ log("Granting Permission to " + db_user, "info")
+ query = get_cmd + " -c \; -query 'GRANT CREATE SESSION,CREATE PROCEDURE,CREATE TABLE,CREATE VIEW,CREATE SEQUENCE,CREATE PUBLIC SYNONYM,CREATE TRIGGER,UNLIMITED Tablespace TO %s WITH ADMIN OPTION;'" % (db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+
+ if self.check_table(db_name, audit_db_root_user, audit_db_root_password, TABLE_NAME):
+ log("Table exists " + TABLE_NAME +" in tablespace " + db_name ,"info")
+ else:
+ self.import_db_file(audit_db_name, audit_db_root_user ,db_user, db_password, audit_db_root_password ,file_name)
+ query = get_cmd + " -c \; -query 'GRANT CREATE SESSION TO %s;'" % (audit_db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret != 0:
+ sys.exit(1)
+ query = get_cmd + " -c \; -query 'GRANT SELECT ON %s.XA_ACCESS_AUDIT_SEQ TO %s;'" % (db_user,audit_db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret != 0:
+ sys.exit(1)
+ query = get_cmd + " -c \; -query 'GRANT INSERT ON %s.XA_ACCESS_AUDIT TO %s;'" % (db_user,audit_db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret != 0:
+ sys.exit(1)
+ return True
+ else:
+ log("\nGranting Oracle user '" + db_user + "' FAILED\n", "info")
+ sys.exit(1)
+ else:
+ return False
+
+
+ def grant_xa_db_user(self, root_user, db_name, db_user, db_password, db_root_password, invoke):
+ log("Granting Permission to " + db_user, "info")
+ get_cmd = self.get_jisql_cmd(root_user ,db_root_password)
+ query = get_cmd + " -c \; -query 'GRANT CREATE SESSION,CREATE PROCEDURE,CREATE TABLE,CREATE VIEW,CREATE SEQUENCE,CREATE PUBLIC SYNONYM,CREATE TRIGGER,UNLIMITED Tablespace TO %s WITH ADMIN OPTION;'" % (db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ return True
+ else:
+ log("\nGranting Oracle user '" + db_user + "' FAILED\n", "info")
+ sys.exit(1)
+
+
+ def grant_audit_db_user(self, audit_db_root_user, audit_db_name ,db_user,audit_db_user,db_password,audit_db_password, audit_db_root_password):
+ log("Granting Permission to " + db_user, "info")
+ get_cmd = self.get_jisql_cmd(audit_db_root_user, audit_db_root_password)
+ query = get_cmd + " -c \; -query 'GRANT CREATE SESSION,CREATE PROCEDURE,CREATE TABLE,CREATE VIEW,CREATE SEQUENCE,CREATE PUBLIC SYNONYM,CREATE TRIGGER,UNLIMITED Tablespace TO %s WITH ADMIN OPTION;'" % (db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ return True
+ else:
+ log("\nGranting Oracle user '" + db_user + "' FAILED\n", "info")
+ sys.exit(1)
+
+ def import_db_file(self, db_name, root_user ,db_user, db_password, db_root_password,file_name):
+ name = basename(file_name)
+ if os.path.isfile(file_name):
+ log("Importing script : " + db_name + " from file: " + name,"info")
+ get_cmd = self.get_jisql_cmd(db_user, db_password)
+ query = get_cmd + " -input %s -c \;" %file_name
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log(name + " Imported successfully\n","info")
+ else:
+ log(name + " Import failed!\n","info")
+ sys.exit(1)
+ else:
+ log("\nImport " +name + " sql file not found\n","debug")
+ sys.exit(1)
+
+ def import_db_patches(self, db_name, root_user, db_user, db_password, db_root_password,file_name):
+ if os.path.isfile(file_name):
+ name = basename(file_name)
+ version = name.split('-')[0]
+ log("Executing patch on : " + db_name + " from file: " + name,"info")
+ get_cmd = self.get_jisql_cmd(db_user, db_password)
+ query = get_cmd + " -c \; -query \"select version from x_db_version_h where version = '%s' and active = 'Y';\"" %(version)
+ output = check_output(shlex.split(query))
+ if output.strip(version +" |"):
+ log("Patch "+ name +" is already Applied" ,"info")
+ else:
+ get_cmd = self.get_jisql_cmd(db_user, db_password)
+ query = get_cmd + " -input %s -c /" %file_name
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log(name + " Patch Applied\n","info")
+ query = get_cmd + " -c \; -query \"insert into x_db_version_h (id,version, inst_at, inst_by, updated_at, updated_by) values ( X_DB_VERSION_H_SEQ.nextval,'%s', sysdate, '%s', sysdate, '%s');\"" %(version, db_user, db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log("Patch version updated", "info")
+ else:
+ log("Updating Patch version failed", "info")
+ sys.exit(1)
+ else:
+ log(name + "\n Import failed!\n","info")
+ sys.exit(1)
+ else:
+ log("\nPatch file not found\n","debug")
+ sys.exit(1)
+
+
+ def check_table(self, db_name, root_user, db_root_password, TABLE_NAME):
+ log("Verifying table " + TABLE_NAME +" in tablespace " + db_name, "debug")
+ get_cmd = self.get_jisql_cmd(root_user, db_root_password)
+ query = get_cmd + " -c \; -query \"select UPPER(table_name) from all_tables where UPPER(tablespace_name)=UPPER('%s') and UPPER(table_name)=UPPER('%s');\"" %(db_name ,TABLE_NAME)
+ output = check_output(shlex.split(query))
+ if output.strip(TABLE_NAME.upper() + ' |'):
+ log("Table " + TABLE_NAME +" already exists in Tablespace " + db_name + "\n","info")
+ return True
+ else:
+ log("Table " + TABLE_NAME +" does not exist in Tablespace " + db_name + "\n","info")
+ return False
+
+
+ def create_auditdb_user(self, xa_db_host , audit_db_host , db_name ,audit_db_name, xa_db_root_user, audit_db_root_user, db_user, audit_db_user, xa_db_root_password, audit_db_root_password, db_password, audit_db_password, file_name , TABLE_NAME):
+ self.create_rangerdb_user(audit_db_root_user, db_user, db_password, audit_db_root_password)
+
+ get_cmd = self.get_jisql_cmd(audit_db_root_user, audit_db_root_password)
+ query = get_cmd + " -c \; -query \"select username from all_users where UPPER(username)=UPPER('%s');\"" %(audit_db_user)
+ output = check_output(shlex.split(query))
+ if output.strip(audit_db_user+" |"):
+ log( "Oracle Audit User: " + audit_db_user + " already exists!", "debug")
+ else:
+ log("Audit User does not exists, Creating Audit User : " + audit_db_user, "info")
+ query = get_cmd + " -c \; -query 'create user %s identified by \"%s\";'" %(audit_db_user, audit_db_password)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ query = get_cmd + " -c \; -query \"GRANT CREATE SESSION TO %s;\"" %(audit_db_user)
+ ret = subprocess.check_call(shlex.split(query))
+ if ret == 0:
+ log("Granting Permission to " + audit_db_user + " Done", "info")
+ else:
+ log("Granting Permission to " + audit_db_user + " Failed", "info")
+ sys.exit(1)
+
+
+ log("\n--------- Check audit table exists --------- \n","info")
+ output = self.check_table(audit_db_name, audit_db_root_user, audit_db_root_password, TABLE_NAME)
+ if output == False:
+ self.import_audit_file_to_db(audit_db_root_user, db_name, audit_db_name, db_user, audit_db_user, db_password, audit_db_password, audit_db_root_password, file_name,TABLE_NAME)
+ self.grant_xa_db_user(audit_db_root_user, audit_db_name, db_user, db_password, audit_db_root_password, True)
+ self.grant_audit_db_user(audit_db_root_user, audit_db_name ,db_user, audit_db_user, db_password,audit_db_password, audit_db_root_password)
+
+
+
+def main():
+ populate_global_dict()
+ JAVA_BIN=globalDict['JAVA_BIN']
+ XA_DB_FLAVOR=globalDict['DB_FLAVOR']
+ AUDIT_DB_FLAVOR=globalDict['DB_FLAVOR']
+ XA_DB_FLAVOR.upper()
+ AUDIT_DB_FLAVOR.upper()
+
+ xa_db_host = globalDict['db_host']
+ audit_db_host = globalDict['db_host']
+
+ mysql_dbversion_catalog = 'db/mysql/create_dbversion_catalog.sql'
+ mysql_core_file = globalDict['mysql_core_file']
+ mysql_audit_file = globalDict['mysql_audit_file']
+ mysql_patches = 'db/mysql/patches'
+
+ oracle_dbversion_catalog = 'db/oracle/create_dbversion_catalog.sql'
+ oracle_core_file = globalDict['oracle_core_file']
+ oracle_audit_file = globalDict['oracle_audit_file']
+ oracle_patches = 'db/oracle/patches'
+
+ db_name = globalDict['db_name']
+ db_user = globalDict['db_user']
+ db_password = globalDict['db_password']
+ xa_db_root_user = globalDict['db_root_user']
+ xa_db_root_password = globalDict['db_root_password']
+
+ x_db_version = 'x_db_version_h'
+ xa_access_audit = 'xa_access_audit'
+
+ audit_db_name = globalDict['audit_db_name']
+ audit_db_user = globalDict['audit_db_user']
+ audit_db_password = globalDict['audit_db_password']
+ audit_db_root_user = globalDict['db_root_user']
+ audit_db_root_password = globalDict['db_root_password']
+
+
+
+
+ if XA_DB_FLAVOR == "MYSQL":
+ MYSQL_CONNECTOR_JAR=globalDict['SQL_CONNECTOR_JAR']
+ xa_sqlObj = MysqlConf(xa_db_host,MYSQL_CONNECTOR_JAR,JAVA_BIN)
+ xa_db_version_file = os.path.join(os.getcwd(),mysql_dbversion_catalog)
+ xa_db_core_file = os.path.join(os.getcwd(),mysql_core_file)
+ xa_patch_file = os.path.join(os.getcwd(),mysql_patches)
+
+ elif XA_DB_FLAVOR == "ORACLE":
+ ORACLE_CONNECTOR_JAR=globalDict['SQL_CONNECTOR_JAR']
+ xa_db_root_user = xa_db_root_user+" AS SYSDBA"
+ xa_sqlObj = OracleConf(xa_db_host,ORACLE_CONNECTOR_JAR,JAVA_BIN)
+ xa_db_version_file = os.path.join(os.getcwd(),oracle_dbversion_catalog)
+ xa_db_core_file = os.path.join(os.getcwd(),oracle_core_file)
+ xa_patch_file = os.path.join(os.getcwd(),oracle_patches)
+ else:
+ log ("--------- NO SUCH FLAVOUR ---------", "info")
+ sys.exit(1)
+
+ if AUDIT_DB_FLAVOR == "MYSQL":
+ MYSQL_CONNECTOR_JAR=globalDict['SQL_CONNECTOR_JAR']
+ audit_sqlObj = MysqlConf(audit_db_host,MYSQL_CONNECTOR_JAR,JAVA_BIN)
+ audit_db_file = os.path.join(os.getcwd(),mysql_audit_file)
+
+ elif AUDIT_DB_FLAVOR == "ORACLE":
+ ORACLE_CONNECTOR_JAR=globalDict['SQL_CONNECTOR_JAR']
+ audit_db_root_user = audit_db_root_user+" AS SYSDBA"
+ audit_sqlObj = OracleConf(audit_db_host,ORACLE_CONNECTOR_JAR,JAVA_BIN)
+ audit_db_file = os.path.join(os.getcwd(),oracle_audit_file)
+ else:
+ log ("--------- NO SUCH FLAVOUR ---------", "info")
+ sys.exit(1)
+
+
+ # Methods Begin
+ log("\n--------- Creating admin user --------- \n","info")
+ xa_sqlObj.create_rangerdb_user(xa_db_root_user, db_user, db_password, xa_db_root_password)
+ log("\n--------- Importing DB Core Database ---------\n","info")
+ xa_sqlObj.import_file_to_db(xa_db_root_user, db_name, db_user, db_password, xa_db_root_password, xa_db_core_file)
+ xa_sqlObj.grant_xa_db_user(xa_db_root_user, db_name, db_user, db_password, xa_db_root_password, True)
+ log("\n--------- Check Table ---------\n","info")
+ output = xa_sqlObj.check_table(db_name, xa_db_root_user, xa_db_root_password, x_db_version)
+ if output == False:
+ log("\n--------- Updating Database ---------\n","info")
+ xa_sqlObj.upgrade_db(db_name, xa_db_root_user, db_user, db_password, xa_db_root_password, xa_db_version_file)
+ log("\n--------- Applying Patches ---------\n","info")
+ xa_sqlObj.apply_patches(db_name, xa_db_root_user, db_user, db_password, xa_db_root_password, xa_patch_file)
+ # Ranger Admin DB Host AND Ranger Audit DB Host are Different OR Same
+ log("\n--------- Creating audit user --------- \n","info")
+ audit_sqlObj.create_auditdb_user(xa_db_host, audit_db_host, db_name, audit_db_name, xa_db_root_user, audit_db_root_user, db_user, audit_db_user, xa_db_root_password, audit_db_root_password, db_password, audit_db_password, audit_db_file, xa_access_audit)
+
+main()
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/scripts/install.properties
----------------------------------------------------------------------
diff --git a/security-admin/scripts/install.properties b/security-admin/scripts/install.properties
index b835bba..0ff950b 100644
--- a/security-admin/scripts/install.properties
+++ b/security-admin/scripts/install.properties
@@ -18,6 +18,7 @@
#
#------------------------- DB CONFIG - BEGIN ----------------------------------
+PYTHON_COMMAND_INVOKER='python'
#DB_FLAVOR=ORACLE
#DB_FLAVOR=MYSQL
@@ -52,7 +53,7 @@ db_host=localhost
#
# DB UserId used for the XASecure schema
-#
+#
db_name=ranger
db_user=rangeradmin
db_password=
@@ -152,14 +153,14 @@ JAVA_BIN='java'
JAVA_VERSION_REQUIRED='1.7'
JAVA_ORACLE='Java(TM) SE Runtime Environment'
-mysql_create_user_file=${PWD}/db/create_dev_user.sql
-mysql_core_file=${PWD}/db/xa_core_db.sql
-mysql_audit_file=${PWD}/db/xa_audit_db.sql
-mysql_asset_file=${PWD}/db/reset_asset.sql
+#mysql_create_user_file=${PWD}/db/mysql/create_dev_user.sql
+mysql_core_file=db/mysql/xa_core_db.sql
+mysql_audit_file=db/mysql/xa_audit_db.sql
+#mysql_asset_file=${PWD}/db/mysql/reset_asset.sql
#oracle_create_user_file=${PWD}/db/oracle/create_dev_user_oracle.sql
-oracle_core_file=${PWD}/db/oracle/xa_core_db_oracle.sql
-oracle_audit_file=${PWD}/db/oracle/xa_audit_db_oracle.sql
+oracle_core_file=db/oracle/xa_core_db_oracle.sql
+oracle_audit_file=db/oracle/xa_audit_db_oracle.sql
#oracle_asset_file=${PWD}/db/oracle/reset_asset_oracle.sql
#
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/scripts/setup.sh
----------------------------------------------------------------------
diff --git a/security-admin/scripts/setup.sh b/security-admin/scripts/setup.sh
index e9b69a6..beb1a55 100755
--- a/security-admin/scripts/setup.sh
+++ b/security-admin/scripts/setup.sh
@@ -171,6 +171,15 @@ check_db_version() {
fi
}
+check_python_command() {
+ if is_command ${PYTHON_COMMAND_INVOKER} ; then
+ log "[I] '${PYTHON_COMMAND_INVOKER}' command found"
+ else
+ log "[E] '${PYTHON_COMMAND_INVOKER}' command not found"
+ exit 1;
+ fi
+}
+
check_db_connector() {
if [ "${DB_FLAVOR}" == "MYSQL" ]
then
@@ -446,7 +455,7 @@ upgrade_db() {
log "[I] - starting upgradedb ... "
if [ "${DB_FLAVOR}" == "MYSQL" ]
then
- DBVERSION_CATALOG_CREATION=db/create_dbversion_catalog.sql
+ DBVERSION_CATALOG_CREATION=db/mysql/create_dbversion_catalog.sql
if [ -f ${DBVERSION_CATALOG_CREATION} ]
then
log "[I] Verifying database version catalog table .... "
@@ -457,7 +466,7 @@ upgrade_db() {
dt=`date '+%s'`
tempFile=/tmp/sql_${dt}_$$.sql
- sqlfiles=`ls -1 db/patches/*.sql 2> /dev/null | awk -F/ '{ print $NF }' | awk -F- '{ print $1, $0 }' | sort -k1 -n | awk '{ printf("db/patches/%s\n",$2) ; }'`
+ sqlfiles=`ls -1 db/mysql/patches/*.sql 2> /dev/null | awk -F/ '{ print $NF }' | awk -F- '{ print $1, $0 }' | sort -k1 -n | awk '{ printf("db/mysql/patches/%s\n",$2) ; }'`
for sql in ${sqlfiles}
do
if [ -f ${sql} ]
@@ -685,20 +694,10 @@ import_db(){
}
copy_db_connector(){
- if [ "${DB_FLAVOR}" == "MYSQL" ]
- then
- log "[I] Copying MYSQL Connector to $app_home/WEB-INF/lib ";
- cp -f $SQL_CONNECTOR_JAR $app_home/WEB-INF/classes/lib
- check_ret_status $? "Copying MYSQL Connector to $app_home/WEB-INF/lib failed"
- log "[I] Copying MYSQL Connector to $app_home/WEB-INF/lib DONE";
- fi
- if [ "${DB_FLAVOR}" == "ORACLE" ]
- then
- log "[I] Copying ORACLE Connector to $app_home/WEB-INF/lib ";
- cp -f $SQL_CONNECTOR_JAR $app_home/WEB-INF/classes/lib
- check_ret_status $? "Copying ORACLE Connector to $app_home/WEB-INF/lib failed"
- log "[I] Copying ORACLE Connector to $app_home/WEB-INF/lib DONE";
- fi
+ log "[I] Copying ${DB_FLAVOR} Connector to $app_home/WEB-INF/lib ";
+ cp -f $SQL_CONNECTOR_JAR $app_home/WEB-INF/lib
+ check_ret_status $? "Copying ${DB_FLAVOR} Connector to $app_home/WEB-INF/lib failed"
+ log "[I] Copying ${DB_FLAVOR} Connector to $app_home/WEB-INF/lib DONE";
}
update_properties() {
@@ -1241,7 +1240,7 @@ execute_java_patches(){
then
dt=`date '+%s'`
tempFile=/tmp/sql_${dt}_$$.sql
- mysqlexec="${SQL_COMMAND_INVOKER} -u ${db_root_user} --password="${db_root_password}" -h ${DB_HOST} ${db_name}"
+ #mysqlexec="${SQL_COMMAND_INVOKER} -u ${db_root_user} --password="${db_root_password}" -h ${DB_HOST} ${db_name}"
javaFiles=`ls -1 $app_home/WEB-INF/classes/org/apache/ranger/patch/Patch*.class 2> /dev/null | awk -F/ '{ print $NF }' | awk -F_J '{ print $2, $0 }' | sort -k1 -n | awk '{ printf("%s\n",$2) ; }'`
for javaPatch in ${javaFiles}
do
@@ -1250,9 +1249,11 @@ execute_java_patches(){
version=`echo ${className} | awk -F'_' '{ print $2 }'`
if [ "${version}" != "" ]
then
- c=`${mysqlexec} -B --skip-column-names -e "select count(id) from x_db_version_h where version = '${version}' and active = 'Y'"`
+ #c=`${mysqlexec} -B --skip-column-names -e "select count(id) from x_db_version_h where version = '${version}' and active = 'Y'"`
+ c=`$JAVA_HOME/bin/java -cp $SQL_CONNECTOR_JAR:jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://$DB_HOST/$db_name -u ${db_user} -p "${db_password}" -noheader -trim -delimiter '' -c \; -query "select version from x_db_version_h where version = '${version}' and active = 'Y';"`
check_ret_status $? "DBVerionCheck - ${version} Failed."
- if [ ${c} -eq 0 ]
+ #if [ ${c} -eq 0 ]
+ if [ "${c}" != "${version}" ]
then
log "[I] patch ${javaPatch} is being applied..";
msg=`$JAVA_HOME/bin/java -cp "$app_home/WEB-INF/classes/conf:$app_home/WEB-INF/classes/lib/*:$app_home/WEB-INF/:$app_home/META-INF/:$app_home/WEB-INF/lib/*:$app_home/WEB-INF/classes/:$app_home/WEB-INF/classes/META-INF/" org.apache.ranger.patch.${className}`
@@ -1260,7 +1261,8 @@ execute_java_patches(){
touch ${tempFile}
echo >> ${tempFile}
echo "insert into x_db_version_h (version, inst_at, inst_by, updated_at, updated_by) values ( '${version}', now(), user(), now(), user()) ;" >> ${tempFile}
- ${mysqlexec} < ${tempFile}
+ #${mysqlexec} < ${tempFile}
+ c=`$JAVA_HOME/bin/java -cp $SQL_CONNECTOR_JAR:jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://$DB_HOST/$db_name -u ${db_user} -p "${db_password}" -noheader -trim -delimiter '' -c \; -input ${tempFile}`
check_ret_status $? "Update patch - ${javaPatch} has failed."
rm -f ${tempFile}
log "[I] patch ${javaPatch} has been applied!!";
@@ -1283,7 +1285,8 @@ execute_java_patches(){
version=`echo ${className} | awk -F'_' '{ print $2 }'`
if [ "${version}" != "" ]
then
- result2=`${SQL_COMMAND_INVOKER} -L -S "${db_user}"/"\"${db_password}\""@"${DB_HOST}" <<< "select version from x_db_version_h where version = '${version}' and active = 'Y';"`
+ #result2=`${SQL_COMMAND_INVOKER} -L -S "${db_user}"/"\"${db_password}\""@"${DB_HOST}" <<< "select version from x_db_version_h where version = '${version}' and active = 'Y';"`
+ result2=`$JAVA_HOME/bin/java -cp $SQL_CONNECTOR_JAR:jisql/lib/* org.apache.util.sql.Jisql -driver oraclethin -cstring jdbc:oracle:thin:@$DB_HOST -u ${db_user} -p "${db_password}" -noheader -trim -delimiter '' -c \; -query "select version from x_db_version_h where version = '${version}' and active = 'Y';"`
#does not contains record so insert
if test "${result2#*$version}" == "$result2"
then
@@ -1293,7 +1296,8 @@ execute_java_patches(){
touch ${tempFile}
echo >> ${tempFile}
echo "insert into x_db_version_h (id,version, inst_at, inst_by, updated_at, updated_by) values ( X_DB_VERSION_H_SEQ.nextval,'${version}', sysdate, '${db_user}', sysdate, '${db_user}') ;" >> ${tempFile}
- result3=`echo "exit"|${SQL_COMMAND_INVOKER} -L -S "${db_user}"/"\"${db_password}\""@"${DB_HOST}" @$tempFile`
+ #result3=`echo "exit"|${SQL_COMMAND_INVOKER} -L -S "${db_user}"/"\"${db_password}\""@"${DB_HOST}" @$tempFile`
+ result3=`$JAVA_HOME/bin/java -cp $SQL_CONNECTOR_JAR:jisql/lib/* org.apache.util.sql.Jisql -driver oraclethin -cstring jdbc:oracle:thin:@$DB_HOST -u ${db_user} -p "${db_password}" -noheader -trim -delimiter '' -c \; -input ${tempFile}`
if test "${result3#*$strError}" == "$result3"
then
log "[I] patch ${javaPatch} has been applied!!";
@@ -1320,17 +1324,19 @@ log "[I] hostname=`hostname`"
init_variables
get_distro
check_java_version
-check_db_version
+#check_db_version
check_db_connector
setup_unix_user_group
setup_install_files
sanity_check_files
-check_db_admin_password
-create_db_user
+#check_db_admin_password
+#create_db_user
copy_db_connector
-import_db
-upgrade_db
-create_audit_db_user
+#import_db
+#upgrade_db
+#create_audit_db_user
+check_python_command
+$PYTHON_COMMAND_INVOKER db_setup.py
update_properties
do_authentication_setup
execute_java_patches
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java b/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java
index f2522f3..a4532f5 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java
@@ -34,8 +34,8 @@ public class XXEnumElementDef extends XXDBBase implements java.io.Serializable {
*
*/
@Id
- @SequenceGenerator(name = "x_enum_def_element_SEQ", sequenceName = "x_enum_def_element_SEQ", allocationSize = 1)
- @GeneratedValue(strategy = GenerationType.AUTO, generator = "x_enum_def_element_SEQ")
+ @SequenceGenerator(name = "x_enum_element_def_SEQ", sequenceName = "x_enum_element_def_SEQ", allocationSize = 1)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "x_enum_element_def_SEQ")
@Column(name = "id")
protected Long id;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java b/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java
index 7d5df92..9b8a71e 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java
@@ -72,7 +72,7 @@ public class XXResourceDef extends XXDBBase implements java.io.Serializable {
* </ul>
*
*/
- @Column(name = "level")
+ @Column(name = "res_level")
protected Integer level;
/**
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/src/main/assembly/admin-web.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/admin-web.xml b/src/main/assembly/admin-web.xml
index 8696252..c252e1f 100644
--- a/src/main/assembly/admin-web.xml
+++ b/src/main/assembly/admin-web.xml
@@ -169,6 +169,7 @@
<include>setup.sh</include>
<include>setup_authentication.sh</include>
<include>set_globals.sh</include>
+ <include>db_setup.py</include>
</includes>
<fileMode>544</fileMode>
</fileSet>
[3/5] incubator-ranger git commit: RANGER-239: Support JDBC based SQL
invocation for setup process
Posted by ve...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/xa_db.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/xa_db.sql b/security-admin/db/mysql/xa_db.sql
new file mode 100644
index 0000000..4b2919f
--- /dev/null
+++ b/security-admin/db/mysql/xa_db.sql
@@ -0,0 +1,778 @@
+-- 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.
+
+-- MySQL dump 10.13 Distrib 5.1.50, for apple-darwin10.3.0 (i386)
+--
+-- Host: localhost Database: xa_db
+-- ------------------------------------------------------
+-- Server version 5.1.50
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Current Database: `xa_db`
+--
+
+/*!40000 DROP DATABASE IF EXISTS `xa_db`*/;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `xa_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `xa_db`;
+
+--
+-- Temporary table structure for view `vx_trx_log`
+--
+
+DROP TABLE IF EXISTS `vx_trx_log`;
+/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `vx_trx_log` (
+ `id` bigint(20),
+ `create_time` datetime,
+ `update_time` datetime,
+ `added_by_id` bigint(20),
+ `upd_by_id` bigint(20),
+ `class_type` int(11),
+ `object_id` bigint(20),
+ `parent_object_id` bigint(20),
+ `parent_object_class_type` int(11),
+ `attr_name` varchar(255),
+ `parent_object_name` varchar(1024),
+ `object_name` varchar(1024),
+ `prev_val` varchar(1024),
+ `new_val` varchar(1024),
+ `trx_id` varchar(1024),
+ `action` varchar(255),
+ `sess_id` varchar(512),
+ `req_id` varchar(30),
+ `sess_type` varchar(30)
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `x_asset`
+--
+
+DROP TABLE IF EXISTS `x_asset`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_asset` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `asset_name` varchar(1024) NOT NULL,
+ `descr` varchar(4000) NOT NULL,
+ `act_status` int(11) NOT NULL DEFAULT '0',
+ `asset_type` int(11) NOT NULL DEFAULT '0',
+ `config` text,
+ `sup_native` tinyint(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `x_asset_FK_added_by_id` (`added_by_id`),
+ KEY `x_asset_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_asset_cr_time` (`create_time`),
+ KEY `x_asset_up_time` (`update_time`),
+ CONSTRAINT `x_asset_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_asset_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_asset`
+--
+
+LOCK TABLES `x_asset` WRITE;
+/*!40000 ALTER TABLE `x_asset` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_asset` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_audit_map`
+--
+
+DROP TABLE IF EXISTS `x_audit_map`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_audit_map` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `res_id` bigint(20) DEFAULT NULL,
+ `group_id` bigint(20) DEFAULT NULL,
+ `user_id` bigint(20) DEFAULT NULL,
+ `audit_type` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `x_audit_map_FK_added_by_id` (`added_by_id`),
+ KEY `x_audit_map_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_audit_map_FK_res_id` (`res_id`),
+ KEY `x_audit_map_FK_group_id` (`group_id`),
+ KEY `x_audit_map_FK_user_id` (`user_id`),
+ KEY `x_audit_map_cr_time` (`create_time`),
+ KEY `x_audit_map_up_time` (`update_time`),
+ CONSTRAINT `x_audit_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_audit_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_audit_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`),
+ CONSTRAINT `x_audit_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_audit_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_audit_map`
+--
+
+LOCK TABLES `x_audit_map` WRITE;
+/*!40000 ALTER TABLE `x_audit_map` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_audit_map` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_auth_sess`
+--
+
+DROP TABLE IF EXISTS `x_auth_sess`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_auth_sess` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `login_id` varchar(767) NOT NULL,
+ `user_id` bigint(20) DEFAULT NULL,
+ `ext_sess_id` varchar(512) DEFAULT NULL,
+ `auth_time` datetime NOT NULL,
+ `auth_status` int(11) NOT NULL DEFAULT '0',
+ `auth_type` int(11) NOT NULL DEFAULT '0',
+ `auth_provider` int(11) NOT NULL DEFAULT '0',
+ `device_type` int(11) NOT NULL DEFAULT '0',
+ `req_ip` varchar(48) NOT NULL,
+ `req_ua` varchar(1024) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_auth_sess_FK_added_by_id` (`added_by_id`),
+ KEY `x_auth_sess_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_auth_sess_FK_user_id` (`user_id`),
+ KEY `x_auth_sess_cr_time` (`create_time`),
+ KEY `x_auth_sess_up_time` (`update_time`),
+ CONSTRAINT `x_auth_sess_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_auth_sess_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_auth_sess_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_auth_sess`
+--
+
+LOCK TABLES `x_auth_sess` WRITE;
+/*!40000 ALTER TABLE `x_auth_sess` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_auth_sess` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_cred_store`
+--
+
+DROP TABLE IF EXISTS `x_cred_store`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_cred_store` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `store_name` varchar(1024) NOT NULL,
+ `descr` varchar(4000) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_cred_store_FK_added_by_id` (`added_by_id`),
+ KEY `x_cred_store_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_cred_store_cr_time` (`create_time`),
+ KEY `x_cred_store_up_time` (`update_time`),
+ CONSTRAINT `x_cred_store_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_cred_store_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_cred_store`
+--
+
+LOCK TABLES `x_cred_store` WRITE;
+/*!40000 ALTER TABLE `x_cred_store` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_cred_store` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_db_base`
+--
+
+DROP TABLE IF EXISTS `x_db_base`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_db_base` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_db_base_FK_added_by_id` (`added_by_id`),
+ KEY `x_db_base_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_db_base_cr_time` (`create_time`),
+ KEY `x_db_base_up_time` (`update_time`),
+ CONSTRAINT `x_db_base_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_db_base_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_db_base`
+--
+
+LOCK TABLES `x_db_base` WRITE;
+/*!40000 ALTER TABLE `x_db_base` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_db_base` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_group`
+--
+
+DROP TABLE IF EXISTS `x_group`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_group` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `group_name` varchar(1024) NOT NULL,
+ `descr` varchar(4000) NOT NULL,
+ `status` int(11) NOT NULL DEFAULT '0',
+ `group_type` int(11) NOT NULL DEFAULT '0',
+ `group_src` int(11) NOT NULL DEFAULT '0',
+ `cred_store_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_group_FK_added_by_id` (`added_by_id`),
+ KEY `x_group_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_group_FK_cred_store_id` (`cred_store_id`),
+ KEY `x_group_cr_time` (`create_time`),
+ KEY `x_group_up_time` (`update_time`),
+ CONSTRAINT `x_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_group_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`),
+ CONSTRAINT `x_group_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_group`
+--
+
+LOCK TABLES `x_group` WRITE;
+/*!40000 ALTER TABLE `x_group` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_group` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_group_groups`
+--
+
+DROP TABLE IF EXISTS `x_group_groups`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_group_groups` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `group_name` varchar(1024) NOT NULL,
+ `p_group_id` bigint(20) DEFAULT NULL,
+ `group_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_group_groups_FK_added_by_id` (`added_by_id`),
+ KEY `x_group_groups_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_group_groups_FK_p_group_id` (`p_group_id`),
+ KEY `x_group_groups_FK_group_id` (`group_id`),
+ KEY `x_group_groups_cr_time` (`create_time`),
+ KEY `x_group_groups_up_time` (`update_time`),
+ CONSTRAINT `x_group_groups_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_group_groups_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_group_groups_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_group_groups_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_group_groups`
+--
+
+LOCK TABLES `x_group_groups` WRITE;
+/*!40000 ALTER TABLE `x_group_groups` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_group_groups` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_group_users`
+--
+
+DROP TABLE IF EXISTS `x_group_users`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_group_users` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `group_name` varchar(1024) NOT NULL,
+ `p_group_id` bigint(20) DEFAULT NULL,
+ `user_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_group_users_FK_added_by_id` (`added_by_id`),
+ KEY `x_group_users_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_group_users_FK_p_group_id` (`p_group_id`),
+ KEY `x_group_users_FK_user_id` (`user_id`),
+ KEY `x_group_users_cr_time` (`create_time`),
+ KEY `x_group_users_up_time` (`update_time`),
+ CONSTRAINT `x_group_users_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_group_users_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_group_users_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_group_users_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_group_users`
+--
+
+LOCK TABLES `x_group_users` WRITE;
+/*!40000 ALTER TABLE `x_group_users` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_group_users` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_perm_map`
+--
+
+DROP TABLE IF EXISTS `x_perm_map`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_perm_map` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `perm_group` varchar(1024) DEFAULT NULL,
+ `res_id` bigint(20) DEFAULT NULL,
+ `group_id` bigint(20) DEFAULT NULL,
+ `user_id` bigint(20) DEFAULT NULL,
+ `perm_for` int(11) NOT NULL DEFAULT '0',
+ `perm_type` int(11) NOT NULL DEFAULT '0',
+ `is_recursive` int(11) NOT NULL DEFAULT '0',
+ `is_wild_card` tinyint(1) NOT NULL DEFAULT '1',
+ `grant_revoke` tinyint(1) NOT NULL DEFAULT '1',
+ `ip_address` text,
+ PRIMARY KEY (`id`),
+ KEY `x_perm_map_FK_added_by_id` (`added_by_id`),
+ KEY `x_perm_map_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_perm_map_FK_res_id` (`res_id`),
+ KEY `x_perm_map_FK_group_id` (`group_id`),
+ KEY `x_perm_map_FK_user_id` (`user_id`),
+ KEY `x_perm_map_cr_time` (`create_time`),
+ KEY `x_perm_map_up_time` (`update_time`),
+ CONSTRAINT `x_perm_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_perm_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_perm_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`),
+ CONSTRAINT `x_perm_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_perm_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_perm_map`
+--
+
+LOCK TABLES `x_perm_map` WRITE;
+/*!40000 ALTER TABLE `x_perm_map` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_perm_map` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_policy_export_audit`
+--
+
+DROP TABLE IF EXISTS `x_policy_export_audit`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_policy_export_audit` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `client_ip` varchar(255) NOT NULL,
+ `agent_id` varchar(255) DEFAULT NULL,
+ `req_epoch` bigint(20) NOT NULL,
+ `last_updated` datetime DEFAULT NULL,
+ `repository_name` varchar(1024) DEFAULT NULL,
+ `exported_json` text,
+ `http_ret_code` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `x_policy_export_audit_FK_added_by_id` (`added_by_id`),
+ KEY `x_policy_export_audit_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_policy_export_audit_cr_time` (`create_time`),
+ KEY `x_policy_export_audit_up_time` (`update_time`),
+ CONSTRAINT `x_policy_export_audit_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_policy_export_audit_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_policy_export_audit`
+--
+
+LOCK TABLES `x_policy_export_audit` WRITE;
+/*!40000 ALTER TABLE `x_policy_export_audit` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_policy_export_audit` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_portal_user`
+--
+
+DROP TABLE IF EXISTS `x_portal_user`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_portal_user` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `first_name` varchar(1022) DEFAULT NULL,
+ `last_name` varchar(1022) DEFAULT NULL,
+ `pub_scr_name` varchar(2048) DEFAULT NULL,
+ `login_id` varchar(767) DEFAULT NULL,
+ `password` varchar(512) NOT NULL,
+ `email` varchar(512) DEFAULT NULL,
+ `status` int(11) NOT NULL DEFAULT '0',
+ `user_src` int(11) NOT NULL DEFAULT '0',
+ `notes` varchar(4000) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `x_portal_user_UK_login_id` (`login_id`),
+ UNIQUE KEY `x_portal_user_UK_email` (`email`),
+ KEY `x_portal_user_FK_added_by_id` (`added_by_id`),
+ KEY `x_portal_user_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_portal_user_cr_time` (`create_time`),
+ KEY `x_portal_user_up_time` (`update_time`),
+ KEY `x_portal_user_name` (`first_name`(767)),
+ KEY `x_portal_user_email` (`email`),
+ CONSTRAINT `x_portal_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_portal_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_portal_user`
+--
+
+LOCK TABLES `x_portal_user` WRITE;
+/*!40000 ALTER TABLE `x_portal_user` DISABLE KEYS */;
+INSERT INTO `x_portal_user` VALUES (1,'2014-05-25 00:07:26','2014-05-25 00:07:26',NULL,NULL,'Admin','','Admin','admin','ceb4f32325eda6142bd65215f4c0f371','',1,0,NULL);
+/*!40000 ALTER TABLE `x_portal_user` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_portal_user_role`
+--
+
+DROP TABLE IF EXISTS `x_portal_user_role`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_portal_user_role` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `user_id` bigint(20) NOT NULL,
+ `user_role` varchar(128) DEFAULT NULL,
+ `status` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `x_portal_user_role_FK_added_by_id` (`added_by_id`),
+ KEY `x_portal_user_role_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_portal_user_role_FK_user_id` (`user_id`),
+ KEY `x_portal_user_role_cr_time` (`create_time`),
+ KEY `x_portal_user_role_up_time` (`update_time`),
+ CONSTRAINT `x_portal_user_role_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_portal_user_role_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_portal_user_role_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_portal_user_role`
+--
+
+LOCK TABLES `x_portal_user_role` WRITE;
+/*!40000 ALTER TABLE `x_portal_user_role` DISABLE KEYS */;
+INSERT INTO `x_portal_user_role` VALUES (1,'2014-05-25 00:07:26','2014-05-25 00:07:26',NULL,NULL,1,'ROLE_SYS_ADMIN',1);
+/*!40000 ALTER TABLE `x_portal_user_role` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_resource`
+--
+
+DROP TABLE IF EXISTS `x_resource`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_resource` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `res_name` varchar(4000) DEFAULT NULL,
+ `policy_name` varchar(500) DEFAULT NULL,
+ `descr` varchar(4000) DEFAULT NULL,
+ `res_type` int(11) NOT NULL DEFAULT '0',
+ `asset_id` bigint(20) NOT NULL,
+ `parent_id` bigint(20) DEFAULT NULL,
+ `parent_path` varchar(4000) DEFAULT NULL,
+ `is_encrypt` int(11) NOT NULL DEFAULT '0',
+ `is_recursive` int(11) NOT NULL DEFAULT '0',
+ `res_group` varchar(1024) DEFAULT NULL,
+ `res_dbs` text,
+ `res_tables` text,
+ `res_col_fams` text,
+ `res_cols` text,
+ `res_udfs` text,
+ `res_status` int(11) NOT NULL DEFAULT '1',
+ `table_type` int(11) NOT NULL DEFAULT '0',
+ `col_type` int(11) NOT NULL DEFAULT '0',
+ `res_topologies` text,
+ `res_services` text,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `policy_name` (`policy_name`),
+ KEY `x_resource_FK_added_by_id` (`added_by_id`),
+ KEY `x_resource_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_resource_FK_asset_id` (`asset_id`),
+ KEY `x_resource_FK_parent_id` (`parent_id`),
+ KEY `x_resource_cr_time` (`create_time`),
+ KEY `x_resource_up_time` (`update_time`),
+ CONSTRAINT `x_resource_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_resource_FK_asset_id` FOREIGN KEY (`asset_id`) REFERENCES `x_asset` (`id`),
+ CONSTRAINT `x_resource_FK_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `x_resource` (`id`),
+ CONSTRAINT `x_resource_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_resource`
+--
+
+LOCK TABLES `x_resource` WRITE;
+/*!40000 ALTER TABLE `x_resource` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_resource` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_trx_log`
+--
+
+DROP TABLE IF EXISTS `x_trx_log`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_trx_log` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `class_type` int(11) NOT NULL DEFAULT '0',
+ `object_id` bigint(20) DEFAULT NULL,
+ `parent_object_id` bigint(20) DEFAULT NULL,
+ `parent_object_class_type` int(11) NOT NULL DEFAULT '0',
+ `parent_object_name` varchar(1024) DEFAULT NULL,
+ `object_name` varchar(1024) DEFAULT NULL,
+ `attr_name` varchar(255) DEFAULT NULL,
+ `prev_val` varchar(1024) DEFAULT NULL,
+ `new_val` varchar(1024) DEFAULT NULL,
+ `trx_id` varchar(1024) DEFAULT NULL,
+ `action` varchar(255) DEFAULT NULL,
+ `sess_id` varchar(512) DEFAULT NULL,
+ `req_id` varchar(30) DEFAULT NULL,
+ `sess_type` varchar(30) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_trx_log_FK_added_by_id` (`added_by_id`),
+ KEY `x_trx_log_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_trx_log_cr_time` (`create_time`),
+ KEY `x_trx_log_up_time` (`update_time`),
+ CONSTRAINT `x_trx_log_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_trx_log_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_trx_log`
+--
+
+LOCK TABLES `x_trx_log` WRITE;
+/*!40000 ALTER TABLE `x_trx_log` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_trx_log` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_user`
+--
+
+DROP TABLE IF EXISTS `x_user`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_user` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `user_name` varchar(1024) NOT NULL,
+ `descr` varchar(4000) NOT NULL,
+ `status` int(11) NOT NULL DEFAULT '0',
+ `cred_store_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_user_FK_added_by_id` (`added_by_id`),
+ KEY `x_user_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_user_FK_cred_store_id` (`cred_store_id`),
+ KEY `x_user_cr_time` (`create_time`),
+ KEY `x_user_up_time` (`update_time`),
+ CONSTRAINT `x_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_user_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`),
+ CONSTRAINT `x_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_user`
+--
+
+LOCK TABLES `x_user` WRITE;
+/*!40000 ALTER TABLE `x_user` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_user` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `xa_access_audit`
+--
+
+DROP TABLE IF EXISTS `xa_access_audit`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `xa_access_audit` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `audit_type` int(11) NOT NULL DEFAULT '0',
+ `access_result` int(11) DEFAULT '0',
+ `access_type` varchar(255) DEFAULT NULL,
+ `acl_enforcer` varchar(255) DEFAULT NULL,
+ `agent_id` varchar(255) DEFAULT NULL,
+ `client_ip` varchar(255) DEFAULT NULL,
+ `client_type` varchar(255) DEFAULT NULL,
+ `policy_id` bigint(20) DEFAULT '0',
+ `repo_name` varchar(255) DEFAULT NULL,
+ `repo_type` int(11) DEFAULT '0',
+ `result_reason` varchar(255) DEFAULT NULL,
+ `session_id` varchar(255) DEFAULT NULL,
+ `event_time` datetime DEFAULT NULL,
+ `request_user` varchar(255) DEFAULT NULL,
+ `action` varchar(2000) DEFAULT NULL,
+ `request_data` varchar(2000) DEFAULT NULL,
+ `resource_path` varchar(2000) DEFAULT NULL,
+ `resource_type` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `xa_access_audit_FK_added_by_id` (`added_by_id`),
+ KEY `xa_access_audit_FK_upd_by_id` (`upd_by_id`),
+ KEY `xa_access_audit_cr_time` (`create_time`),
+ KEY `xa_access_audit_up_time` (`update_time`),
+ CONSTRAINT `xa_access_audit_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `xa_access_audit_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `xa_access_audit`
+--
+
+LOCK TABLES `xa_access_audit` WRITE;
+/*!40000 ALTER TABLE `xa_access_audit` DISABLE KEYS */;
+/*!40000 ALTER TABLE `xa_access_audit` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Current Database: `xa_db`
+--
+
+USE `xa_db`;
+
+--
+-- Final view structure for view `vx_trx_log`
+--
+
+/*!50001 DROP TABLE IF EXISTS `vx_trx_log`*/;
+/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`xaadmin`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `vx_trx_log` AS select `x_trx_log`.`id` AS `id`,`x_trx_log`.`create_time` AS `create_time`,`x_trx_log`.`update_time` AS `update_time`,`x_trx_log`.`added_by_id` AS `added_by_id`,`x_trx_log`.`upd_by_id` AS `upd_by_id`,`x_trx_log`.`class_type` AS `class_type`,`x_trx_log`.`object_id` AS `object_id`,`x_trx_log`.`parent_object_id` AS `parent_object_id`,`x_trx_log`.`parent_object_class_type` AS `parent_object_class_type`,`x_trx_log`.`attr_name` AS `attr_name`,`x_trx_log`.`parent_object_name` AS `parent_object_name`,`x_trx_log`.`object_name` AS `object_name`,`x_trx_log`.`prev_val` AS `prev_val`,`x_trx_log`.`new_val` AS `new_val`,`x_trx_log`.`trx_id` AS `trx_id`,`x_trx_log`.`action` AS `action`,`x_trx_log`.`sess_id` AS `sess_id`,`x_trx_log`.`req_id` AS `req_id`,`x_trx_log`.`sess_type` AS `sess_type` from `x_trx_log` group by `x_trx_log`.`trx_id` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2014-05-25 0:07:27
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/xa_db_bare.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/xa_db_bare.sql b/security-admin/db/mysql/xa_db_bare.sql
new file mode 100644
index 0000000..8204f1d
--- /dev/null
+++ b/security-admin/db/mysql/xa_db_bare.sql
@@ -0,0 +1,15 @@
+-- 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.
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/oracle/patches/001-groupsource.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/patches/001-groupsource.sql b/security-admin/db/oracle/patches/001-groupsource.sql
index cda2d15..a6b0a13 100644
--- a/security-admin/db/oracle/patches/001-groupsource.sql
+++ b/security-admin/db/oracle/patches/001-groupsource.sql
@@ -25,5 +25,4 @@ BEGIN
execute immediate 'ALTER TABLE x_group ADD group_src NUMBER(10) DEFAULT 0 NOT NULL';
commit;
end if;
-end;
-/
+end;/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/oracle/patches/002-policyname.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/patches/002-policyname.sql b/security-admin/db/oracle/patches/002-policyname.sql
index be20751..4eb71ee 100644
--- a/security-admin/db/oracle/patches/002-policyname.sql
+++ b/security-admin/db/oracle/patches/002-policyname.sql
@@ -25,5 +25,4 @@ BEGIN
execute immediate 'ALTER TABLE x_resource ADD CONSTRAINT x_resource_UK_policy_name UNIQUE(policy_name)';
commit;
end if;
-end;
-/
+end;/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/oracle/patches/003-knoxrepo.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/patches/003-knoxrepo.sql b/security-admin/db/oracle/patches/003-knoxrepo.sql
index 422649c..ee0ce87 100644
--- a/security-admin/db/oracle/patches/003-knoxrepo.sql
+++ b/security-admin/db/oracle/patches/003-knoxrepo.sql
@@ -45,5 +45,4 @@ Select count(*) into v_column_exists
execute immediate 'ALTER TABLE x_perm_map ADD ip_address CLOB DEFAULT NULL NULL';
commit;
end if;
-end;
-/
+end;/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/oracle/patches/006-createdefaultpublicgroup.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/patches/006-createdefaultpublicgroup.sql b/security-admin/db/oracle/patches/006-createdefaultpublicgroup.sql
index 55c0cd5..dbdd55a 100644
--- a/security-admin/db/oracle/patches/006-createdefaultpublicgroup.sql
+++ b/security-admin/db/oracle/patches/006-createdefaultpublicgroup.sql
@@ -25,5 +25,4 @@ BEGIN
commit;
end if;
end if;
-end;
-/
+end;/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/oracle/patches/009-updated_schema.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/patches/009-updated_schema.sql b/security-admin/db/oracle/patches/009-updated_schema.sql
new file mode 100644
index 0000000..2101d03
--- /dev/null
+++ b/security-admin/db/oracle/patches/009-updated_schema.sql
@@ -0,0 +1,407 @@
+-- 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.
+/
+CREATE SEQUENCE X_SERVICE_DEF_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_SERVICE_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_POLICY_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_SERVICE_CONFIG_DEF_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_RESOURCE_DEF_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_ACCESS_TYPE_DEF_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_ACCESS_TYPE_DEF_GRANTS_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_POLICY_CONDITION_DEF_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_ENUM_DEF_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_ENUM_ELEMENT_DEF_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_SERVICE_CONFIG_MAP_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_POLICY_RESOURCE_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_POLICY_RESOURCE_MAP_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_POLICY_ITEM_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_POLICY_ITEM_ACCESS_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_POLICY_ITEM_CONDITION_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_POLICY_ITEM_USER_PERM_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_POLICY_ITEM_GROUP_PERM_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+CREATE SEQUENCE X_DATA_HIST_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
+commit;
+CREATE TABLE x_service_def (
+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,
+version NUMBER(20) DEFAULT NULL NULL,
+name VARCHAR(1024) DEFAULT NULL NULL,
+impl_class_name VARCHAR(1024) DEFAULT NULL NULL,
+label VARCHAR(1024) DEFAULT NULL NULL,
+description VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_label VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_description VARCHAR(1024) DEFAULT NULL NULL,
+is_enabled NUMBER(1) DEFAULT '1' NULL,
+PRIMARY KEY (id),
+CONSTRAINT x_service_def_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_service_def_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_service(
+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,
+version NUMBER(20) DEFAULT NULL NULL,
+type NUMBER(20) DEFAULT NULL NULL,
+name varchar(512) DEFAULT NULL NULL,
+policy_version NUMBER(20) DEFAULT NULL NULL,
+policy_update_time DATE DEFAULT NULL NULL,
+description VARCHAR(1024) DEFAULT NULL NULL,
+is_enabled NUMBER(1) DEFAULT '0' NOT NULL,
+primary key (id),
+CONSTRAINT x_service_name UNIQUE (name),
+CONSTRAINT x_service_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_service_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_service_FK_type FOREIGN KEY (type) REFERENCES x_service_def (id)
+);
+commit;
+CREATE TABLE x_policy (
+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,
+version NUMBER(20) DEFAULT NULL NULL,
+service NUMBER(20) DEFAULT NULL NULL,
+name VARCHAR(512) DEFAULT NULL NULL,
+description VARCHAR(1024) DEFAULT NULL NULL,
+is_enabled NUMBER(1) DEFAULT '0' NOT NULL,
+is_audit_enabled NUMBER(1) DEFAULT '0' NOT NULL,
+primary key (id),
+CONSTRAINT x_policy_name UNIQUE (name),
+CONSTRAINT x_policy_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_policy_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_policy_FK_service FOREIGN KEY (service) REFERENCES x_service (id)
+);
+commit;
+CREATE TABLE x_service_config_def (
+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,
+def_id NUMBER(20) NOT NULL,
+name VARCHAR(1024) DEFAULT NULL NULL,
+type VARCHAR(1024) DEFAULT NULL NULL,
+sub_type VARCHAR(1024) DEFAULT NULL NULL,
+is_mandatory NUMBER(1) DEFAULT '0' NOT NULL,
+default_value VARCHAR(1024) DEFAULT NULL NULL,
+label VARCHAR(1024) DEFAULT NULL NULL,
+description VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_label VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_decription VARCHAR(1024) DEFAULT NULL NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_service_conf_def_FK_defid FOREIGN KEY (def_id) REFERENCES x_service_def (id),
+CONSTRAINT x_service_conf_def_FK_added_by FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_service_conf_def_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_resource_def (
+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,
+def_id NUMBER(20) NOT NULL,
+name VARCHAR(1024) DEFAULT NULL NULL,
+type VARCHAR(1024) DEFAULT NULL NULL,
+res_level NUMBER(20) DEFAULT NULL NULL,
+parent NUMBER(20) DEFAULT NULL NULL,
+mandatory NUMBER(1) DEFAULT '0' NOT NULL,
+look_up_supported NUMBER(1) DEFAULT '0' NOT NULL,
+recursive_supported NUMBER(1) DEFAULT '0' NOT NULL,
+excludes_supported NUMBER(1) DEFAULT '0' NOT NULL,
+matcher VARCHAR(1024) DEFAULT NULL NULL,
+matcher_options varchar(1024) DEFAULT NULL NULL,
+label VARCHAR(1024) DEFAULT NULL NULL,
+description VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_label VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_description VARCHAR(1024) DEFAULT NULL NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_resource_def_FK_parent FOREIGN KEY (parent) REFERENCES x_resource_def (id),
+CONSTRAINT x_resource_def_FK_defid FOREIGN KEY (def_id) REFERENCES x_service_def (id),
+CONSTRAINT x_resource_def_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_resource_def_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_access_type_def (
+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,
+def_id NUMBER(20) NOT NULL,
+name VARCHAR(1024) DEFAULT NULL NULL,
+label VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_label VARCHAR(1024) DEFAULT NULL NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_access_type_def_FK_defid FOREIGN KEY (def_id) REFERENCES x_service_def (id),
+CONSTRAINT x_access_type_def_FK_added_by FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_access_type_def_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_access_type_def_grants (
+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,
+atd_id NUMBER(20) NOT NULL,
+implied_grant VARCHAR(1024) DEFAULT NULL NULL,
+primary key (id),
+CONSTRAINT x_atd_grants_FK_atdid FOREIGN KEY (atd_id) REFERENCES x_access_type_def (id),
+CONSTRAINT x_atd_grants_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_atd_grants_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_policy_condition_def (
+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,
+def_id NUMBER(20) NOT NULL,
+name VARCHAR(1024) DEFAULT NULL NULL,
+evaluator VARCHAR(1024) DEFAULT NULL NULL,
+evaluator_options VARCHAR(1024) DEFAULT NULL NULL,
+label VARCHAR(1024) DEFAULT NULL NULL,
+description VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_label VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_description VARCHAR(1024) DEFAULT NULL NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_policy_cond_def_FK_defid FOREIGN KEY (def_id) REFERENCES x_service_def (id),
+CONSTRAINT x_policy_cond_def_FK_added_by FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_policy_cond_def_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_enum_def (
+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,
+def_id NUMBER(20) NOT NULL,
+name VARCHAR(1024) DEFAULT NULL NULL,
+default_index NUMBER(20) DEFAULT NULL NULL,
+primary key (id),
+CONSTRAINT x_enum_def_FK_def_id FOREIGN KEY (def_id) REFERENCES x_service_def (id),
+CONSTRAINT x_enum_def_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_enum_def_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_enum_element_def (
+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,
+enum_def_id NUMBER(20) NOT NULL,
+name VARCHAR(1024) DEFAULT NULL NULL,
+label VARCHAR(1024) DEFAULT NULL NULL,
+rb_key_label VARCHAR(1024) DEFAULT NULL NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_enum_element_def_FK_defid FOREIGN KEY (enum_def_id) REFERENCES x_enum_def (id),
+CONSTRAINT x_enum_element_def_FK_added_by FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_enum_element_def_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_service_config_map (
+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,
+service NUMBER(20) NOT NULL,
+config_key VARCHAR(1024) DEFAULT NULL NULL,
+config_value VARCHAR(1024) DEFAULT NULL NULL,
+primary key (id),
+CONSTRAINT x_service_conf_map_FK_service FOREIGN KEY (service) REFERENCES x_service (id),
+CONSTRAINT x_service_conf_map_FK_added_by FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_service_conf_map_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_policy_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,
+res_def_id NUMBER(20) NOT NULL,
+is_excludes NUMBER(1) DEFAULT '0' NOT NULL,
+is_recursive NUMBER(1) DEFAULT '0' NOT NULL,
+primary key (id),
+CONSTRAINT x_policy_res_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
+CONSTRAINT x_policy_res_FK_res_def_id FOREIGN KEY (res_def_id) REFERENCES x_resource_def (id),
+CONSTRAINT x_policy_res_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_policy_res_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_policy_resource_map (
+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,
+resource_id NUMBER(20) NOT NULL,
+value VARCHAR(1024) DEFAULT NULL NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_policy_res_map_FK_res_id FOREIGN KEY (resource_id) REFERENCES x_policy_resource (id),
+CONSTRAINT x_policy_res_map_FK_added_by FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_policy_res_map_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_policy_item (
+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,
+delegate_admin NUMBER(1) DEFAULT '0' NOT NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_policy_item_FK_policy_id FOREIGN KEY (policy_id) REFERENCES x_policy (id),
+CONSTRAINT x_policy_item_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_policy_item_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_policy_item_access (
+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_item_id NUMBER(20) NOT NULL,
+type NUMBER(20) NOT NULL,
+is_allowed NUMBER(3) DEFAULT '0' NOT NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_plc_item_access_FK_pi_id FOREIGN KEY (policy_item_id) REFERENCES x_policy_item (id),
+CONSTRAINT x_plc_item_access_FK_atd_id FOREIGN KEY (type) REFERENCES x_access_type_def (id),
+CONSTRAINT x_plc_item_access_FK_added_by FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_plc_item_access_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_policy_item_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_item_id NUMBER(20) NOT NULL,
+type NUMBER(20) NOT NULL,
+value VARCHAR(1024) DEFAULT NULL NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_plc_item_cond_FK_pi_id FOREIGN KEY (policy_item_id) REFERENCES x_policy_item (id),
+CONSTRAINT x_plc_item_cond_FK_pcd_id FOREIGN KEY (type) REFERENCES x_policy_condition_def (id),
+CONSTRAINT x_plc_item_cond_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_plc_item_cond_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_policy_item_user_perm (
+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_item_id NUMBER(20) NOT NULL,
+user_id NUMBER(20) DEFAULT NULL NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_plc_itm_usr_perm_FK_pi_id FOREIGN KEY (policy_item_id) REFERENCES x_policy_item (id),
+CONSTRAINT x_plc_itm_usr_perm_FK_user_id FOREIGN KEY (user_id) REFERENCES x_user (id),
+CONSTRAINT x_plc_itm_usr_perm_FK_added_by FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_plc_itm_usr_perm_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_policy_item_group_perm (
+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_item_id NUMBER(20) NOT NULL,
+group_id NUMBER(20) DEFAULT NULL NULL,
+sort_order NUMBER(3) DEFAULT '0' NULL,
+primary key (id),
+CONSTRAINT x_plc_itm_grp_perm_FK_pi_id FOREIGN KEY (policy_item_id) REFERENCES x_policy_item (id),
+CONSTRAINT x_plc_itm_grp_perm_FK_group_id FOREIGN KEY (group_id) REFERENCES x_group (id),
+CONSTRAINT x_plc_itm_grp_perm_FK_added_by FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id),
+CONSTRAINT x_plc_itm_grp_perm_FK_upd_by FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id)
+);
+commit;
+CREATE TABLE x_data_hist (
+id NUMBER(20) NOT NULL,
+create_time DATE DEFAULT NULL NULL,
+update_time DATE DEFAULT NULL NULL,
+obj_guid VARCHAR(1024) NOT NULL,
+obj_class_type NUMBER(11) NOT NULL,
+obj_id NUMBER(20) NOT NULL,
+obj_name VARCHAR(1024) NOT NULL,
+version NUMBER(20) DEFAULT NULL NULL,
+action VARCHAR(512)NOT NULL,
+from_time DATE NOT NULL,
+to_time DATE DEFAULT NULL NULL,
+content CLOB NOT NULL,
+primary key (id)
+);
+commit;
+CREATE INDEX x_service_def_added_by_id ON x_service_def(added_by_id);
+CREATE INDEX x_service_def_upd_by_id ON x_service_def(upd_by_id);
+CREATE INDEX x_service_def_cr_time ON x_service_def(create_time);
+CREATE INDEX x_service_def_up_time ON x_service_def(update_time);
+CREATE INDEX x_service_added_by_id ON x_service(added_by_id);
+CREATE INDEX x_service_upd_by_id ON x_service(upd_by_id);
+CREATE INDEX x_service_cr_time ON x_service(create_time);
+CREATE INDEX x_service_up_time ON x_service(update_time);
+CREATE INDEX x_service_type ON x_service(type);
+CREATE INDEX x_policy_added_by_id ON x_policy(added_by_id);
+CREATE INDEX x_policy_upd_by_id ON x_policy(upd_by_id);
+CREATE INDEX x_policy_cr_time ON x_policy(create_time);
+CREATE INDEX x_policy_up_time ON x_policy(update_time);
+CREATE INDEX x_policy_service ON x_policy(service);
+CREATE INDEX x_resource_def_parent ON x_resource_def(parent);
+commit;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/oracle/reset_audit_db_oracle.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/reset_audit_db_oracle.sql b/security-admin/db/oracle/reset_audit_db_oracle.sql
new file mode 100644
index 0000000..8ec832b
--- /dev/null
+++ b/security-admin/db/oracle/reset_audit_db_oracle.sql
@@ -0,0 +1,71 @@
+-- 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.
+
+CREATE OR REPLACE PROCEDURE sp_dropobject(ObjName IN varchar2,ObjType IN varchar2)
+IS
+v_counter integer;
+BEGIN
+if (ObjType = 'TABLE') then
+ select count(*) into v_counter from user_tables where table_name = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'drop table ' || ObjName || ' cascade constraints';
+ end if;
+end if;
+ if (ObjType = 'PROCEDURE') then
+ select count(*) into v_counter from User_Objects where object_type = 'PROCEDURE' and OBJECT_NAME = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP PROCEDURE ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'FUNCTION') then
+ select count(*) into v_counter from User_Objects where object_type = 'FUNCTION' and OBJECT_NAME = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP FUNCTION ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'TRIGGER') then
+ select count(*) into v_counter from User_Triggers where TRIGGER_NAME = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP TRIGGER ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'VIEW') then
+ select count(*) into v_counter from User_Views where VIEW_NAME = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP VIEW ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'SEQUENCE') then
+ select count(*) into v_counter from user_sequences where sequence_name = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP SEQUENCE ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'INDEX') then
+ select count(*) into v_counter from user_indexes where index_name = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP INDEX ' || ObjName;
+ end if;
+ end if;
+END;
+/
+call sp_dropobject('XA_ACCESS_AUDIT','TABLE');
+call sp_dropobject('XA_ACCESS_AUDIT_SEQ','SEQUENCE');
+call sp_dropobject('xa_access_audit_added_by_id','INDEX');
+call sp_dropobject('xa_access_audit_upd_by_id','INDEX');
+call sp_dropobject('xa_access_audit_cr_time','INDEX');
+call sp_dropobject('xa_access_audit_up_time','INDEX');
+call sp_dropobject('xa_access_audit_event_time','INDEX');
+commit;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/oracle/reset_core_db_oracle.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/reset_core_db_oracle.sql b/security-admin/db/oracle/reset_core_db_oracle.sql
new file mode 100644
index 0000000..ce94027
--- /dev/null
+++ b/security-admin/db/oracle/reset_core_db_oracle.sql
@@ -0,0 +1,114 @@
+-- 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.
+
+-- create or replace procedure
+commit;
+CREATE OR REPLACE PROCEDURE sp_dropobject(ObjName IN varchar2,ObjType IN varchar2)
+IS
+v_counter integer;
+BEGIN
+if (ObjType = 'TABLE') then
+ select count(*) into v_counter from user_tables where table_name = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'drop table ' || ObjName || ' cascade constraints';
+ end if;
+end if;
+ if (ObjType = 'PROCEDURE') then
+ select count(*) into v_counter from User_Objects where object_type = 'PROCEDURE' and OBJECT_NAME = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP PROCEDURE ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'FUNCTION') then
+ select count(*) into v_counter from User_Objects where object_type = 'FUNCTION' and OBJECT_NAME = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP FUNCTION ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'TRIGGER') then
+ select count(*) into v_counter from User_Triggers where TRIGGER_NAME = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP TRIGGER ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'VIEW') then
+ select count(*) into v_counter from User_Views where VIEW_NAME = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP VIEW ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'SEQUENCE') then
+ select count(*) into v_counter from user_sequences where sequence_name = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP SEQUENCE ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'INDEX') then
+ select count(*) into v_counter from user_indexes where index_name = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP INDEX ' || ObjName;
+ end if;
+ end if;
+ if (ObjType = 'CONSTRAINT') then
+ select count(*) into v_counter from user_constraints where constraint_name = upper(ObjName);
+ if (v_counter > 0) then
+ execute immediate 'DROP CONSTRAINT ' || ObjName;
+ end if;
+ end if;
+END;
+/
+-- sequence
+call sp_dropobject('SEQ_GEN_IDENTITY','SEQUENCE');
+call sp_dropobject('X_ACCESS_AUDIT_SEQ','SEQUENCE');
+call sp_dropobject('X_ASSET_SEQ','SEQUENCE');
+call sp_dropobject('X_AUDIT_MAP_SEQ','SEQUENCE');
+call sp_dropobject('X_AUTH_SESS_SEQ','SEQUENCE');
+call sp_dropobject('X_CRED_STORE_SEQ','SEQUENCE');
+call sp_dropobject('X_DB_BASE_SEQ','SEQUENCE');
+call sp_dropobject('X_GROUP_SEQ','SEQUENCE');
+call sp_dropobject('X_GROUP_GROUPS_SEQ','SEQUENCE');
+call sp_dropobject('X_GROUP_USERS_SEQ','SEQUENCE');
+call sp_dropobject('X_PERM_MAP_SEQ','SEQUENCE');
+call sp_dropobject('X_POLICY_EXPORT_SEQ','SEQUENCE');
+call sp_dropobject('X_PORTAL_USER_SEQ','SEQUENCE');
+call sp_dropobject('X_PORTAL_USER_ROLE_SEQ','SEQUENCE');
+call sp_dropobject('X_RESOURCE_SEQ','SEQUENCE');
+call sp_dropobject('X_TRX_LOG_SEQ','SEQUENCE');
+call sp_dropobject('X_USER_SEQ','SEQUENCE');
+call sp_dropobject('X_DB_VERSION_H_SEQ','SEQUENCE');
+call sp_dropobject('V_TRX_LOG_SEQ','SEQUENCE');
+call sp_dropobject('XA_ACCESS_AUDIT_SEQ','SEQUENCE');
+commit;
+
+-- drop table
+call sp_dropobject('vx_trx_log','VIEW');
+call sp_dropobject('x_perm_map','TABLE');
+call sp_dropobject('x_audit_map','TABLE');
+call sp_dropobject('x_trx_log','TABLE');
+call sp_dropobject('x_resource','TABLE');
+call sp_dropobject('x_policy_export_audit','TABLE');
+call sp_dropobject('x_group_users','TABLE');
+call sp_dropobject('x_user','TABLE');
+call sp_dropobject('x_group_groups','TABLE');
+call sp_dropobject('X_GROUP','TABLE');
+call sp_dropobject('x_db_base','TABLE');
+call sp_dropobject('x_cred_store','TABLE');
+call sp_dropobject('x_auth_sess','TABLE');
+call sp_dropobject('x_asset','TABLE');
+call sp_dropobject('xa_access_audit','TABLE');
+call sp_dropobject('x_portal_user_role','TABLE');
+call sp_dropobject('x_portal_user','TABLE');
+
+commit;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/oracle/xa_audit_db_oracle.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/xa_audit_db_oracle.sql b/security-admin/db/oracle/xa_audit_db_oracle.sql
index 4e1a184..3092055 100644
--- a/security-admin/db/oracle/xa_audit_db_oracle.sql
+++ b/security-admin/db/oracle/xa_audit_db_oracle.sql
@@ -13,61 +13,7 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE OR REPLACE PROCEDURE sp_dropobject(ObjName IN varchar2,ObjType IN varchar2)
-IS
-v_counter integer;
-BEGIN
-if (ObjType = 'TABLE') then
- select count(*) into v_counter from user_tables where table_name = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'drop table ' || ObjName || ' cascade constraints';
- end if;
-end if;
- if (ObjType = 'PROCEDURE') then
- select count(*) into v_counter from User_Objects where object_type = 'PROCEDURE' and OBJECT_NAME = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP PROCEDURE ' || ObjName;
- end if;
- end if;
- if (ObjType = 'FUNCTION') then
- select count(*) into v_counter from User_Objects where object_type = 'FUNCTION' and OBJECT_NAME = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP FUNCTION ' || ObjName;
- end if;
- end if;
- if (ObjType = 'TRIGGER') then
- select count(*) into v_counter from User_Triggers where TRIGGER_NAME = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP TRIGGER ' || ObjName;
- end if;
- end if;
- if (ObjType = 'VIEW') then
- select count(*) into v_counter from User_Views where VIEW_NAME = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP VIEW ' || ObjName;
- end if;
- end if;
- if (ObjType = 'SEQUENCE') then
- select count(*) into v_counter from user_sequences where sequence_name = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP SEQUENCE ' || ObjName;
- end if;
- end if;
- if (ObjType = 'INDEX') then
- select count(*) into v_counter from user_indexes where index_name = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP INDEX ' || ObjName;
- end if;
- end if;
-END;
-/
-call sp_dropobject('XA_ACCESS_AUDIT','TABLE');
-call sp_dropobject('XA_ACCESS_AUDIT_SEQ','SEQUENCE');
-call sp_dropobject('xa_access_audit_added_by_id','INDEX');
-call sp_dropobject('xa_access_audit_upd_by_id','INDEX');
-call sp_dropobject('xa_access_audit_cr_time','INDEX');
-call sp_dropobject('xa_access_audit_up_time','INDEX');
-call sp_dropobject('xa_access_audit_event_time','INDEX');
+
CREATE SEQUENCE XA_ACCESS_AUDIT_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
CREATE TABLE xa_access_audit (
id NUMBER(20) NOT NULL,
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/oracle/xa_core_db_oracle.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/xa_core_db_oracle.sql b/security-admin/db/oracle/xa_core_db_oracle.sql
index 449c461..9cc22ff 100644
--- a/security-admin/db/oracle/xa_core_db_oracle.sql
+++ b/security-admin/db/oracle/xa_core_db_oracle.sql
@@ -13,106 +13,7 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
-/* create or replace procedure */
-commit;
-CREATE OR REPLACE PROCEDURE sp_dropobject(ObjName IN varchar2,ObjType IN varchar2)
-IS
-v_counter integer;
-BEGIN
-if (ObjType = 'TABLE') then
- select count(*) into v_counter from user_tables where table_name = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'drop table ' || ObjName || ' cascade constraints';
- end if;
-end if;
- if (ObjType = 'PROCEDURE') then
- select count(*) into v_counter from User_Objects where object_type = 'PROCEDURE' and OBJECT_NAME = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP PROCEDURE ' || ObjName;
- end if;
- end if;
- if (ObjType = 'FUNCTION') then
- select count(*) into v_counter from User_Objects where object_type = 'FUNCTION' and OBJECT_NAME = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP FUNCTION ' || ObjName;
- end if;
- end if;
- if (ObjType = 'TRIGGER') then
- select count(*) into v_counter from User_Triggers where TRIGGER_NAME = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP TRIGGER ' || ObjName;
- end if;
- end if;
- if (ObjType = 'VIEW') then
- select count(*) into v_counter from User_Views where VIEW_NAME = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP VIEW ' || ObjName;
- end if;
- end if;
- if (ObjType = 'SEQUENCE') then
- select count(*) into v_counter from user_sequences where sequence_name = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP SEQUENCE ' || ObjName;
- end if;
- end if;
- if (ObjType = 'INDEX') then
- select count(*) into v_counter from user_indexes where index_name = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP INDEX ' || ObjName;
- end if;
- end if;
- if (ObjType = 'CONSTRAINT') then
- select count(*) into v_counter from user_constraints where constraint_name = upper(ObjName);
- if (v_counter > 0) then
- execute immediate 'DROP CONSTRAINT ' || ObjName;
- end if;
- end if;
-END;
-/
-/* sequence */
-call sp_dropobject('SEQ_GEN_IDENTITY','SEQUENCE');
-call sp_dropobject('X_ACCESS_AUDIT_SEQ','SEQUENCE');
-call sp_dropobject('X_ASSET_SEQ','SEQUENCE');
-call sp_dropobject('X_AUDIT_MAP_SEQ','SEQUENCE');
-call sp_dropobject('X_AUTH_SESS_SEQ','SEQUENCE');
-call sp_dropobject('X_CRED_STORE_SEQ','SEQUENCE');
-call sp_dropobject('X_DB_BASE_SEQ','SEQUENCE');
-call sp_dropobject('X_GROUP_SEQ','SEQUENCE');
-call sp_dropobject('X_GROUP_GROUPS_SEQ','SEQUENCE');
-call sp_dropobject('X_GROUP_USERS_SEQ','SEQUENCE');
-call sp_dropobject('X_PERM_MAP_SEQ','SEQUENCE');
-call sp_dropobject('X_POLICY_EXPORT_SEQ','SEQUENCE');
-call sp_dropobject('X_PORTAL_USER_SEQ','SEQUENCE');
-call sp_dropobject('X_PORTAL_USER_ROLE_SEQ','SEQUENCE');
-call sp_dropobject('X_RESOURCE_SEQ','SEQUENCE');
-call sp_dropobject('X_TRX_LOG_SEQ','SEQUENCE');
-call sp_dropobject('X_USER_SEQ','SEQUENCE');
-call sp_dropobject('X_DB_VERSION_H_SEQ','SEQUENCE');
-call sp_dropobject('V_TRX_LOG_SEQ','SEQUENCE');
-call sp_dropobject('XA_ACCESS_AUDIT_SEQ','SEQUENCE');
-commit;
-
-/* drop table */
-call sp_dropobject('vx_trx_log','VIEW');
-call sp_dropobject('x_perm_map','TABLE');
-call sp_dropobject('x_audit_map','TABLE');
-call sp_dropobject('x_trx_log','TABLE');
-call sp_dropobject('x_resource','TABLE');
-call sp_dropobject('x_policy_export_audit','TABLE');
-call sp_dropobject('x_group_users','TABLE');
-call sp_dropobject('x_user','TABLE');
-call sp_dropobject('x_group_groups','TABLE');
-call sp_dropobject('X_GROUP','TABLE');
-call sp_dropobject('x_db_base','TABLE');
-call sp_dropobject('x_cred_store','TABLE');
-call sp_dropobject('x_auth_sess','TABLE');
-call sp_dropobject('x_asset','TABLE');
-call sp_dropobject('xa_access_audit','TABLE');
-call sp_dropobject('x_portal_user_role','TABLE');
-call sp_dropobject('x_portal_user','TABLE');
-
-commit;
-/* create sequences */
+-- create sequences
CREATE SEQUENCE SEQ_GEN_IDENTITY START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
CREATE SEQUENCE X_ACCESS_AUDIT_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
CREATE SEQUENCE X_ASSET_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
@@ -136,7 +37,7 @@ CREATE SEQUENCE XA_ACCESS_AUDIT_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
commit;
-/* create tables */
+-- create tables
CREATE TABLE x_portal_user (
id NUMBER(20) NOT NULL,
create_time DATE DEFAULT NULL NULL ,
@@ -531,7 +432,7 @@ CREATE INDEX x_user_up_time ON x_user(update_time);
CREATE OR REPLACE PUBLIC SYNONYM xa_access_audit FOR xa_access_audit;
CREATE OR REPLACE PUBLIC SYNONYM XA_ACCESS_AUDIT_SEQ FOR XA_ACCESS_AUDIT_SEQ;
-
+commit;
insert into x_portal_user (
id,CREATE_TIME, UPDATE_TIME,
FIRST_NAME, LAST_NAME, PUB_SCR_NAME,
@@ -541,7 +442,7 @@ X_PORTAL_USER_SEQ.NEXTVAL, SYSDATE, SYSDATE,
'Admin', '', 'Admin',
'admin', 'ceb4f32325eda6142bd65215f4c0f371', '', 1
);
-
+commit;
insert into x_portal_user_role (
id, CREATE_TIME, UPDATE_TIME,
USER_ID, USER_ROLE, STATUS
@@ -549,32 +450,9 @@ insert into x_portal_user_role (
X_PORTAL_USER_ROLE_SEQ.NEXTVAL, SYSDATE, SYSDATE,
1, 'ROLE_SYS_ADMIN', 1
);
-
+commit;
insert into x_user (id,CREATE_TIME, UPDATE_TIME,user_name, status,descr) values (
X_USER_SEQ.NEXTVAL, SYSDATE, SYSDATE,'admin', 0,'Administrator');
-
-INSERT INTO x_group (ID,ADDED_BY_ID, CREATE_TIME, DESCR, GROUP_TYPE, GROUP_NAME, STATUS, UPDATE_TIME, UPD_BY_ID) VALUES (X_GROUP_SEQ.nextval,1, sys_extract_utc(systimestamp), 'public group', 0, 'public', 0, sys_extract_utc(systimestamp), 1);
-commit;
-
-
-
-CREATE OR REPLACE TRIGGER x_auth_sess_trigger
- BEFORE INSERT
- ON x_auth_sess
- FOR EACH ROW
- -- Optionally restrict this trigger to fire only when really needed
- WHEN (new.id is null)
-DECLARE
- v_id x_auth_sess.id%TYPE;
-BEGIN
- -- Select a new value from the sequence into a local variable. As
- -- commented, this step is optional. You can directly select into :new.qname_id
- SELECT x_auth_sess_seq.nextval INTO v_id FROM DUAL;
-
- -- :new references the record that you are about to insert into qname. Hence,
- -- you can overwrite the value of :new.qname_id (qname.qname_id) with the value
- -- obtained from your sequence, before inserting
- :new.id := v_id;
-END my_trigger;
-/
commit;
+INSERT INTO x_group (ID,ADDED_BY_ID, CREATE_TIME, DESCR, GROUP_TYPE, GROUP_NAME, STATUS, UPDATE_TIME, UPD_BY_ID) VALUES (X_GROUP_SEQ.nextval,1, sys_extract_utc(systimestamp), 'public group', 0, 'public', 0, sys_extract_utc(systimestamp), 1);
+commit;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/patches/001-groupsource.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/patches/001-groupsource.sql b/security-admin/db/patches/001-groupsource.sql
deleted file mode 100644
index c49d8cb..0000000
--- a/security-admin/db/patches/001-groupsource.sql
+++ /dev/null
@@ -1,34 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
- drop procedure if exists add_group_source_column_to_x_group_table;
-
-delimiter ;;
- create procedure add_group_source_column_to_x_group_table() begin
-
- /* add group source column if not exist */
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_group') then
- if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_group' and column_name = 'group_src') then
- ALTER TABLE `x_group` ADD `group_src` INT NOT NULL DEFAULT 0;
- end if;
- end if;
-
-end;;
-
-delimiter ;
-
- call add_group_source_column_to_x_group_table();
-
- drop procedure if exists add_group_source_column_to_x_group_table;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/patches/002-policyname.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/patches/002-policyname.sql b/security-admin/db/patches/002-policyname.sql
deleted file mode 100644
index 35927f5..0000000
--- a/security-admin/db/patches/002-policyname.sql
+++ /dev/null
@@ -1,37 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-drop procedure if exists add_policy_name_column_to_x_resource_table;
-
-delimiter ;;
-create procedure add_policy_name_column_to_x_resource_table() begin
-
- /* add policy name column if not exist */
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource') then
- if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource' and column_name = 'policy_name') then
- ALTER TABLE `x_resource` ADD `policy_name` VARCHAR( 500 ) NULL DEFAULT NULL;
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource' and column_name = 'policy_name') then
- ALTER TABLE `x_resource` ADD UNIQUE `x_resource_UK_policy_name` ( `policy_name` );
- end if;
- end if;
- end if;
-
-
-end;;
-
-delimiter ;
-call add_policy_name_column_to_x_resource_table();
-
-drop procedure if exists add_policy_name_column_to_x_resource_table;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/patches/003-knoxrepo.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/patches/003-knoxrepo.sql b/security-admin/db/patches/003-knoxrepo.sql
deleted file mode 100644
index 04c050a..0000000
--- a/security-admin/db/patches/003-knoxrepo.sql
+++ /dev/null
@@ -1,48 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-drop procedure if exists add_columns_for_knox_repository;
-
-delimiter ;;
-create procedure add_columns_for_knox_repository() begin
-
- /* add res_topologies if not exist */
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource') then
- if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource' and column_name = 'res_topologies') then
- ALTER TABLE `x_resource` ADD `res_topologies` TEXT NULL DEFAULT NULL ;
- end if;
- end if;
-
- /* add res_services if not exist */
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource') then
- if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource' and column_name = 'res_services') then
- ALTER TABLE `x_resource` ADD `res_services` TEXT NULL DEFAULT NULL;
- end if;
- end if;
-
- /* add ip_address if not exist */
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_perm_map') then
- if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_perm_map' and column_name = 'ip_address') then
- ALTER TABLE `x_perm_map` ADD `ip_address` TEXT NULL DEFAULT NULL;
- end if;
- end if;
-
-
-end;;
-
-delimiter ;
-call add_columns_for_knox_repository();
-
-drop procedure if exists add_columns_for_knox_repository;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/patches/004-assetconfigsize.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/patches/004-assetconfigsize.sql b/security-admin/db/patches/004-assetconfigsize.sql
deleted file mode 100644
index bec992b..0000000
--- a/security-admin/db/patches/004-assetconfigsize.sql
+++ /dev/null
@@ -1,31 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-drop procedure if exists change_config_column_datatype_of_x_asset_table;
-
-delimiter ;;
-create procedure change_config_column_datatype_of_x_asset_table() begin
-
- /* change config data type to longtext if not exist */
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_asset' and column_name = 'config' and data_type='text') then
- ALTER TABLE `x_asset` CHANGE `config` `config` MEDIUMTEXT NULL DEFAULT NULL ;
- end if;
-
-end;;
-
-delimiter ;
-call change_config_column_datatype_of_x_asset_table();
-
-drop procedure if exists change_config_column_datatype_of_x_asset_table;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/patches/005-xtrxlogcolumnsize.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/patches/005-xtrxlogcolumnsize.sql b/security-admin/db/patches/005-xtrxlogcolumnsize.sql
deleted file mode 100644
index 4ec9a6d..0000000
--- a/security-admin/db/patches/005-xtrxlogcolumnsize.sql
+++ /dev/null
@@ -1,34 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-drop procedure if exists change_values_columns_datatype_of_x_trx_log_table;
-
-delimiter ;;
-create procedure change_values_columns_datatype_of_x_trx_log_table() begin
-
- /* change prev_value column data type to mediumtext */
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_trx_log' and column_name = 'prev_val' and data_type='varchar') then
- ALTER TABLE `x_trx_log` CHANGE `prev_val` `prev_val` MEDIUMTEXT NULL DEFAULT NULL ;
- end if;
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_trx_log' and column_name = 'new_val' and data_type='varchar') then
- ALTER TABLE `x_trx_log` CHANGE `new_val` `new_val` MEDIUMTEXT NULL DEFAULT NULL ;
- end if;
-
-end;;
-
-delimiter ;
-call change_values_columns_datatype_of_x_trx_log_table();
-
-drop procedure if exists change_values_columns_datatype_of_x_trx_log_table;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/patches/006-createdefaultpublicgroup.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/patches/006-createdefaultpublicgroup.sql b/security-admin/db/patches/006-createdefaultpublicgroup.sql
deleted file mode 100644
index ddb211e..0000000
--- a/security-admin/db/patches/006-createdefaultpublicgroup.sql
+++ /dev/null
@@ -1,34 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-drop procedure if exists insert_public_group_in_x_group_table;
-
-delimiter ;;
-create procedure insert_public_group_in_x_group_table() begin
-
- /* check table x_group exist or not */
- if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_group') then
- /* check record for group name public exist or not */
- if not exists (select * from x_group where group_name = 'public') then
- INSERT INTO x_group (ADDED_BY_ID, CREATE_TIME, DESCR, GROUP_SRC, GROUP_TYPE, GROUP_NAME, STATUS, UPDATE_TIME, UPD_BY_ID) VALUES (1, UTC_TIMESTAMP(), 'public group', 0, 0, 'public', 0, UTC_TIMESTAMP(), 1);
- end if;
- end if;
-
-end;;
-
-delimiter ;
-call insert_public_group_in_x_group_table();
-
-drop procedure if exists insert_public_group_in_x_group_table;
[4/5] incubator-ranger git commit: RANGER-239: Support JDBC based SQL
invocation for setup process
Posted by ve...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/006-createdefaultpublicgroup.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/006-createdefaultpublicgroup.sql b/security-admin/db/mysql/patches/006-createdefaultpublicgroup.sql
new file mode 100644
index 0000000..ddb211e
--- /dev/null
+++ b/security-admin/db/mysql/patches/006-createdefaultpublicgroup.sql
@@ -0,0 +1,34 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+drop procedure if exists insert_public_group_in_x_group_table;
+
+delimiter ;;
+create procedure insert_public_group_in_x_group_table() begin
+
+ /* check table x_group exist or not */
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_group') then
+ /* check record for group name public exist or not */
+ if not exists (select * from x_group where group_name = 'public') then
+ INSERT INTO x_group (ADDED_BY_ID, CREATE_TIME, DESCR, GROUP_SRC, GROUP_TYPE, GROUP_NAME, STATUS, UPDATE_TIME, UPD_BY_ID) VALUES (1, UTC_TIMESTAMP(), 'public group', 0, 0, 'public', 0, UTC_TIMESTAMP(), 1);
+ end if;
+ end if;
+
+end;;
+
+delimiter ;
+call insert_public_group_in_x_group_table();
+
+drop procedure if exists insert_public_group_in_x_group_table;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/007-updateBlankPolicyName.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/007-updateBlankPolicyName.sql b/security-admin/db/mysql/patches/007-updateBlankPolicyName.sql
new file mode 100644
index 0000000..d251bc2
--- /dev/null
+++ b/security-admin/db/mysql/patches/007-updateBlankPolicyName.sql
@@ -0,0 +1,186 @@
+-- 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.
+
+-- --------------------------------------------------------------------------------
+-- Function which will return tempPolicyCount
+-- which is being used by SP updateBlankPolicyName()
+-- --------------------------------------------------------------------------------
+DELIMITER $$
+
+DROP FUNCTION if exists getTempPolicyCount $$
+CREATE FUNCTION `getTempPolicyCount`(assetId bigint, resId bigint) RETURNS int(11)
+BEGIN
+
+DECLARE tempPolicyCount int default 1;
+DECLARE dbResourceId bigint;
+DECLARE exitLoop int DEFAULT FALSE;
+
+DECLARE policyList CURSOR FOR
+ SELECT id from x_resource where asset_id = assetId;
+
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET exitLoop = true;
+OPEN policyList;
+readPolicy : LOOP
+ FETCH policyList into dbResourceId;
+
+ IF exitLoop THEN
+ set tempPolicyCount = tempPolicyCount + 1;
+ LEAVE readPolicy;
+ END IF;
+
+ IF (resId = dbResourceId) THEN
+ LEAVE readPolicy;
+ END IF;
+ set tempPolicyCount = tempPolicyCount + 1;
+
+END LOOP;
+CLOSE policyList;
+
+RETURN tempPolicyCount;
+END $$
+
+
+-- --------------------------------------------------------------------------------
+-- Procedure that will generate policy name of policies
+-- which were previously created without policy_name
+-- --------------------------------------------------------------------------------
+DELIMITER $$
+
+DROP PROCEDURE if exists updateBlankPolicyName $$
+CREATE PROCEDURE `updateBlankPolicyName`()
+BEGIN
+
+DECLARE done INT;
+DECLARE resId bigint;
+DECLARE assetId bigint;
+DECLARE assetName varchar(512);
+DECLARE genPolicyName varchar(1000);
+DECLARE existPolId varchar(1000);
+DECLARE policyCount bigint;
+DECLARE currentTime varchar(100);
+DECLARE tempPolicyCount int;
+DECLARE totalPolicyCount int;
+DECLARE resourceName varchar(4000);
+
+-- TrxLog fields
+DECLARE createTime datetime;
+DECLARE addedById bigint;
+DECLARE classType int;
+DECLARE objId bigint;
+DECLARE parentObjId bigint;
+DECLARE parentObjClsType int;
+DECLARE parentObjName varchar(1024);
+DECLARE objName varchar(1024);
+DECLARE attrName varchar(255);
+DECLARE prevVal varchar(1024);
+DECLARE newVal varchar(1024);
+DECLARE trxId varchar(1024);
+DECLARE act varchar(255);
+DECLARE sessType varchar(30);
+DECLARE assetTypeInt int;
+DECLARE assetType varchar(50);
+DECLARE transId varchar(50);
+
+DECLARE policyList CURSOR FOR
+ select id,asset_id, res_name from x_resource res
+ where res.policy_name is null or res.policy_name = '';
+
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
+OPEN policyList;
+
+ SET done = 0;
+
+ iLoop : LOOP
+
+ FETCH policyList into resId, assetId, resourceName;
+
+ set assetTypeInt = (select asset_type from x_asset where id = assetId);
+
+ if (assetTypeInt = 1) then
+ set assetType = 'HDFS';
+ elseif (assetTypeInt = 2) then
+ set assetType = 'HBase';
+ elseif ((assetTypeInt = 3)) then
+ set assetType = 'Hive';
+ elseif (assetTypeInt = 4) then
+ set assetType = 'XAAGENT';
+ elseif (assetTypeInt = 5) then
+ set assetType = 'Knox';
+ elseif (assetTypeInt = 6) then
+ set assetType = 'Storm';
+ end if;
+
+ set totalPolicyCount = (select count(*) from x_resource where asset_id = assetId);
+ set assetName = (select asset_name from x_asset asset where asset.id = assetId);
+
+ set tempPolicyCount = getTempPolicyCount(assetId, resId);
+ set currentTime = DATE_FORMAT(utc_timestamp(), "%Y%m%d%H%i%s");
+
+ set genPolicyName = concat(assetName, '-', tempPolicyCount, '-', currentTime);
+ set existPolId = (select id from x_resource where policy_name = genPolicyName);
+
+ if (existPolId != '') then
+ set genPolicyName = concat(assetName, '-', totalPolicyCount, '-', currentTime);
+ end if;
+
+ if(done = 1) then
+ LEAVE iLoop;
+ end if;
+
+ UPDATE x_resource set policy_name = genPolicyName where id = resId;
+
+ -- Creating Trx Log
+ set createTime = utc_timestamp();
+ set addedById = 1;
+ set classType = 1001;
+ set objId = resId;
+ set parentObjId = assetId;
+ set parentObjClsType = 1000;
+ set objName = resourceName;
+ set attrName = 'Policy Name';
+ set prevVal = null;
+ set newVal = genPolicyName;
+ set act = 'update';
+ set sessType = 'DB Script';
+ set parentObjName = assetName;
+
+ set transId = concat(DATE_FORMAT(utc_timestamp(), "%Y%m%d%H%i%s"), '_', rand());
+
+ insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
+ class_type, object_id, parent_object_id, parent_object_class_type,
+ parent_object_name, object_name, attr_name, prev_val, new_val, `action`,
+ trx_id, sess_type)
+ values(createTime, createTime, addedById, addedById, classType, objId,
+ parentObjId, parentObjClsType, parentObjName, objName, attrName, prevVal,
+ newVal, act, transId, sessType);
+
+ insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
+ class_type, object_id, parent_object_id, parent_object_class_type,
+ parent_object_name, object_name, attr_name, prev_val, new_val, `action`,
+ trx_id, sess_type)
+ values(createTime, createTime, addedById, addedById, classType, objId,
+ parentObjId, parentObjClsType, parentObjName, objName, 'Repository Type', prevVal,
+ assetType, act, transId, sessType);
+
+ END LOOP;
+
+CLOSE policyList;
+
+END $$
+DELIMITER ;
+call updateBlankPolicyName();
+
+DROP FUNCTION if exists getTempPolicyCount;
+DROP PROCEDURE if exists updateBlankPolicyName;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/008-removeTrailingSlash.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/008-removeTrailingSlash.sql b/security-admin/db/mysql/patches/008-removeTrailingSlash.sql
new file mode 100644
index 0000000..2e00f5f
--- /dev/null
+++ b/security-admin/db/mysql/patches/008-removeTrailingSlash.sql
@@ -0,0 +1,144 @@
+-- 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.
+
+-- --------------------------------------------------------------------------------
+-- Routine DDL
+-- Note: comments before and after the routine body will not be stored by the server
+-- --------------------------------------------------------------------------------
+DELIMITER $$
+
+DROP FUNCTION if exists removeTrailingSlash $$
+CREATE FUNCTION `removeTrailingSlash`(resName varchar(4000), resId bigint, assetId bigint, policyName varchar(1000)) RETURNS varchar(4000) CHARSET latin1
+BEGIN
+
+DECLARE noOfCommas int;
+DECLARE updatedResName varchar(4000) default '';
+DECLARE resource varchar(1000);
+DECLARE count int default 0;
+DECLARE proceedLoop boolean default true;
+
+-- TrxLog fields
+DECLARE createTime datetime;
+DECLARE addedById bigint;
+DECLARE classType int;
+DECLARE objId bigint;
+DECLARE parentObjId bigint;
+DECLARE parentObjClsType int;
+DECLARE parentObjName varchar(1024);
+DECLARE objName varchar(1024);
+DECLARE attrName varchar(255);
+DECLARE prevVal varchar(1024);
+DECLARE newVal varchar(1024);
+DECLARE trxId varchar(1024);
+DECLARE act varchar(255);
+DECLARE sessType varchar(30);
+DECLARE transId varchar(50);
+DECLARE assetTypeInt int;
+DECLARE assetType varchar(30);
+
+set noOfCommas = (LENGTH(resName)-LENGTH(REPLACE (resName, ",", "")));
+set assetTypeInt = (select asset_type from x_asset where id = assetId);
+
+ if (assetTypeInt = 1) then
+ set assetType = 'HDFS';
+ elseif (assetTypeInt = 2) then
+ set assetType = 'HBase';
+ elseif ((assetTypeInt = 3)) then
+ set assetType = 'Hive';
+ elseif (assetTypeInt = 4) then
+ set assetType = 'XAAGENT';
+ elseif (assetTypeInt = 5) then
+ set assetType = 'Knox';
+ elseif (assetTypeInt = 6) then
+ set assetType = 'Storm';
+ end if;
+
+WHILE proceedLoop DO
+ set count = count +1;
+
+ if (count > noOfCommas) then
+ set resource = SUBSTRING_INDEX(resName, ',', -1);
+ set proceedLoop = false;
+ else
+ set resource = REPLACE(SUBSTRING(SUBSTRING_INDEX(resName, ',', count),
+ LENGTH(SUBSTRING_INDEX(resName, ',', count -1)) + 1), ',', '');
+ end if;
+
+ if (LENGTH(resource) > 1 && SUBSTRING(resource, -(LENGTH(resource)-(LENGTH(resource)-1))) = '/') then
+ set resource = SUBSTRING(resource, 1, (LENGTH(resource)-1));
+ else
+ set resource = resource;
+ end if;
+
+ if(updatedResName != '') then
+ set updatedResName = CONCAT(updatedResName, ',', resource);
+ else
+ set updatedResName = resource;
+ end if;
+
+END WHILE;
+
+if (updatedResName != resName) then
+-- Generating Trx Log if value has been updated.
+
+set createTime = utc_timestamp();
+set addedById = 1;
+set classType = 1001;
+set objId = resId;
+set parentObjId = assetId;
+set parentObjClsType = 1000;
+set objName = updatedResName;
+set attrName = 'Resource Path';
+set prevVal = resName;
+set newVal = updatedResName;
+set act = 'update';
+set sessType = 'DB Script';
+
+set parentObjName = (select asset_name from x_asset where id = assetId);
+set transId = concat(DATE_FORMAT(utc_timestamp(), "%Y%m%d%H%i%s"), '_', rand());
+
+insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
+ class_type, object_id, parent_object_id, parent_object_class_type,
+ parent_object_name, object_name, attr_name, prev_val, new_val, `action`,
+ trx_id, sess_type)
+ values(createTime, createTime, addedById, addedById, classType, objId,
+ parentObjId, parentObjClsType, parentObjName, objName, attrName, prevVal,
+ newVal, act, transId, sessType);
+
+insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
+ class_type, object_id, parent_object_id, parent_object_class_type,
+ parent_object_name, object_name, attr_name, prev_val, new_val, `action`,
+ trx_id, sess_type)
+ values(createTime, createTime, addedById, addedById, classType, objId,
+ parentObjId, parentObjClsType, parentObjName, objName, 'Policy Name', policyName,
+ policyName, act, transId, sessType);
+
+insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
+ class_type, object_id, parent_object_id, parent_object_class_type,
+ parent_object_name, object_name, attr_name, new_val, `action`,
+ trx_id, sess_type)
+ values(createTime, createTime, addedById, addedById, classType, objId,
+ parentObjId, parentObjClsType, parentObjName, objName, 'Repository Type',
+ assetType, act, transId, sessType);
+
+end if;
+
+RETURN updatedResName;
+END $$
+DELIMITER ;
+UPDATE x_resource res, x_asset asset set res_name = removeTrailingSlash(res.res_name, res.id, res.asset_id, res.policy_name)
+ WHERE asset.asset_type = 1 and asset.id = res.asset_id;
+
+DROP FUNCTION if exists removeTrailingSlash;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/009-updated_schema.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/009-updated_schema.sql b/security-admin/db/mysql/patches/009-updated_schema.sql
new file mode 100644
index 0000000..ef1c1ed
--- /dev/null
+++ b/security-admin/db/mysql/patches/009-updated_schema.sql
@@ -0,0 +1,416 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+DROP TABLE IF EXISTS `x_service_def`;
+CREATE TABLE `x_service_def` (
+`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,
+`version` bigint(20) DEFAULT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`impl_class_name` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`rb_key_description` varchar(1024) DEFAULT NULL,
+`is_enabled` tinyint DEFAULT 1,
+primary key (`id`),
+KEY `x_service_def_added_by_id` (`added_by_id`),
+KEY `x_service_def_upd_by_id` (`upd_by_id`),
+KEY `x_service_def_cr_time` (`create_time`),
+KEY `x_service_def_up_time` (`update_time`),
+CONSTRAINT `x_service_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_service_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_service`;
+CREATE TABLE `x_service`(
+`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,
+`version` bigint(20) DEFAULT NULL,
+`type` bigint(20) DEFAULT NULL,
+`name` varchar(512) DEFAULT NULL,
+`policy_version` bigint(20) DEFAULT NULL,
+`policy_update_time`datetime DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`is_enabled` tinyint(1) NOT NULL DEFAULT '0',
+primary key (`id`),
+UNIQUE KEY `X_service_name` (`name`),
+KEY `x_service_added_by_id` (`added_by_id`),
+KEY `x_service_upd_by_id` (`upd_by_id`),
+KEY `x_service_cr_time` (`create_time`),
+KEY `x_service_up_time` (`update_time`),
+KEY `x_service_type` (`type`),
+CONSTRAINT `x_service_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_service_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_service_FK_type` FOREIGN KEY (`type`) REFERENCES `x_service_def` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_policy`;
+CREATE TABLE `x_policy` (
+`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,
+`version` bigint(20) DEFAULT NULL,
+`service` bigint(20) DEFAULT NULL,
+`name` varchar(512) DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`is_enabled` tinyint(1) NOT NULL DEFAULT '0',
+`is_audit_enabled` tinyint(1) NOT NULL DEFAULT '0',
+primary key (`id`),
+UNIQUE KEY `x_policy_name` (`name`),
+KEY `x_policy_added_by_id` (`added_by_id`),
+KEY `x_policy_upd_by_id` (`upd_by_id`),
+KEY `x_policy_cr_time` (`create_time`),
+KEY `x_policy_up_time` (`update_time`),
+KEY `x_policy_service` (`service`),
+CONSTRAINT `x_policy_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_FK_service` FOREIGN KEY (`service`) REFERENCES `x_service` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_service_config_def`;
+CREATE TABLE `x_service_config_def` (
+`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,
+`def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`type` varchar(1024) DEFAULT NULL,
+`sub_type` varchar(1024) DEFAULT NULL,
+`is_mandatory` tinyint(1) NOT NULL DEFAULT '0',
+`default_value` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`rb_key_decription` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_service_conf_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
+CONSTRAINT `x_service_conf_def_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_service_conf_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_resource_def`;
+CREATE TABLE `x_resource_def` (
+`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,
+`def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`type` varchar(1024) DEFAULT NULL,
+`res_level` bigint(20) DEFAULT NULL,
+`parent` bigint(20) DEFAULT NULL,
+`mandatory` tinyint(1) NOT NULL DEFAULT '0',
+`look_up_supported` tinyint(1) NOT NULL DEFAULT '0',
+`recursive_supported` tinyint(1) NOT NULL DEFAULT '0',
+`excludes_supported` tinyint(1) NOT NULL DEFAULT '0',
+`matcher` varchar(1024) DEFAULT NULL,
+`matcher_options` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`rb_key_description` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+KEY `x_resource_def_FK_parent` (`parent`),
+CONSTRAINT `x_resource_def_FK_parent` FOREIGN KEY (`parent`) REFERENCES `x_resource_def` (`id`),
+CONSTRAINT `x_resource_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
+CONSTRAINT `x_resource_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_resource_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_access_type_def`;
+CREATE TABLE `x_access_type_def` (
+`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,
+`def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_access_type_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
+CONSTRAINT `x_access_type_def_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_access_type_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_access_type_def_grants`;
+CREATE TABLE `x_access_type_def_grants` (
+`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,
+`atd_id` bigint(20) NOT NULL,
+`implied_grant` varchar(1024) DEFAULT NULL,
+primary key (`id`),
+CONSTRAINT `x_atd_grants_FK_atdid` FOREIGN KEY (`atd_id`) REFERENCES `x_access_type_def` (`id`),
+CONSTRAINT `x_atd_grants_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_atd_grants_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_policy_condition_def`;
+CREATE TABLE `x_policy_condition_def` (
+`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,
+`def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`evaluator` varchar(1024) DEFAULT NULL,
+`evaluator_options` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`description` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`rb_key_description` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_policy_cond_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
+CONSTRAINT `x_policy_cond_def_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_cond_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_enum_def`;
+CREATE TABLE `x_enum_def` (
+`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,
+`def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`default_index` bigint(20) DEFAULT NULL,
+primary key (`id`),
+CONSTRAINT `x_enum_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
+CONSTRAINT `x_enum_def_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_enum_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_enum_element_def`;
+CREATE TABLE `x_enum_element_def` (
+`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,
+`enum_def_id` bigint(20) NOT NULL,
+`name` varchar(1024) DEFAULT NULL,
+`label` varchar(1024) DEFAULT NULL,
+`rb_key_label` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_enum_element_def_FK_defid` FOREIGN KEY (`enum_def_id`) REFERENCES `x_enum_def` (`id`),
+CONSTRAINT `x_enum_element_def_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_enum_element_def_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_service_config_map`;
+CREATE TABLE `x_service_config_map` (
+`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,
+`service` bigint(20) NOT NULL,
+`config_key` varchar(1024) DEFAULT NULL,
+`config_value` varchar(1024) DEFAULT NULL,
+primary key (`id`),
+CONSTRAINT `x_service_conf_map_FK_service` FOREIGN KEY (`service`) REFERENCES `x_service` (`id`),
+CONSTRAINT `x_service_conf_map_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_service_conf_map_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_policy_resource`;
+CREATE TABLE `x_policy_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,
+`res_def_id` bigint(20) NOT NULL,
+`is_excludes` tinyint(1) NOT NULL DEFAULT '0',
+`is_recursive` tinyint(1) NOT NULL DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_policy_res_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
+CONSTRAINT `x_policy_res_FK_res_def_id` FOREIGN KEY (`res_def_id`) REFERENCES `x_resource_def` (`id`),
+CONSTRAINT `x_policy_res_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_res_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_policy_resource_map`;
+CREATE TABLE `x_policy_resource_map` (
+`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,
+`resource_id` bigint(20) NOT NULL,
+`value` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_policy_res_map_FK_res_id` FOREIGN KEY (`resource_id`) REFERENCES `x_policy_resource` (`id`),
+CONSTRAINT `x_policy_res_map_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_res_map_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+
+
+DROP TABLE IF EXISTS `x_policy_item`;
+CREATE TABLE `x_policy_item` (
+`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,
+`delegate_admin` tinyint(1) NOT NULL DEFAULT '0',
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_policy_item_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
+CONSTRAINT `x_policy_item_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_policy_item_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_policy_item_access`;
+CREATE TABLE `x_policy_item_access` (
+`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_item_id` bigint(20) NOT NULL,
+`type` bigint(20) NOT NULL,
+`is_allowed` tinyint(3) NOT NULL DEFAULT '0',
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (id),
+CONSTRAINT `x_plc_item_access_FK_pi_id` FOREIGN KEY (`policy_item_id`) REFERENCES `x_policy_item` (`id`),
+CONSTRAINT `x_plc_item_access_FK_atd_id` FOREIGN KEY (`type`) REFERENCES `x_access_type_def` (`id`),
+CONSTRAINT `x_plc_item_access_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_plc_item_access_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_policy_item_condition`;
+CREATE TABLE `x_policy_item_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_item_id` bigint(20) NOT NULL,
+`type` bigint(20) NOT NULL,
+`value` varchar(1024) DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (id),
+CONSTRAINT `x_plc_item_cond_FK_pi_id` FOREIGN KEY (`policy_item_id`) REFERENCES `x_policy_item` (`id`),
+CONSTRAINT `x_plc_item_cond_FK_pcd_id` FOREIGN KEY (`type`) REFERENCES `x_policy_condition_def` (`id`),
+CONSTRAINT `x_plc_item_cond_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_plc_item_cond_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_policy_item_user_perm`;
+CREATE TABLE `x_policy_item_user_perm` (
+`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_item_id` bigint(20) NOT NULL,
+`user_id` bigint(20) NULL DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_plc_itm_usr_perm_FK_pi_id` FOREIGN KEY (`policy_item_id`) REFERENCES `x_policy_item` (`id`),
+CONSTRAINT `x_plc_itm_usr_perm_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`),
+CONSTRAINT `x_plc_itm_usr_perm_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_plc_itm_usr_perm_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+
+DROP TABLE IF EXISTS `x_policy_item_group_perm`;
+CREATE TABLE `x_policy_item_group_perm` (
+`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_item_id` bigint(20) NOT NULL,
+`group_id` bigint(20) NULL DEFAULT NULL,
+`sort_order` tinyint(3) DEFAULT '0',
+primary key (`id`),
+CONSTRAINT `x_plc_itm_grp_perm_FK_pi_id` FOREIGN KEY (`policy_item_id`) REFERENCES `x_policy_item` (`id`),
+CONSTRAINT `x_plc_itm_grp_perm_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
+CONSTRAINT `x_plc_itm_grp_perm_FK_added_by` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+CONSTRAINT `x_plc_itm_grp_perm_FK_upd_by` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+);
+
+DROP TABLE IF EXISTS `x_data_hist`;
+CREATE TABLE `x_data_hist` (
+`id` bigint(20) NOT NULL AUTO_INCREMENT,
+`create_time` datetime DEFAULT NULL,
+`update_time` datetime DEFAULT NULL,
+`obj_guid` varchar(1024) not null,
+`obj_class_type` int NOT NULL,
+`obj_id` bigint(20) not null,
+`obj_name` varchar(1024) NOT NULL,
+`version` bigint(20) DEFAULT NULL,
+`action` varchar(512) NOT NULL,
+`from_time` datetime NOT NULL,
+`to_time` datetime DEFAULT NULL,
+`content` text NOT NULL,
+primary key (`id`)
+);
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/reset_asset.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/reset_asset.sql b/security-admin/db/mysql/reset_asset.sql
new file mode 100644
index 0000000..1d53819
--- /dev/null
+++ b/security-admin/db/mysql/reset_asset.sql
@@ -0,0 +1,19 @@
+-- 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.
+
+update x_asset set config = '{"username":"policymgr","password":"policymgr","fs.default.name":"hdfs://sandbox.hortonworks.com:8020","hadoop.security.authorization":"false","hadoop.security.authentication":"simple","hadoop.security.auth_to_local":"RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/ RULE:[2:$1@$0](jhs@.*)s/.*/mapred/ RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/ RULE:[2:$1@$0](hm@.*)s/.*/hbase/ RULE:[2:$1@$0](rs@.*)s/.*/hbase/ DEFAULT","dfs.datanode.kerberos.principal":"","dfs.namenode.kerberos.principal":"","dfs.secondary.namenode.kerberos.principal":"","commonNameForCertificate":""}' where asset_name = 'hadoopdev';
+update x_asset set config = '{"username":"policymgr","password":"policymgr","fs.default.name":"hdfs://sandbox.hortonworks.com:8020","hadoop.security.authorization":"false","hadoop.security.authentication":"simple","hadoop.security.auth_to_local":"RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/ RULE:[2:$1@$0](jhs@.*)s/.*/mapred/ RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/ RULE:[2:$1@$0](hm@.*)s/.*/hbase/ RULE:[2:$1@$0](rs@.*)s/.*/hbase/ DEFAULT","dfs.datanode.kerberos.principal":"","dfs.namenode.kerberos.principal":"","dfs.secondary.namenode.kerberos.principal":"","hbase.master.kerberos.principal":"","hbase.rpc.engine":"org.apache.hadoop.hbase.ipc.SecureRpcEngine","hbase.rpc.protection":"privacy","hbase.security.authentication":"simple","hbase.zookeeper.property.clientPort":"2181","hbase.zookeeper.quorum":"sandbox.hortonworks.com","commonNameForCertificate":""}' where asset_name = 'hbase' ;
+update x_asset set config = '{"username":"policymgr","password":"","jdbc.driverClassName":"org.apache.hive.jdbc.HiveDriver","jdbc.url":"jdbc:hive2://sandbox.hortonworks.com:10000/default","commonNameForCertificate":""}' where asset_name = 'dev-hive' ;
+commit ;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/reset_audit_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/reset_audit_mysql.sh b/security-admin/db/mysql/reset_audit_mysql.sh
new file mode 100755
index 0000000..51a5359
--- /dev/null
+++ b/security-admin/db/mysql/reset_audit_mysql.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# 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.
+
+#
+# Script to reset mysql database
+#
+
+#if [ $# -lt 1 ]; then
+# echo "Usage: $0 <db_root_password> [db_host] <db_name>"
+# exit 1
+#fi
+#
+#db_root_password=$1
+#db_host="localhost"
+#if [ "$2" != "" ]; then
+# db_host="$2"
+#fi
+#db_name="xa_logger"
+#if [ "$3" != "" ]; then
+# db_name="$3"
+#fi
+
+audit_db_user=xaadmin
+audit_db_password=xaadmin
+audit_db_file=xa_audit_db.sql
+audit_db_name=xa_logger
+echo "Importing database file $audit_db_file.sql ... "
+set -x
+mysql -u $audit_db_user --password=$audit_db_password -e "create database IF NOT EXISTS $audit_db_name"
+mysql -u $audit_db_user --password=$audit_db_password --database=$audit_db_name < $audit_db_file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/reset_core_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/reset_core_mysql.sh b/security-admin/db/mysql/reset_core_mysql.sh
new file mode 100755
index 0000000..26f7d46
--- /dev/null
+++ b/security-admin/db/mysql/reset_core_mysql.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# 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.
+
+#
+# Script to reset mysql database
+#
+
+#if [ $# -lt 1 ]; then
+# echo "Usage: $0 <db_root_password> [db_host] <db_name>"
+# exit 1
+#fi
+#
+#db_root_password=$1
+#db_host="localhost"
+#if [ "$2" != "" ]; then
+# db_host="$2"
+#fi
+#db_name="xa_db"
+#if [ "$3" != "" ]; then
+# db_name="$3"
+#fi
+
+db_user=xaadmin
+db_password=xaadmin
+db_file=xa_core_db.sql
+db_name=xa_db
+
+echo "Importing database file $db_file.sql ... "
+set -x
+mysql -u $db_user --password=$db_password --database=$db_name < $db_file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/resetdb_dev_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/resetdb_dev_mysql.sh b/security-admin/db/mysql/resetdb_dev_mysql.sh
new file mode 100755
index 0000000..c2bf5fb
--- /dev/null
+++ b/security-admin/db/mysql/resetdb_dev_mysql.sh
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+# 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.
+
+#
+# Script to reset mysql database
+#
+
+#if [ $# -lt 1 ]; then
+# echo "Usage: $0 <db_root_password> [db_host]"
+# exit 1
+#fi
+#
+#db_root_password=$1
+#db_host="localhost"
+#if [ "$2" != "" ]; then
+# db_host="$2"
+#fi
+
+db_user=xaadmin
+db_password=xaadmin
+db_file=xa_core_db.sql
+db_core_file=xa_core_db.sql
+db_name=xa_db
+
+MYSQL_BIN='mysql'
+MYSQL_HOST='localhost'
+
+mysqlexec="${MYSQL_BIN} -u ${db_user} --password=${db_password} -h ${MYSQL_HOST} ${db_name}"
+
+
+#echo "Importing database file $db_file ... "
+#set -x
+#mysql -u $db_user --password=$db_password < $db_file
+
+
+log() {
+ local prefix="[$(date +%Y/%m/%d\ %H:%M:%S)]: "
+ echo "${prefix} $@"
+}
+
+check_ret_status(){
+ if [ $1 -ne 0 ]; then
+ log "[E] $2";
+ exit 1;
+ fi
+}
+
+import_db () {
+
+ log "[I] Verifying Database: $db_name";
+ existdb=`${MYSQL_BIN} -u ${db_user} --password=$db_password -h $MYSQL_HOST -B --skip-column-names -e "show databases like '${db_name}' ;"`
+
+ if [ "${existdb}" = "${db_name}" ]
+ then
+ log "[I] - database ${db_name} already exists. deleting ..."
+ $MYSQL_BIN -u $db_user --password=$db_password -h $MYSQL_HOST -e "drop database $db_name"
+
+ fi
+
+ log "[I] Creating Database: $db_name";
+ $MYSQL_BIN -u $db_user --password=$db_password -h $MYSQL_HOST -e "create database $db_name"
+ check_ret_status $? "Creating database Failed.."
+
+
+ log "[I] Importing Core Database file: $db_core_file "
+ $MYSQL_BIN -u $db_user --password=$db_password -h $MYSQL_HOST $db_name < $db_core_file
+ check_ret_status $? "Importing Database Failed.."
+
+ log "[I] Importing Database file : $db_core_file DONE";
+}
+
+run_patches(){
+ log "[I] - starting upgradedb ... "
+
+ DBVERSION_CATALOG_CREATION=create_dbversion_catalog.sql
+
+ mysqlexec="${MYSQL_BIN} -u ${db_user} --password=${db_password} -h ${MYSQL_HOST} ${db_name}"
+
+ if [ -f ${DBVERSION_CATALOG_CREATION} ]
+ then
+ log "[I] Verifying database version catalog table .... "
+ ${mysqlexec} < ${DBVERSION_CATALOG_CREATION}
+ fi
+
+ dt=`date '+%s'`
+ tempFile=/tmp/sql_${dt}_$$.sql
+ sqlfiles=`ls -1 patches/*.sql 2> /dev/null | awk -F/ '{ print $NF }' | awk -F- '{ print $1, $0 }' | sort -k1 -n | awk '{ printf("patches/%s\n",$2) ; }'`
+ for sql in ${sqlfiles}
+ do
+ if [ -f ${sql} ]
+ then
+ bn=`basename ${sql}`
+ version=`echo ${bn} | awk -F'-' '{ print $1 }'`
+ if [ "${version}" != "" ]
+ then
+ c=`${mysqlexec} -B --skip-column-names -e "select count(id) from x_db_version_h where version = '${version}' and active = 'Y'"`
+ check_ret_status $? "DBVerionCheck - ${version} Failed."
+ if [ ${c} -eq 0 ]
+ then
+ cat ${sql} > ${tempFile}
+ echo >> ${tempFile}
+ echo "insert into x_db_version_h (version, inst_at, inst_by, updated_at, updated_by) values ( '${version}', now(), user(), now(), user()) ;" >> ${tempFile}
+ log "[I] - patch [${version}] is being applied."
+ ${mysqlexec} < ${tempFile}
+ check_ret_status $? "Update patch - ${version} Failed. See sql file : [${tempFile}]"
+ rm -f ${tempFile}
+ else
+ log "[I] - patch [${version}] is already applied. Skipping ..."
+ fi
+ fi
+ fi
+ done
+}
+
+
+import_db
+run_patches
+
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/xa_audit_db.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/xa_audit_db.sql b/security-admin/db/mysql/xa_audit_db.sql
new file mode 100644
index 0000000..dba98ce
--- /dev/null
+++ b/security-admin/db/mysql/xa_audit_db.sql
@@ -0,0 +1,82 @@
+-- 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.
+
+-- MySQL dump 10.13 Distrib 5.1.50, for apple-darwin10.3.0 (i386)
+--
+-- Host: localhost Database: xa_db
+-- ------------------------------------------------------
+-- Server version 5.1.50
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `xa_access_audit`
+--
+
+DROP TABLE IF EXISTS `xa_access_audit`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `xa_access_audit` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `audit_type` int(11) NOT NULL DEFAULT '0',
+ `access_result` int(11) DEFAULT '0',
+ `access_type` varchar(255) DEFAULT NULL,
+ `acl_enforcer` varchar(255) DEFAULT NULL,
+ `agent_id` varchar(255) DEFAULT NULL,
+ `client_ip` varchar(255) DEFAULT NULL,
+ `client_type` varchar(255) DEFAULT NULL,
+ `policy_id` bigint(20) DEFAULT '0',
+ `repo_name` varchar(255) DEFAULT NULL,
+ `repo_type` int(11) DEFAULT '0',
+ `result_reason` varchar(255) DEFAULT NULL,
+ `session_id` varchar(255) DEFAULT NULL,
+ `event_time` datetime DEFAULT NULL,
+ `request_user` varchar(255) DEFAULT NULL,
+ `action` varchar(2000) DEFAULT NULL,
+ `request_data` varchar(2000) DEFAULT NULL,
+ `resource_path` varchar(2000) DEFAULT NULL,
+ `resource_type` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `xa_access_audit_added_by_id` (`added_by_id`),
+ KEY `xa_access_audit_upd_by_id` (`upd_by_id`),
+ KEY `xa_access_audit_cr_time` (`create_time`),
+ KEY `xa_access_audit_up_time` (`update_time`),
+ KEY `xa_access_audit_event_time` (`event_time`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `xa_access_audit`
+--
+
+LOCK TABLES `xa_access_audit` WRITE;
+/*!40000 ALTER TABLE `xa_access_audit` DISABLE KEYS */;
+/*!40000 ALTER TABLE `xa_access_audit` ENABLE KEYS */;
+UNLOCK TABLES;
+
+-- Dump completed on 2014-05-25 0:07:27
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/xa_core_db.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/xa_core_db.sql b/security-admin/db/mysql/xa_core_db.sql
new file mode 100644
index 0000000..9d889a0
--- /dev/null
+++ b/security-admin/db/mysql/xa_core_db.sql
@@ -0,0 +1,754 @@
+-- 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.
+
+-- MySQL dump 10.13 Distrib 5.1.50, for apple-darwin10.3.0 (i386)
+--
+-- Host: localhost Database: xa_db
+-- ------------------------------------------------------
+-- Server version 5.1.50
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Temporary table structure for view `vx_trx_log`
+--
+
+DROP TABLE IF EXISTS `vx_trx_log`;
+/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `vx_trx_log` (
+ `id` bigint(20),
+ `create_time` datetime,
+ `update_time` datetime,
+ `added_by_id` bigint(20),
+ `upd_by_id` bigint(20),
+ `class_type` int(11),
+ `object_id` bigint(20),
+ `parent_object_id` bigint(20),
+ `parent_object_class_type` int(11),
+ `attr_name` varchar(255),
+ `parent_object_name` varchar(1024),
+ `object_name` varchar(1024),
+ `prev_val` varchar(1024),
+ `new_val` varchar(1024),
+ `trx_id` varchar(1024),
+ `action` varchar(255),
+ `sess_id` varchar(512),
+ `req_id` varchar(30),
+ `sess_type` varchar(30)
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `x_asset`
+--
+
+DROP TABLE IF EXISTS `x_asset`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_asset` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `asset_name` varchar(1024) NOT NULL,
+ `descr` varchar(4000) NOT NULL,
+ `act_status` int(11) NOT NULL DEFAULT '0',
+ `asset_type` int(11) NOT NULL DEFAULT '0',
+ `config` text,
+ `sup_native` tinyint(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `x_asset_FK_added_by_id` (`added_by_id`),
+ KEY `x_asset_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_asset_cr_time` (`create_time`),
+ KEY `x_asset_up_time` (`update_time`),
+ CONSTRAINT `x_asset_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_asset_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_asset`
+--
+
+LOCK TABLES `x_asset` WRITE;
+/*!40000 ALTER TABLE `x_asset` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_asset` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_audit_map`
+--
+
+DROP TABLE IF EXISTS `x_audit_map`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_audit_map` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `res_id` bigint(20) DEFAULT NULL,
+ `group_id` bigint(20) DEFAULT NULL,
+ `user_id` bigint(20) DEFAULT NULL,
+ `audit_type` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `x_audit_map_FK_added_by_id` (`added_by_id`),
+ KEY `x_audit_map_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_audit_map_FK_res_id` (`res_id`),
+ KEY `x_audit_map_FK_group_id` (`group_id`),
+ KEY `x_audit_map_FK_user_id` (`user_id`),
+ KEY `x_audit_map_cr_time` (`create_time`),
+ KEY `x_audit_map_up_time` (`update_time`),
+ CONSTRAINT `x_audit_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_audit_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_audit_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`),
+ CONSTRAINT `x_audit_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_audit_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_audit_map`
+--
+
+LOCK TABLES `x_audit_map` WRITE;
+/*!40000 ALTER TABLE `x_audit_map` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_audit_map` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_auth_sess`
+--
+
+DROP TABLE IF EXISTS `x_auth_sess`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_auth_sess` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `login_id` varchar(767) NOT NULL,
+ `user_id` bigint(20) DEFAULT NULL,
+ `ext_sess_id` varchar(512) DEFAULT NULL,
+ `auth_time` datetime NOT NULL,
+ `auth_status` int(11) NOT NULL DEFAULT '0',
+ `auth_type` int(11) NOT NULL DEFAULT '0',
+ `auth_provider` int(11) NOT NULL DEFAULT '0',
+ `device_type` int(11) NOT NULL DEFAULT '0',
+ `req_ip` varchar(48) NOT NULL,
+ `req_ua` varchar(1024) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_auth_sess_FK_added_by_id` (`added_by_id`),
+ KEY `x_auth_sess_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_auth_sess_FK_user_id` (`user_id`),
+ KEY `x_auth_sess_cr_time` (`create_time`),
+ KEY `x_auth_sess_up_time` (`update_time`),
+ CONSTRAINT `x_auth_sess_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_auth_sess_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_auth_sess_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_auth_sess`
+--
+
+LOCK TABLES `x_auth_sess` WRITE;
+/*!40000 ALTER TABLE `x_auth_sess` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_auth_sess` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_cred_store`
+--
+
+DROP TABLE IF EXISTS `x_cred_store`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_cred_store` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `store_name` varchar(1024) NOT NULL,
+ `descr` varchar(4000) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_cred_store_FK_added_by_id` (`added_by_id`),
+ KEY `x_cred_store_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_cred_store_cr_time` (`create_time`),
+ KEY `x_cred_store_up_time` (`update_time`),
+ CONSTRAINT `x_cred_store_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_cred_store_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_cred_store`
+--
+
+LOCK TABLES `x_cred_store` WRITE;
+/*!40000 ALTER TABLE `x_cred_store` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_cred_store` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_db_base`
+--
+
+DROP TABLE IF EXISTS `x_db_base`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_db_base` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_db_base_FK_added_by_id` (`added_by_id`),
+ KEY `x_db_base_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_db_base_cr_time` (`create_time`),
+ KEY `x_db_base_up_time` (`update_time`),
+ CONSTRAINT `x_db_base_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_db_base_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_db_base`
+--
+
+LOCK TABLES `x_db_base` WRITE;
+/*!40000 ALTER TABLE `x_db_base` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_db_base` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_group`
+--
+
+DROP TABLE IF EXISTS `x_group`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_group` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `group_name` varchar(1024) NOT NULL,
+ `descr` varchar(4000) NOT NULL,
+ `status` int(11) NOT NULL DEFAULT '0',
+ `group_type` int(11) NOT NULL DEFAULT '0',
+ `cred_store_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_group_FK_added_by_id` (`added_by_id`),
+ KEY `x_group_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_group_FK_cred_store_id` (`cred_store_id`),
+ KEY `x_group_cr_time` (`create_time`),
+ KEY `x_group_up_time` (`update_time`),
+ CONSTRAINT `x_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_group_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`),
+ CONSTRAINT `x_group_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_group`
+--
+
+LOCK TABLES `x_group` WRITE;
+/*!40000 ALTER TABLE `x_group` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_group` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_group_groups`
+--
+
+DROP TABLE IF EXISTS `x_group_groups`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_group_groups` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `group_name` varchar(1024) NOT NULL,
+ `p_group_id` bigint(20) DEFAULT NULL,
+ `group_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_group_groups_FK_added_by_id` (`added_by_id`),
+ KEY `x_group_groups_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_group_groups_FK_p_group_id` (`p_group_id`),
+ KEY `x_group_groups_FK_group_id` (`group_id`),
+ KEY `x_group_groups_cr_time` (`create_time`),
+ KEY `x_group_groups_up_time` (`update_time`),
+ CONSTRAINT `x_group_groups_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_group_groups_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_group_groups_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_group_groups_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_group_groups`
+--
+
+LOCK TABLES `x_group_groups` WRITE;
+/*!40000 ALTER TABLE `x_group_groups` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_group_groups` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_group_users`
+--
+
+DROP TABLE IF EXISTS `x_group_users`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_group_users` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `group_name` varchar(1024) NOT NULL,
+ `p_group_id` bigint(20) DEFAULT NULL,
+ `user_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_group_users_FK_added_by_id` (`added_by_id`),
+ KEY `x_group_users_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_group_users_FK_p_group_id` (`p_group_id`),
+ KEY `x_group_users_FK_user_id` (`user_id`),
+ KEY `x_group_users_cr_time` (`create_time`),
+ KEY `x_group_users_up_time` (`update_time`),
+ CONSTRAINT `x_group_users_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_group_users_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_group_users_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_group_users_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_group_users`
+--
+
+LOCK TABLES `x_group_users` WRITE;
+/*!40000 ALTER TABLE `x_group_users` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_group_users` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_perm_map`
+--
+
+DROP TABLE IF EXISTS `x_perm_map`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_perm_map` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `perm_group` varchar(1024) DEFAULT NULL,
+ `res_id` bigint(20) DEFAULT NULL,
+ `group_id` bigint(20) DEFAULT NULL,
+ `user_id` bigint(20) DEFAULT NULL,
+ `perm_for` int(11) NOT NULL DEFAULT '0',
+ `perm_type` int(11) NOT NULL DEFAULT '0',
+ `is_recursive` int(11) NOT NULL DEFAULT '0',
+ `is_wild_card` tinyint(1) NOT NULL DEFAULT '1',
+ `grant_revoke` tinyint(1) NOT NULL DEFAULT '1',
+ PRIMARY KEY (`id`),
+ KEY `x_perm_map_FK_added_by_id` (`added_by_id`),
+ KEY `x_perm_map_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_perm_map_FK_res_id` (`res_id`),
+ KEY `x_perm_map_FK_group_id` (`group_id`),
+ KEY `x_perm_map_FK_user_id` (`user_id`),
+ KEY `x_perm_map_cr_time` (`create_time`),
+ KEY `x_perm_map_up_time` (`update_time`),
+ CONSTRAINT `x_perm_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_perm_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
+ CONSTRAINT `x_perm_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`),
+ CONSTRAINT `x_perm_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_perm_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_perm_map`
+--
+
+LOCK TABLES `x_perm_map` WRITE;
+/*!40000 ALTER TABLE `x_perm_map` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_perm_map` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_policy_export_audit`
+--
+
+DROP TABLE IF EXISTS `x_policy_export_audit`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_policy_export_audit` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `client_ip` varchar(255) NOT NULL,
+ `agent_id` varchar(255) DEFAULT NULL,
+ `req_epoch` bigint(20) NOT NULL,
+ `last_updated` datetime DEFAULT NULL,
+ `repository_name` varchar(1024) DEFAULT NULL,
+ `exported_json` text,
+ `http_ret_code` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `x_policy_export_audit_FK_added_by_id` (`added_by_id`),
+ KEY `x_policy_export_audit_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_policy_export_audit_cr_time` (`create_time`),
+ KEY `x_policy_export_audit_up_time` (`update_time`),
+ CONSTRAINT `x_policy_export_audit_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_policy_export_audit_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_policy_export_audit`
+--
+
+LOCK TABLES `x_policy_export_audit` WRITE;
+/*!40000 ALTER TABLE `x_policy_export_audit` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_policy_export_audit` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_portal_user`
+--
+
+DROP TABLE IF EXISTS `x_portal_user`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_portal_user` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `first_name` varchar(1022) DEFAULT NULL,
+ `last_name` varchar(1022) DEFAULT NULL,
+ `pub_scr_name` varchar(2048) DEFAULT NULL,
+ `login_id` varchar(767) DEFAULT NULL,
+ `password` varchar(512) NOT NULL,
+ `email` varchar(512) DEFAULT NULL,
+ `status` int(11) NOT NULL DEFAULT '0',
+ `user_src` int(11) NOT NULL DEFAULT '0',
+ `notes` varchar(4000) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `x_portal_user_UK_login_id` (`login_id`),
+ UNIQUE KEY `x_portal_user_UK_email` (`email`),
+ KEY `x_portal_user_FK_added_by_id` (`added_by_id`),
+ KEY `x_portal_user_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_portal_user_cr_time` (`create_time`),
+ KEY `x_portal_user_up_time` (`update_time`),
+ KEY `x_portal_user_name` (`first_name`(767)),
+ KEY `x_portal_user_email` (`email`),
+ CONSTRAINT `x_portal_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_portal_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_portal_user`
+--
+
+LOCK TABLES `x_portal_user` WRITE;
+/*!40000 ALTER TABLE `x_portal_user` DISABLE KEYS */;
+INSERT INTO `x_portal_user` VALUES (1,'2014-05-25 00:07:26','2014-05-25 00:07:26',NULL,NULL,'Admin','','Admin','admin','ceb4f32325eda6142bd65215f4c0f371','',1,0,NULL);
+/*!40000 ALTER TABLE `x_portal_user` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_portal_user_role`
+--
+
+DROP TABLE IF EXISTS `x_portal_user_role`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_portal_user_role` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `user_id` bigint(20) NOT NULL,
+ `user_role` varchar(128) DEFAULT NULL,
+ `status` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `x_portal_user_role_FK_added_by_id` (`added_by_id`),
+ KEY `x_portal_user_role_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_portal_user_role_FK_user_id` (`user_id`),
+ KEY `x_portal_user_role_cr_time` (`create_time`),
+ KEY `x_portal_user_role_up_time` (`update_time`),
+ CONSTRAINT `x_portal_user_role_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_portal_user_role_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_portal_user_role_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_portal_user_role`
+--
+
+LOCK TABLES `x_portal_user_role` WRITE;
+/*!40000 ALTER TABLE `x_portal_user_role` DISABLE KEYS */;
+INSERT INTO `x_portal_user_role` VALUES (1,'2014-05-25 00:07:26','2014-05-25 00:07:26',NULL,NULL,1,'ROLE_SYS_ADMIN',1);
+/*!40000 ALTER TABLE `x_portal_user_role` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_resource`
+--
+
+DROP TABLE IF EXISTS `x_resource`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_resource` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `res_name` varchar(4000) DEFAULT NULL,
+ `descr` varchar(4000) DEFAULT NULL,
+ `res_type` int(11) NOT NULL DEFAULT '0',
+ `asset_id` bigint(20) NOT NULL,
+ `parent_id` bigint(20) DEFAULT NULL,
+ `parent_path` varchar(4000) DEFAULT NULL,
+ `is_encrypt` int(11) NOT NULL DEFAULT '0',
+ `is_recursive` int(11) NOT NULL DEFAULT '0',
+ `res_group` varchar(1024) DEFAULT NULL,
+ `res_dbs` text,
+ `res_tables` text,
+ `res_col_fams` text,
+ `res_cols` text,
+ `res_udfs` text,
+ `res_status` int(11) NOT NULL DEFAULT '1',
+ `table_type` int(11) NOT NULL DEFAULT '0',
+ `col_type` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `x_resource_FK_added_by_id` (`added_by_id`),
+ KEY `x_resource_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_resource_FK_asset_id` (`asset_id`),
+ KEY `x_resource_FK_parent_id` (`parent_id`),
+ KEY `x_resource_cr_time` (`create_time`),
+ KEY `x_resource_up_time` (`update_time`),
+ CONSTRAINT `x_resource_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_resource_FK_asset_id` FOREIGN KEY (`asset_id`) REFERENCES `x_asset` (`id`),
+ CONSTRAINT `x_resource_FK_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `x_resource` (`id`),
+ CONSTRAINT `x_resource_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_resource`
+--
+
+LOCK TABLES `x_resource` WRITE;
+/*!40000 ALTER TABLE `x_resource` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_resource` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_trx_log`
+--
+
+DROP TABLE IF EXISTS `x_trx_log`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_trx_log` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `class_type` int(11) NOT NULL DEFAULT '0',
+ `object_id` bigint(20) DEFAULT NULL,
+ `parent_object_id` bigint(20) DEFAULT NULL,
+ `parent_object_class_type` int(11) NOT NULL DEFAULT '0',
+ `parent_object_name` varchar(1024) DEFAULT NULL,
+ `object_name` varchar(1024) DEFAULT NULL,
+ `attr_name` varchar(255) DEFAULT NULL,
+ `prev_val` varchar(1024) DEFAULT NULL,
+ `new_val` varchar(1024) DEFAULT NULL,
+ `trx_id` varchar(1024) DEFAULT NULL,
+ `action` varchar(255) DEFAULT NULL,
+ `sess_id` varchar(512) DEFAULT NULL,
+ `req_id` varchar(30) DEFAULT NULL,
+ `sess_type` varchar(30) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_trx_log_FK_added_by_id` (`added_by_id`),
+ KEY `x_trx_log_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_trx_log_cr_time` (`create_time`),
+ KEY `x_trx_log_up_time` (`update_time`),
+ CONSTRAINT `x_trx_log_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_trx_log_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_trx_log`
+--
+
+LOCK TABLES `x_trx_log` WRITE;
+/*!40000 ALTER TABLE `x_trx_log` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_trx_log` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `x_user`
+--
+
+DROP TABLE IF EXISTS `x_user`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `x_user` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `user_name` varchar(1024) NOT NULL,
+ `descr` varchar(4000) NOT NULL,
+ `status` int(11) NOT NULL DEFAULT '0',
+ `cred_store_id` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_user_FK_added_by_id` (`added_by_id`),
+ KEY `x_user_FK_upd_by_id` (`upd_by_id`),
+ KEY `x_user_FK_cred_store_id` (`cred_store_id`),
+ KEY `x_user_cr_time` (`create_time`),
+ KEY `x_user_up_time` (`update_time`),
+ CONSTRAINT `x_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
+ CONSTRAINT `x_user_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`),
+ CONSTRAINT `x_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `x_user`
+--
+
+LOCK TABLES `x_user` WRITE;
+/*!40000 ALTER TABLE `x_user` DISABLE KEYS */;
+/*!40000 ALTER TABLE `x_user` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `xa_access_audit`
+--
+
+DROP TABLE IF EXISTS `xa_access_audit`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `xa_access_audit` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `create_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `added_by_id` bigint(20) DEFAULT NULL,
+ `upd_by_id` bigint(20) DEFAULT NULL,
+ `audit_type` int(11) NOT NULL DEFAULT '0',
+ `access_result` int(11) DEFAULT '0',
+ `access_type` varchar(255) DEFAULT NULL,
+ `acl_enforcer` varchar(255) DEFAULT NULL,
+ `agent_id` varchar(255) DEFAULT NULL,
+ `client_ip` varchar(255) DEFAULT NULL,
+ `client_type` varchar(255) DEFAULT NULL,
+ `policy_id` bigint(20) DEFAULT '0',
+ `repo_name` varchar(255) DEFAULT NULL,
+ `repo_type` int(11) DEFAULT '0',
+ `result_reason` varchar(255) DEFAULT NULL,
+ `session_id` varchar(255) DEFAULT NULL,
+ `event_time` datetime DEFAULT NULL,
+ `request_user` varchar(255) DEFAULT NULL,
+ `action` varchar(2000) DEFAULT NULL,
+ `request_data` varchar(2000) DEFAULT NULL,
+ `resource_path` varchar(2000) DEFAULT NULL,
+ `resource_type` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `xa_access_audit_added_by_id` (`added_by_id`),
+ KEY `xa_access_audit_upd_by_id` (`upd_by_id`),
+ KEY `xa_access_audit_cr_time` (`create_time`),
+ KEY `xa_access_audit_up_time` (`update_time`),
+ KEY `xa_access_audit_event_time` (`event_time`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `xa_access_audit`
+--
+
+LOCK TABLES `xa_access_audit` WRITE;
+/*!40000 ALTER TABLE `xa_access_audit` DISABLE KEYS */;
+/*!40000 ALTER TABLE `xa_access_audit` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Final view structure for view `vx_trx_log`
+--
+
+/*!50001 DROP TABLE IF EXISTS `vx_trx_log`*/;
+/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50001 VIEW `vx_trx_log` AS select `x_trx_log`.`id` AS `id`,`x_trx_log`.`create_time` AS `create_time`,`x_trx_log`.`update_time` AS `update_time`,`x_trx_log`.`added_by_id` AS `added_by_id`,`x_trx_log`.`upd_by_id` AS `upd_by_id`,`x_trx_log`.`class_type` AS `class_type`,`x_trx_log`.`object_id` AS `object_id`,`x_trx_log`.`parent_object_id` AS `parent_object_id`,`x_trx_log`.`parent_object_class_type` AS `parent_object_class_type`,`x_trx_log`.`attr_name` AS `attr_name`,`x_trx_log`.`parent_object_name` AS `parent_object_name`,`x_trx_log`.`object_name` AS `object_name`,`x_trx_log`.`prev_val` AS `prev_val`,`x_trx_log`.`new_val` AS `new_val`,`x_trx_log`.`trx_id` AS `trx_id`,`x_trx_log`.`action` AS `action`,`x_trx_log`.`sess_id` AS `sess_id`,`x_trx_log`.`req_id` AS `req_id`,`x_trx_log`.`sess_type` AS `sess_type` from `x_trx_log` group by `x_trx_log`.`trx_id` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2014-05-25 0:07:27
\ No newline at end of file
[5/5] incubator-ranger git commit: RANGER-239: Support JDBC based SQL
invocation for setup process
Posted by ve...@apache.org.
RANGER-239: Support JDBC based SQL invocation for setup process
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/9c2f0d1f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/9c2f0d1f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/9c2f0d1f
Branch: refs/heads/master
Commit: 9c2f0d1fb722dfcc3155ee928f0ef2739a9cc79f
Parents: 1283c96
Author: vel <ve...@apache.org>
Authored: Thu Feb 19 15:05:10 2015 -0500
Committer: vel <ve...@apache.org>
Committed: Thu Feb 19 15:05:10 2015 -0500
----------------------------------------------------------------------
agents-common/pom.xml | 5 +
.../main/java/org/apache/util/sql/Jisql.java | 6 +-
security-admin/db/create_dbversion_catalog.sql | 24 -
security-admin/db/create_dev_user.sh | 35 -
security-admin/db/create_dev_user.sql | 21 -
security-admin/db/init/backup_mysql_db.sh | 34 -
.../db/init/create_dev_backup_mysql.sh | 17 -
.../db/init/create_dev_backup_mysql_loaded.sh | 17 -
security-admin/db/init/create_xa_core_db.sh | 30 -
security-admin/db/init/mysql_seed_data.sql | 40 -
security-admin/db/init/reset_db.sh | 34 -
security-admin/db/init/reset_db_with_seed.sh | 42 -
security-admin/db/init/schema_mysql.sql | 490 ------------
.../db/mysql/create_dbversion_catalog.sql | 24 +
security-admin/db/mysql/create_dev_user.sh | 35 +
security-admin/db/mysql/create_dev_user.sql | 21 +
security-admin/db/mysql/init/backup_mysql_db.sh | 34 +
.../db/mysql/init/create_dev_backup_mysql.sh | 17 +
.../init/create_dev_backup_mysql_loaded.sh | 17 +
.../db/mysql/init/create_xa_core_db.sh | 30 +
.../db/mysql/init/mysql_seed_data.sql | 40 +
security-admin/db/mysql/init/reset_db.sh | 34 +
.../db/mysql/init/reset_db_with_seed.sh | 42 +
security-admin/db/mysql/init/schema_mysql.sql | 490 ++++++++++++
.../db/mysql/patches/001-groupsource.sql | 34 +
.../db/mysql/patches/002-policyname.sql | 37 +
.../db/mysql/patches/003-knoxrepo.sql | 48 ++
.../db/mysql/patches/004-assetconfigsize.sql | 31 +
.../db/mysql/patches/005-xtrxlogcolumnsize.sql | 34 +
.../patches/006-createdefaultpublicgroup.sql | 34 +
.../mysql/patches/007-updateBlankPolicyName.sql | 186 +++++
.../mysql/patches/008-removeTrailingSlash.sql | 144 ++++
.../db/mysql/patches/009-updated_schema.sql | 416 ++++++++++
security-admin/db/mysql/reset_asset.sql | 19 +
security-admin/db/mysql/reset_audit_mysql.sh | 44 ++
security-admin/db/mysql/reset_core_mysql.sh | 44 ++
security-admin/db/mysql/resetdb_dev_mysql.sh | 137 ++++
security-admin/db/mysql/xa_audit_db.sql | 82 ++
security-admin/db/mysql/xa_core_db.sql | 754 ++++++++++++++++++
security-admin/db/mysql/xa_db.sql | 778 +++++++++++++++++++
security-admin/db/mysql/xa_db_bare.sql | 15 +
.../db/oracle/patches/001-groupsource.sql | 3 +-
.../db/oracle/patches/002-policyname.sql | 3 +-
.../db/oracle/patches/003-knoxrepo.sql | 3 +-
.../patches/006-createdefaultpublicgroup.sql | 3 +-
.../db/oracle/patches/009-updated_schema.sql | 407 ++++++++++
.../db/oracle/reset_audit_db_oracle.sql | 71 ++
.../db/oracle/reset_core_db_oracle.sql | 114 +++
security-admin/db/oracle/xa_audit_db_oracle.sql | 56 +-
security-admin/db/oracle/xa_core_db_oracle.sql | 136 +---
security-admin/db/patches/001-groupsource.sql | 34 -
security-admin/db/patches/002-policyname.sql | 37 -
security-admin/db/patches/003-knoxrepo.sql | 48 --
.../db/patches/004-assetconfigsize.sql | 31 -
.../db/patches/005-xtrxlogcolumnsize.sql | 34 -
.../db/patches/006-createdefaultpublicgroup.sql | 34 -
.../db/patches/007-updateBlankPolicyName.sql | 186 -----
.../db/patches/008-removeTrailingSlash.sql | 144 ----
.../db/patches/009-updated_schema.sql | 419 ----------
security-admin/db/reset_asset.sql | 19 -
security-admin/db/reset_audit_mysql.sh | 44 --
security-admin/db/reset_core_mysql.sh | 44 --
security-admin/db/resetdb_dev_mysql.sh | 137 ----
security-admin/db/xa_audit_db.sql | 82 --
security-admin/db/xa_core_db.sql | 754 ------------------
security-admin/db/xa_db.sql | 778 -------------------
security-admin/db/xa_db_bare.sql | 15 -
security-admin/pom.xml | 2 +
security-admin/scripts/db_setup.py | 757 ++++++++++++++++++
security-admin/scripts/install.properties | 15 +-
security-admin/scripts/setup.sh | 62 +-
.../apache/ranger/entity/XXEnumElementDef.java | 4 +-
.../org/apache/ranger/entity/XXResourceDef.java | 2 +-
src/main/assembly/admin-web.xml | 1 +
74 files changed, 5039 insertions(+), 3856 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/agents-common/pom.xml
----------------------------------------------------------------------
diff --git a/agents-common/pom.xml b/agents-common/pom.xml
index ede7b9d..021aad1 100644
--- a/agents-common/pom.xml
+++ b/agents-common/pom.xml
@@ -60,6 +60,11 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-jaxrs</artifactId>
+ <version>${codehaus.jackson.version}</version>
+ </dependency>
<dependency>
<groupId>security_plugins.ranger-plugins-audit</groupId>
<artifactId>ranger-plugins-audit</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/jisql/src/main/java/org/apache/util/sql/Jisql.java
----------------------------------------------------------------------
diff --git a/jisql/src/main/java/org/apache/util/sql/Jisql.java b/jisql/src/main/java/org/apache/util/sql/Jisql.java
index f3fab71..c3ba5a6 100644
--- a/jisql/src/main/java/org/apache/util/sql/Jisql.java
+++ b/jisql/src/main/java/org/apache/util/sql/Jisql.java
@@ -396,6 +396,7 @@ public class Jisql {
}
if(connectString.toLowerCase().startsWith("jdbc:oracle") && inputFileName!=null){
if (trimmedLine.startsWith("/") ||trimmedLine.length()<2) {
+ commandTerminator=";";
continue;
}
}
@@ -644,8 +645,9 @@ public class Jisql {
throw new Exception("user name must exist");
if ((password == null) && (passwordFileName == null)) {
- Console console = System.console();
- password = new String( console.readPassword("Password (hit enter for no password): ") );
+ password="";
+ //Console console = System.console();
+ //password = new String( console.readPassword("Password (hit enter for no password): ") );
}
else if (password == null) {
File passwordFile = null;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/create_dbversion_catalog.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/create_dbversion_catalog.sql b/security-admin/db/create_dbversion_catalog.sql
deleted file mode 100644
index 9c90633..0000000
--- a/security-admin/db/create_dbversion_catalog.sql
+++ /dev/null
@@ -1,24 +0,0 @@
--- 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.
-
-create table if not exists x_db_version_h (
- id bigint not null auto_increment primary key,
- version varchar(64) not null,
- inst_at timestamp not null default current_timestamp,
- inst_by varchar(256) not null,
- updated_at timestamp not null,
- updated_by varchar(256) not null,
- active ENUM('Y', 'N') default 'Y'
-) ;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/create_dev_user.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/create_dev_user.sh b/security-admin/db/create_dev_user.sh
deleted file mode 100755
index a59e264..0000000
--- a/security-admin/db/create_dev_user.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-#
-# Script to reset mysql database
-#
-
-if [ $# -lt 1 ]; then
- echo "Usage: $0 <db_root_password> [db_host]"
- exit 1
-fi
-
-db_root_password=$1
-db_host="localhost"
-if [ "$2" != "" ]; then
- db_host="$2"
-fi
-
-echo "Creating user ... "
-set -x
-mysql -u root --password=$db_root_password < create_dev_user.sql
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/create_dev_user.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/create_dev_user.sql b/security-admin/db/create_dev_user.sql
deleted file mode 100644
index bf475d0..0000000
--- a/security-admin/db/create_dev_user.sql
+++ /dev/null
@@ -1,21 +0,0 @@
--- 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.
-
-create user 'xaadmin'@'%' identified by 'xaadmin';
-GRANT ALL ON *.* TO 'xaadmin'@'localhost' IDENTIFIED BY 'xaadmin';
-grant all privileges on *.* to 'xaadmin'@'%' with grant option;
-grant all privileges on *.* to 'xaadmin'@'localhost' with grant option;
-FLUSH PRIVILEGES;
-
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/init/backup_mysql_db.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/init/backup_mysql_db.sh b/security-admin/db/init/backup_mysql_db.sh
deleted file mode 100755
index ef66140..0000000
--- a/security-admin/db/init/backup_mysql_db.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-#
-# Script to reset mysql database
-#
-
-if [ $# -lt 3 ]; then
- echo "Usage: $0 <db_user> <db_password> <db_database> <output file>"
- exit 1
-fi
-
-db_user=$1
-db_password=$2
-db_database=$3
-outfile=$4
-
-echo "Exporting $db_database ... "
-mysqldump -u $db_user --password=$db_password --add-drop-database --database $db_database > $outfile
-echo "Check output file $outfile"
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/init/create_dev_backup_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/init/create_dev_backup_mysql.sh b/security-admin/db/init/create_dev_backup_mysql.sh
deleted file mode 100755
index db2e2a7..0000000
--- a/security-admin/db/init/create_dev_backup_mysql.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-./backup_mysql_db.sh xaadmin xaadmin xa_db ../xa_db_bare.sql
-
-# 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.
-
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/init/create_dev_backup_mysql_loaded.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/init/create_dev_backup_mysql_loaded.sh b/security-admin/db/init/create_dev_backup_mysql_loaded.sh
deleted file mode 100755
index c1905b6..0000000
--- a/security-admin/db/init/create_dev_backup_mysql_loaded.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-./backup_mysql_db.sh xaadmin xaadmin xa_db ../xa_db.sql
-
-# 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.
-
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/init/create_xa_core_db.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/init/create_xa_core_db.sh b/security-admin/db/init/create_xa_core_db.sh
deleted file mode 100755
index 3c9483f..0000000
--- a/security-admin/db/init/create_xa_core_db.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-#
-# Script to reset mysql database
-#
-
-
-db_user=xaadmin
-db_password=xaadmin
-db_database=xa_db
-outfile=../xa_core_db.sql
-
-echo "Exporting $db_database ... "
-mysqldump -u $db_user --password=$db_password $db_database > $outfile
-echo "Check output file $outfile"
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/init/mysql_seed_data.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/init/mysql_seed_data.sql b/security-admin/db/init/mysql_seed_data.sql
deleted file mode 100644
index 8f992b1..0000000
--- a/security-admin/db/init/mysql_seed_data.sql
+++ /dev/null
@@ -1,40 +0,0 @@
--- 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.
-
-insert into x_portal_user (
- CREATE_TIME, UPDATE_TIME,
- FIRST_NAME, LAST_NAME, PUB_SCR_NAME,
- LOGIN_ID, PASSWORD, EMAIL, STATUS
-) values (
- now(), now(),
- 'Admin', '', 'Admin',
- 'admin', 'ceb4f32325eda6142bd65215f4c0f371', '', 1
-);
-SET @user_id:= last_insert_id();
-
-insert into x_portal_user_role (
- CREATE_TIME, UPDATE_TIME,
- USER_ID, USER_ROLE, STATUS
-) values (
- now(), now(),
- @user_id, 'ROLE_SYS_ADMIN', 1
-);
-SET @user_role_id:= last_insert_id();
-
-
-
-DROP TABLE IF EXISTS `vx_trx_log`;
-DROP VIEW IF EXISTS `vx_trx_log`;
-CREATE VIEW `vx_trx_log` AS select `x_trx_log`.`id` AS `id`,`x_trx_log`.`create_time` AS `create_time`,`x_trx_log`.`update_time` AS `update_time`,`x_trx_log`.`added_by_id` AS `added_by_id`,`x_trx_log`.`upd_by_id` AS `upd_by_id`,`x_trx_log`.`class_type` AS `class_type`,`x_trx_log`.`object_id` AS `object_id`,`x_trx_log`.`parent_object_id` AS `parent_object_id`,`x_trx_log`.`parent_object_class_type` AS `parent_object_class_type`,`x_trx_log`.`attr_name` AS `attr_name`,`x_trx_log`.`parent_object_name` AS `parent_object_name`,`x_trx_log`.`object_name` AS `object_name`,`x_trx_log`.`prev_val` AS `prev_val`,`x_trx_log`.`new_val` AS `new_val`,`x_trx_log`.`trx_id` AS `trx_id`,`x_trx_log`.`action` AS `action`,`x_trx_log`.`sess_id` AS `sess_id`,`x_trx_log`.`req_id` AS `req_id`,`x_trx_log`.`sess_type` AS `sess_type` from `x_trx_log` group by `x_trx_log`.`trx_id`
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/init/reset_db.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/init/reset_db.sh b/security-admin/db/init/reset_db.sh
deleted file mode 100755
index 8a7632d..0000000
--- a/security-admin/db/init/reset_db.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-if [ $# -ne 3 ]; then
- echo "Usage: $0 <db_user> <db_password> <db_database> [db_host]"
- exit 1
-fi
-
-db_user=$1
-db_password=$2
-db_database=$3
-
-set -x
-#First drop the database and recreate i
-echo "y" | mysqladmin -u $db_user -p$db_password drop $db_database
-mysqladmin -u $db_user -p$db_password create $db_database
-
-#Create the schema
-mysql -u $db_user -p$db_password $db_database < schema_mysql.sql
-
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/init/reset_db_with_seed.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/init/reset_db_with_seed.sh b/security-admin/db/init/reset_db_with_seed.sh
deleted file mode 100755
index 5670922..0000000
--- a/security-admin/db/init/reset_db_with_seed.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-if [ $# -ne 3 ]; then
- echo "Usage: $0 <db_user> <db_password> <db_database> [db_host]"
- exit 1
-fi
-
-db_user=$1
-db_password=$2
-db_database=$3
-
-#db_user=cignifi
-#db_password=cignifi
-#db_database=cignifi_dev
-
-
-set -x
-#First drop the database and recreate i
-echo "y" | mysqladmin -u $db_user -p$db_password drop $db_database
-mysqladmin -u $db_user -p$db_password create $db_database
-
-#Create the schema
-mysql -u $db_user -p$db_password $db_database < schema_mysql.sql
-
-#Add seed users
-mysql -u $db_user -p$db_password $db_database < mysql_seed_data.sql
-
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/init/schema_mysql.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/init/schema_mysql.sql b/security-admin/db/init/schema_mysql.sql
deleted file mode 100644
index 1dd7420..0000000
--- a/security-admin/db/init/schema_mysql.sql
+++ /dev/null
@@ -1,490 +0,0 @@
--- 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.
-
-
-SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
-SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
-SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
-
-drop table if exists x_db_base;
-create table x_db_base (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_auth_sess;
-create table x_auth_sess (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- login_id VARCHAR (767) NOT NULL,
- user_id BIGINT ,
- ext_sess_id VARCHAR (512) ,
- auth_time DATETIME NOT NULL,
- auth_status INT NOT NULL DEFAULT 0,
- auth_type INT NOT NULL DEFAULT 0,
- auth_provider INT NOT NULL DEFAULT 0,
- device_type INT NOT NULL DEFAULT 0,
- req_ip VARCHAR (48) NOT NULL,
- req_ua VARCHAR (1024) ,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_portal_user;
-create table x_portal_user (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- first_name VARCHAR (1022) ,
- last_name VARCHAR (1022) ,
- pub_scr_name VARCHAR (2048) ,
- login_id VARCHAR (767) ,
- password VARCHAR (512) NOT NULL,
- email VARCHAR (512) ,
- status INT NOT NULL DEFAULT 0,
- user_src INT NOT NULL DEFAULT 0,
- notes VARCHAR (4000) ,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_portal_user_role;
-create table x_portal_user_role (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- user_id BIGINT NOT NULL,
- user_role VARCHAR (128) ,
- status INT NOT NULL DEFAULT 0,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_asset;
-create table x_asset (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- asset_name VARCHAR (1024) NOT NULL,
- descr VARCHAR (4000) NOT NULL,
- act_status INT NOT NULL DEFAULT 0,
- asset_type INT NOT NULL DEFAULT 0,
- config TEXT ,
- sup_native TINYINT (1) NOT NULL DEFAULT 0,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_resource;
-create table x_resource (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- res_name VARCHAR (4000) ,
- descr VARCHAR (4000) ,
- res_type INT NOT NULL DEFAULT 0,
- asset_id BIGINT NOT NULL,
- parent_id BIGINT ,
- parent_path VARCHAR (4000) ,
- is_encrypt INT NOT NULL DEFAULT 0,
- is_recursive INT NOT NULL DEFAULT 0,
- res_group VARCHAR (1024) ,
- res_dbs TEXT ,
- res_tables TEXT ,
- res_col_fams TEXT ,
- res_cols TEXT ,
- res_udfs TEXT ,
- res_status INT NOT NULL DEFAULT 1,
- table_type INT NOT NULL DEFAULT 0,
- col_type INT NOT NULL DEFAULT 0,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_cred_store;
-create table x_cred_store (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- store_name VARCHAR (1024) NOT NULL,
- descr VARCHAR (4000) NOT NULL,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_group;
-create table x_group (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- group_name VARCHAR (1024) NOT NULL,
- descr VARCHAR (4000) NOT NULL,
- status INT NOT NULL DEFAULT 0,
- group_type INT NOT NULL DEFAULT 0,
- cred_store_id BIGINT ,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_user;
-create table x_user (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- user_name VARCHAR (1024) NOT NULL,
- descr VARCHAR (4000) NOT NULL,
- status INT NOT NULL DEFAULT 0,
- cred_store_id BIGINT ,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_group_users;
-create table x_group_users (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- group_name VARCHAR (1024) NOT NULL,
- p_group_id BIGINT ,
- user_id BIGINT ,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_group_groups;
-create table x_group_groups (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- group_name VARCHAR (1024) NOT NULL,
- p_group_id BIGINT ,
- group_id BIGINT ,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_perm_map;
-create table x_perm_map (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- perm_group VARCHAR (1024) ,
- res_id BIGINT ,
- group_id BIGINT ,
- user_id BIGINT ,
- perm_for INT NOT NULL DEFAULT 0,
- perm_type INT NOT NULL DEFAULT 0,
- is_recursive INT NOT NULL DEFAULT 0,
- is_wild_card TINYINT (1) NOT NULL DEFAULT 1,
- grant_revoke TINYINT (1) NOT NULL DEFAULT 1,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_audit_map;
-create table x_audit_map (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- res_id BIGINT ,
- group_id BIGINT ,
- user_id BIGINT ,
- audit_type INT NOT NULL DEFAULT 0,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_policy_export_audit;
-create table x_policy_export_audit (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- client_ip VARCHAR (255) NOT NULL,
- agent_id VARCHAR (255) ,
- req_epoch BIGINT NOT NULL,
- last_updated DATETIME ,
- repository_name VARCHAR (1024) ,
- exported_json TEXT ,
- http_ret_code INT NOT NULL DEFAULT 0,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists x_trx_log;
-create table x_trx_log (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- class_type INT NOT NULL DEFAULT 0,
- object_id BIGINT ,
- parent_object_id BIGINT ,
- parent_object_class_type INT NOT NULL DEFAULT 0,
- parent_object_name VARCHAR (1024) ,
- object_name VARCHAR (1024) ,
- attr_name VARCHAR (255) ,
- prev_val VARCHAR (1024) ,
- new_val VARCHAR (1024) ,
- trx_id VARCHAR (1024) ,
- action VARCHAR (255) ,
- sess_id VARCHAR (512) ,
- req_id VARCHAR (30) ,
- sess_type VARCHAR (30) ,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-drop table if exists xa_access_audit;
-create table xa_access_audit (
- id BIGINT NOT NULL AUTO_INCREMENT,
- create_time DATETIME ,
- update_time DATETIME ,
- added_by_id BIGINT ,
- upd_by_id BIGINT ,
- audit_type INT NOT NULL DEFAULT 0,
- access_result INT DEFAULT 0,
- access_type VARCHAR (255) ,
- acl_enforcer VARCHAR (255) ,
- agent_id VARCHAR (255) ,
- client_ip VARCHAR (255) ,
- client_type VARCHAR (255) ,
- policy_id BIGINT DEFAULT 0,
- repo_name VARCHAR (255) ,
- repo_type INT DEFAULT 0,
- result_reason VARCHAR (255) ,
- session_id VARCHAR (255) ,
- event_time DATETIME ,
- request_user VARCHAR (255) ,
- action VARCHAR (2000) ,
- request_data VARCHAR (2000) ,
- resource_path VARCHAR (2000) ,
- resource_type VARCHAR (255) ,
- PRIMARY KEY(id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-
-ALTER TABLE x_db_base ADD (
- CONSTRAINT x_db_base_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_db_base ADD (
- CONSTRAINT x_db_base_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_auth_sess ADD (
- CONSTRAINT x_auth_sess_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_auth_sess ADD (
- CONSTRAINT x_auth_sess_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_auth_sess ADD (
- CONSTRAINT x_auth_sess_FK_user_id FOREIGN KEY (user_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_portal_user ADD (
- CONSTRAINT x_portal_user_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_portal_user ADD (
- CONSTRAINT x_portal_user_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_portal_user_role ADD (
- CONSTRAINT x_portal_user_role_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_portal_user_role ADD (
- CONSTRAINT x_portal_user_role_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_portal_user_role ADD (
- CONSTRAINT x_portal_user_role_FK_user_id FOREIGN KEY (user_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_asset ADD (
- CONSTRAINT x_asset_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_asset ADD (
- CONSTRAINT x_asset_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_resource ADD (
- CONSTRAINT x_resource_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_resource ADD (
- CONSTRAINT x_resource_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_resource ADD (
- CONSTRAINT x_resource_FK_asset_id FOREIGN KEY (asset_id)
- REFERENCES x_asset (id));
-ALTER TABLE x_resource ADD (
- CONSTRAINT x_resource_FK_parent_id FOREIGN KEY (parent_id)
- REFERENCES x_resource (id));
-ALTER TABLE x_cred_store ADD (
- CONSTRAINT x_cred_store_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_cred_store ADD (
- CONSTRAINT x_cred_store_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_group ADD (
- CONSTRAINT x_group_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_group ADD (
- CONSTRAINT x_group_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_group ADD (
- CONSTRAINT x_group_FK_cred_store_id FOREIGN KEY (cred_store_id)
- REFERENCES x_cred_store (id));
-ALTER TABLE x_user ADD (
- CONSTRAINT x_user_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_user ADD (
- CONSTRAINT x_user_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_user ADD (
- CONSTRAINT x_user_FK_cred_store_id FOREIGN KEY (cred_store_id)
- REFERENCES x_cred_store (id));
-ALTER TABLE x_group_users ADD (
- CONSTRAINT x_group_users_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_group_users ADD (
- CONSTRAINT x_group_users_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_group_users ADD (
- CONSTRAINT x_group_users_FK_p_group_id FOREIGN KEY (p_group_id)
- REFERENCES x_group (id));
-ALTER TABLE x_group_users ADD (
- CONSTRAINT x_group_users_FK_user_id FOREIGN KEY (user_id)
- REFERENCES x_user (id));
-ALTER TABLE x_group_groups ADD (
- CONSTRAINT x_group_groups_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_group_groups ADD (
- CONSTRAINT x_group_groups_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_group_groups ADD (
- CONSTRAINT x_group_groups_FK_p_group_id FOREIGN KEY (p_group_id)
- REFERENCES x_group (id));
-ALTER TABLE x_group_groups ADD (
- CONSTRAINT x_group_groups_FK_group_id FOREIGN KEY (group_id)
- REFERENCES x_group (id));
-ALTER TABLE x_perm_map ADD (
- CONSTRAINT x_perm_map_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_perm_map ADD (
- CONSTRAINT x_perm_map_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_perm_map ADD (
- CONSTRAINT x_perm_map_FK_res_id FOREIGN KEY (res_id)
- REFERENCES x_resource (id));
-ALTER TABLE x_perm_map ADD (
- CONSTRAINT x_perm_map_FK_group_id FOREIGN KEY (group_id)
- REFERENCES x_group (id));
-ALTER TABLE x_perm_map ADD (
- CONSTRAINT x_perm_map_FK_user_id FOREIGN KEY (user_id)
- REFERENCES x_user (id));
-ALTER TABLE x_audit_map ADD (
- CONSTRAINT x_audit_map_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_audit_map ADD (
- CONSTRAINT x_audit_map_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_audit_map ADD (
- CONSTRAINT x_audit_map_FK_res_id FOREIGN KEY (res_id)
- REFERENCES x_resource (id));
-ALTER TABLE x_audit_map ADD (
- CONSTRAINT x_audit_map_FK_group_id FOREIGN KEY (group_id)
- REFERENCES x_group (id));
-ALTER TABLE x_audit_map ADD (
- CONSTRAINT x_audit_map_FK_user_id FOREIGN KEY (user_id)
- REFERENCES x_user (id));
-ALTER TABLE x_policy_export_audit ADD (
- CONSTRAINT x_policy_export_audit_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_policy_export_audit ADD (
- CONSTRAINT x_policy_export_audit_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_trx_log ADD (
- CONSTRAINT x_trx_log_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE x_trx_log ADD (
- CONSTRAINT x_trx_log_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE xa_access_audit ADD (
- CONSTRAINT xa_access_audit_FK_added_by_id FOREIGN KEY (added_by_id)
- REFERENCES x_portal_user (id));
-ALTER TABLE xa_access_audit ADD (
- CONSTRAINT xa_access_audit_FK_upd_by_id FOREIGN KEY (upd_by_id)
- REFERENCES x_portal_user (id));
-
-ALTER TABLE x_portal_user ADD (
- CONSTRAINT x_portal_user_UK_login_id UNIQUE (login_id(767)) );
-ALTER TABLE x_portal_user ADD (
- CONSTRAINT x_portal_user_UK_email UNIQUE (email(512)) );
-
-ALTER TABLE x_db_base ADD (INDEX x_db_base_cr_time (create_time));
-ALTER TABLE x_db_base ADD (INDEX x_db_base_up_time (update_time));
-ALTER TABLE x_auth_sess ADD (INDEX x_auth_sess_cr_time (create_time));
-ALTER TABLE x_auth_sess ADD (INDEX x_auth_sess_up_time (update_time));
-ALTER TABLE x_portal_user ADD (INDEX x_portal_user_cr_time (create_time));
-ALTER TABLE x_portal_user ADD (INDEX x_portal_user_up_time (update_time));
-ALTER TABLE x_portal_user ADD (INDEX x_portal_user_name (first_name(767)));
-ALTER TABLE x_portal_user ADD (INDEX x_portal_user_email (email(512)));
-ALTER TABLE x_portal_user_role ADD (INDEX x_portal_user_role_cr_time (create_time));
-ALTER TABLE x_portal_user_role ADD (INDEX x_portal_user_role_up_time (update_time));
-ALTER TABLE x_asset ADD (INDEX x_asset_cr_time (create_time));
-ALTER TABLE x_asset ADD (INDEX x_asset_up_time (update_time));
-ALTER TABLE x_resource ADD (INDEX x_resource_cr_time (create_time));
-ALTER TABLE x_resource ADD (INDEX x_resource_up_time (update_time));
-ALTER TABLE x_cred_store ADD (INDEX x_cred_store_cr_time (create_time));
-ALTER TABLE x_cred_store ADD (INDEX x_cred_store_up_time (update_time));
-ALTER TABLE x_group ADD (INDEX x_group_cr_time (create_time));
-ALTER TABLE x_group ADD (INDEX x_group_up_time (update_time));
-ALTER TABLE x_user ADD (INDEX x_user_cr_time (create_time));
-ALTER TABLE x_user ADD (INDEX x_user_up_time (update_time));
-ALTER TABLE x_group_users ADD (INDEX x_group_users_cr_time (create_time));
-ALTER TABLE x_group_users ADD (INDEX x_group_users_up_time (update_time));
-ALTER TABLE x_group_groups ADD (INDEX x_group_groups_cr_time (create_time));
-ALTER TABLE x_group_groups ADD (INDEX x_group_groups_up_time (update_time));
-ALTER TABLE x_perm_map ADD (INDEX x_perm_map_cr_time (create_time));
-ALTER TABLE x_perm_map ADD (INDEX x_perm_map_up_time (update_time));
-ALTER TABLE x_audit_map ADD (INDEX x_audit_map_cr_time (create_time));
-ALTER TABLE x_audit_map ADD (INDEX x_audit_map_up_time (update_time));
-ALTER TABLE x_policy_export_audit ADD (INDEX x_policy_export_audit_cr_time (create_time));
-ALTER TABLE x_policy_export_audit ADD (INDEX x_policy_export_audit_up_time (update_time));
-ALTER TABLE x_trx_log ADD (INDEX x_trx_log_cr_time (create_time));
-ALTER TABLE x_trx_log ADD (INDEX x_trx_log_up_time (update_time));
-ALTER TABLE xa_access_audit ADD (INDEX xa_access_audit_cr_time (create_time));
-ALTER TABLE xa_access_audit ADD (INDEX xa_access_audit_up_time (update_time));
-SET SQL_MODE=@OLD_SQL_MODE;
-SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-##champlain changes
-ALTER TABLE `x_group` ADD `group_src` INT NOT NULL DEFAULT 0;
-ALTER TABLE `x_resource` ADD `policy_name` VARCHAR( 500 ) NULL DEFAULT NULL;
-ALTER TABLE `x_resource` ADD UNIQUE `x_resource_UK_policy_name` ( `policy_name` );
-ALTER TABLE `x_resource` ADD `res_topologies` TEXT NULL DEFAULT NULL ;
-ALTER TABLE `x_resource` ADD `res_services` TEXT NULL DEFAULT NULL;
-ALTER TABLE `x_perm_map` ADD `ip_address` TEXT NULL DEFAULT NULL;
-ALTER TABLE `x_asset` CHANGE `config` `config` LONGTEXT NULL DEFAULT NULL ;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/create_dbversion_catalog.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/create_dbversion_catalog.sql b/security-admin/db/mysql/create_dbversion_catalog.sql
new file mode 100644
index 0000000..9c90633
--- /dev/null
+++ b/security-admin/db/mysql/create_dbversion_catalog.sql
@@ -0,0 +1,24 @@
+-- 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.
+
+create table if not exists x_db_version_h (
+ id bigint not null auto_increment primary key,
+ version varchar(64) not null,
+ inst_at timestamp not null default current_timestamp,
+ inst_by varchar(256) not null,
+ updated_at timestamp not null,
+ updated_by varchar(256) not null,
+ active ENUM('Y', 'N') default 'Y'
+) ;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/create_dev_user.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/create_dev_user.sh b/security-admin/db/mysql/create_dev_user.sh
new file mode 100755
index 0000000..a59e264
--- /dev/null
+++ b/security-admin/db/mysql/create_dev_user.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# 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.
+
+#
+# Script to reset mysql database
+#
+
+if [ $# -lt 1 ]; then
+ echo "Usage: $0 <db_root_password> [db_host]"
+ exit 1
+fi
+
+db_root_password=$1
+db_host="localhost"
+if [ "$2" != "" ]; then
+ db_host="$2"
+fi
+
+echo "Creating user ... "
+set -x
+mysql -u root --password=$db_root_password < create_dev_user.sql
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/create_dev_user.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/create_dev_user.sql b/security-admin/db/mysql/create_dev_user.sql
new file mode 100644
index 0000000..bf475d0
--- /dev/null
+++ b/security-admin/db/mysql/create_dev_user.sql
@@ -0,0 +1,21 @@
+-- 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.
+
+create user 'xaadmin'@'%' identified by 'xaadmin';
+GRANT ALL ON *.* TO 'xaadmin'@'localhost' IDENTIFIED BY 'xaadmin';
+grant all privileges on *.* to 'xaadmin'@'%' with grant option;
+grant all privileges on *.* to 'xaadmin'@'localhost' with grant option;
+FLUSH PRIVILEGES;
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/init/backup_mysql_db.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/init/backup_mysql_db.sh b/security-admin/db/mysql/init/backup_mysql_db.sh
new file mode 100755
index 0000000..ef66140
--- /dev/null
+++ b/security-admin/db/mysql/init/backup_mysql_db.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# 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.
+
+#
+# Script to reset mysql database
+#
+
+if [ $# -lt 3 ]; then
+ echo "Usage: $0 <db_user> <db_password> <db_database> <output file>"
+ exit 1
+fi
+
+db_user=$1
+db_password=$2
+db_database=$3
+outfile=$4
+
+echo "Exporting $db_database ... "
+mysqldump -u $db_user --password=$db_password --add-drop-database --database $db_database > $outfile
+echo "Check output file $outfile"
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/init/create_dev_backup_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/init/create_dev_backup_mysql.sh b/security-admin/db/mysql/init/create_dev_backup_mysql.sh
new file mode 100755
index 0000000..db2e2a7
--- /dev/null
+++ b/security-admin/db/mysql/init/create_dev_backup_mysql.sh
@@ -0,0 +1,17 @@
+./backup_mysql_db.sh xaadmin xaadmin xa_db ../xa_db_bare.sql
+
+# 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.
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/init/create_dev_backup_mysql_loaded.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/init/create_dev_backup_mysql_loaded.sh b/security-admin/db/mysql/init/create_dev_backup_mysql_loaded.sh
new file mode 100755
index 0000000..c1905b6
--- /dev/null
+++ b/security-admin/db/mysql/init/create_dev_backup_mysql_loaded.sh
@@ -0,0 +1,17 @@
+./backup_mysql_db.sh xaadmin xaadmin xa_db ../xa_db.sql
+
+# 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.
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/init/create_xa_core_db.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/init/create_xa_core_db.sh b/security-admin/db/mysql/init/create_xa_core_db.sh
new file mode 100755
index 0000000..3c9483f
--- /dev/null
+++ b/security-admin/db/mysql/init/create_xa_core_db.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# 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.
+
+#
+# Script to reset mysql database
+#
+
+
+db_user=xaadmin
+db_password=xaadmin
+db_database=xa_db
+outfile=../xa_core_db.sql
+
+echo "Exporting $db_database ... "
+mysqldump -u $db_user --password=$db_password $db_database > $outfile
+echo "Check output file $outfile"
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/init/mysql_seed_data.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/init/mysql_seed_data.sql b/security-admin/db/mysql/init/mysql_seed_data.sql
new file mode 100644
index 0000000..8f992b1
--- /dev/null
+++ b/security-admin/db/mysql/init/mysql_seed_data.sql
@@ -0,0 +1,40 @@
+-- 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.
+
+insert into x_portal_user (
+ CREATE_TIME, UPDATE_TIME,
+ FIRST_NAME, LAST_NAME, PUB_SCR_NAME,
+ LOGIN_ID, PASSWORD, EMAIL, STATUS
+) values (
+ now(), now(),
+ 'Admin', '', 'Admin',
+ 'admin', 'ceb4f32325eda6142bd65215f4c0f371', '', 1
+);
+SET @user_id:= last_insert_id();
+
+insert into x_portal_user_role (
+ CREATE_TIME, UPDATE_TIME,
+ USER_ID, USER_ROLE, STATUS
+) values (
+ now(), now(),
+ @user_id, 'ROLE_SYS_ADMIN', 1
+);
+SET @user_role_id:= last_insert_id();
+
+
+
+DROP TABLE IF EXISTS `vx_trx_log`;
+DROP VIEW IF EXISTS `vx_trx_log`;
+CREATE VIEW `vx_trx_log` AS select `x_trx_log`.`id` AS `id`,`x_trx_log`.`create_time` AS `create_time`,`x_trx_log`.`update_time` AS `update_time`,`x_trx_log`.`added_by_id` AS `added_by_id`,`x_trx_log`.`upd_by_id` AS `upd_by_id`,`x_trx_log`.`class_type` AS `class_type`,`x_trx_log`.`object_id` AS `object_id`,`x_trx_log`.`parent_object_id` AS `parent_object_id`,`x_trx_log`.`parent_object_class_type` AS `parent_object_class_type`,`x_trx_log`.`attr_name` AS `attr_name`,`x_trx_log`.`parent_object_name` AS `parent_object_name`,`x_trx_log`.`object_name` AS `object_name`,`x_trx_log`.`prev_val` AS `prev_val`,`x_trx_log`.`new_val` AS `new_val`,`x_trx_log`.`trx_id` AS `trx_id`,`x_trx_log`.`action` AS `action`,`x_trx_log`.`sess_id` AS `sess_id`,`x_trx_log`.`req_id` AS `req_id`,`x_trx_log`.`sess_type` AS `sess_type` from `x_trx_log` group by `x_trx_log`.`trx_id`
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/init/reset_db.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/init/reset_db.sh b/security-admin/db/mysql/init/reset_db.sh
new file mode 100755
index 0000000..8a7632d
--- /dev/null
+++ b/security-admin/db/mysql/init/reset_db.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [ $# -ne 3 ]; then
+ echo "Usage: $0 <db_user> <db_password> <db_database> [db_host]"
+ exit 1
+fi
+
+db_user=$1
+db_password=$2
+db_database=$3
+
+set -x
+#First drop the database and recreate i
+echo "y" | mysqladmin -u $db_user -p$db_password drop $db_database
+mysqladmin -u $db_user -p$db_password create $db_database
+
+#Create the schema
+mysql -u $db_user -p$db_password $db_database < schema_mysql.sql
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/init/reset_db_with_seed.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/init/reset_db_with_seed.sh b/security-admin/db/mysql/init/reset_db_with_seed.sh
new file mode 100755
index 0000000..5670922
--- /dev/null
+++ b/security-admin/db/mysql/init/reset_db_with_seed.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [ $# -ne 3 ]; then
+ echo "Usage: $0 <db_user> <db_password> <db_database> [db_host]"
+ exit 1
+fi
+
+db_user=$1
+db_password=$2
+db_database=$3
+
+#db_user=cignifi
+#db_password=cignifi
+#db_database=cignifi_dev
+
+
+set -x
+#First drop the database and recreate i
+echo "y" | mysqladmin -u $db_user -p$db_password drop $db_database
+mysqladmin -u $db_user -p$db_password create $db_database
+
+#Create the schema
+mysql -u $db_user -p$db_password $db_database < schema_mysql.sql
+
+#Add seed users
+mysql -u $db_user -p$db_password $db_database < mysql_seed_data.sql
+
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/init/schema_mysql.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/init/schema_mysql.sql b/security-admin/db/mysql/init/schema_mysql.sql
new file mode 100644
index 0000000..1dd7420
--- /dev/null
+++ b/security-admin/db/mysql/init/schema_mysql.sql
@@ -0,0 +1,490 @@
+-- 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.
+
+
+SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
+SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
+SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
+
+drop table if exists x_db_base;
+create table x_db_base (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_auth_sess;
+create table x_auth_sess (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ login_id VARCHAR (767) NOT NULL,
+ user_id BIGINT ,
+ ext_sess_id VARCHAR (512) ,
+ auth_time DATETIME NOT NULL,
+ auth_status INT NOT NULL DEFAULT 0,
+ auth_type INT NOT NULL DEFAULT 0,
+ auth_provider INT NOT NULL DEFAULT 0,
+ device_type INT NOT NULL DEFAULT 0,
+ req_ip VARCHAR (48) NOT NULL,
+ req_ua VARCHAR (1024) ,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_portal_user;
+create table x_portal_user (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ first_name VARCHAR (1022) ,
+ last_name VARCHAR (1022) ,
+ pub_scr_name VARCHAR (2048) ,
+ login_id VARCHAR (767) ,
+ password VARCHAR (512) NOT NULL,
+ email VARCHAR (512) ,
+ status INT NOT NULL DEFAULT 0,
+ user_src INT NOT NULL DEFAULT 0,
+ notes VARCHAR (4000) ,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_portal_user_role;
+create table x_portal_user_role (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ user_id BIGINT NOT NULL,
+ user_role VARCHAR (128) ,
+ status INT NOT NULL DEFAULT 0,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_asset;
+create table x_asset (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ asset_name VARCHAR (1024) NOT NULL,
+ descr VARCHAR (4000) NOT NULL,
+ act_status INT NOT NULL DEFAULT 0,
+ asset_type INT NOT NULL DEFAULT 0,
+ config TEXT ,
+ sup_native TINYINT (1) NOT NULL DEFAULT 0,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_resource;
+create table x_resource (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ res_name VARCHAR (4000) ,
+ descr VARCHAR (4000) ,
+ res_type INT NOT NULL DEFAULT 0,
+ asset_id BIGINT NOT NULL,
+ parent_id BIGINT ,
+ parent_path VARCHAR (4000) ,
+ is_encrypt INT NOT NULL DEFAULT 0,
+ is_recursive INT NOT NULL DEFAULT 0,
+ res_group VARCHAR (1024) ,
+ res_dbs TEXT ,
+ res_tables TEXT ,
+ res_col_fams TEXT ,
+ res_cols TEXT ,
+ res_udfs TEXT ,
+ res_status INT NOT NULL DEFAULT 1,
+ table_type INT NOT NULL DEFAULT 0,
+ col_type INT NOT NULL DEFAULT 0,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_cred_store;
+create table x_cred_store (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ store_name VARCHAR (1024) NOT NULL,
+ descr VARCHAR (4000) NOT NULL,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_group;
+create table x_group (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ group_name VARCHAR (1024) NOT NULL,
+ descr VARCHAR (4000) NOT NULL,
+ status INT NOT NULL DEFAULT 0,
+ group_type INT NOT NULL DEFAULT 0,
+ cred_store_id BIGINT ,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_user;
+create table x_user (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ user_name VARCHAR (1024) NOT NULL,
+ descr VARCHAR (4000) NOT NULL,
+ status INT NOT NULL DEFAULT 0,
+ cred_store_id BIGINT ,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_group_users;
+create table x_group_users (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ group_name VARCHAR (1024) NOT NULL,
+ p_group_id BIGINT ,
+ user_id BIGINT ,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_group_groups;
+create table x_group_groups (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ group_name VARCHAR (1024) NOT NULL,
+ p_group_id BIGINT ,
+ group_id BIGINT ,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_perm_map;
+create table x_perm_map (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ perm_group VARCHAR (1024) ,
+ res_id BIGINT ,
+ group_id BIGINT ,
+ user_id BIGINT ,
+ perm_for INT NOT NULL DEFAULT 0,
+ perm_type INT NOT NULL DEFAULT 0,
+ is_recursive INT NOT NULL DEFAULT 0,
+ is_wild_card TINYINT (1) NOT NULL DEFAULT 1,
+ grant_revoke TINYINT (1) NOT NULL DEFAULT 1,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_audit_map;
+create table x_audit_map (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ res_id BIGINT ,
+ group_id BIGINT ,
+ user_id BIGINT ,
+ audit_type INT NOT NULL DEFAULT 0,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_policy_export_audit;
+create table x_policy_export_audit (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ client_ip VARCHAR (255) NOT NULL,
+ agent_id VARCHAR (255) ,
+ req_epoch BIGINT NOT NULL,
+ last_updated DATETIME ,
+ repository_name VARCHAR (1024) ,
+ exported_json TEXT ,
+ http_ret_code INT NOT NULL DEFAULT 0,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists x_trx_log;
+create table x_trx_log (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ class_type INT NOT NULL DEFAULT 0,
+ object_id BIGINT ,
+ parent_object_id BIGINT ,
+ parent_object_class_type INT NOT NULL DEFAULT 0,
+ parent_object_name VARCHAR (1024) ,
+ object_name VARCHAR (1024) ,
+ attr_name VARCHAR (255) ,
+ prev_val VARCHAR (1024) ,
+ new_val VARCHAR (1024) ,
+ trx_id VARCHAR (1024) ,
+ action VARCHAR (255) ,
+ sess_id VARCHAR (512) ,
+ req_id VARCHAR (30) ,
+ sess_type VARCHAR (30) ,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+drop table if exists xa_access_audit;
+create table xa_access_audit (
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ create_time DATETIME ,
+ update_time DATETIME ,
+ added_by_id BIGINT ,
+ upd_by_id BIGINT ,
+ audit_type INT NOT NULL DEFAULT 0,
+ access_result INT DEFAULT 0,
+ access_type VARCHAR (255) ,
+ acl_enforcer VARCHAR (255) ,
+ agent_id VARCHAR (255) ,
+ client_ip VARCHAR (255) ,
+ client_type VARCHAR (255) ,
+ policy_id BIGINT DEFAULT 0,
+ repo_name VARCHAR (255) ,
+ repo_type INT DEFAULT 0,
+ result_reason VARCHAR (255) ,
+ session_id VARCHAR (255) ,
+ event_time DATETIME ,
+ request_user VARCHAR (255) ,
+ action VARCHAR (2000) ,
+ request_data VARCHAR (2000) ,
+ resource_path VARCHAR (2000) ,
+ resource_type VARCHAR (255) ,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+ALTER TABLE x_db_base ADD (
+ CONSTRAINT x_db_base_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_db_base ADD (
+ CONSTRAINT x_db_base_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_auth_sess ADD (
+ CONSTRAINT x_auth_sess_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_auth_sess ADD (
+ CONSTRAINT x_auth_sess_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_auth_sess ADD (
+ CONSTRAINT x_auth_sess_FK_user_id FOREIGN KEY (user_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_portal_user ADD (
+ CONSTRAINT x_portal_user_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_portal_user ADD (
+ CONSTRAINT x_portal_user_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_portal_user_role ADD (
+ CONSTRAINT x_portal_user_role_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_portal_user_role ADD (
+ CONSTRAINT x_portal_user_role_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_portal_user_role ADD (
+ CONSTRAINT x_portal_user_role_FK_user_id FOREIGN KEY (user_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_asset ADD (
+ CONSTRAINT x_asset_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_asset ADD (
+ CONSTRAINT x_asset_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_resource ADD (
+ CONSTRAINT x_resource_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_resource ADD (
+ CONSTRAINT x_resource_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_resource ADD (
+ CONSTRAINT x_resource_FK_asset_id FOREIGN KEY (asset_id)
+ REFERENCES x_asset (id));
+ALTER TABLE x_resource ADD (
+ CONSTRAINT x_resource_FK_parent_id FOREIGN KEY (parent_id)
+ REFERENCES x_resource (id));
+ALTER TABLE x_cred_store ADD (
+ CONSTRAINT x_cred_store_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_cred_store ADD (
+ CONSTRAINT x_cred_store_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_group ADD (
+ CONSTRAINT x_group_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_group ADD (
+ CONSTRAINT x_group_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_group ADD (
+ CONSTRAINT x_group_FK_cred_store_id FOREIGN KEY (cred_store_id)
+ REFERENCES x_cred_store (id));
+ALTER TABLE x_user ADD (
+ CONSTRAINT x_user_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_user ADD (
+ CONSTRAINT x_user_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_user ADD (
+ CONSTRAINT x_user_FK_cred_store_id FOREIGN KEY (cred_store_id)
+ REFERENCES x_cred_store (id));
+ALTER TABLE x_group_users ADD (
+ CONSTRAINT x_group_users_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_group_users ADD (
+ CONSTRAINT x_group_users_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_group_users ADD (
+ CONSTRAINT x_group_users_FK_p_group_id FOREIGN KEY (p_group_id)
+ REFERENCES x_group (id));
+ALTER TABLE x_group_users ADD (
+ CONSTRAINT x_group_users_FK_user_id FOREIGN KEY (user_id)
+ REFERENCES x_user (id));
+ALTER TABLE x_group_groups ADD (
+ CONSTRAINT x_group_groups_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_group_groups ADD (
+ CONSTRAINT x_group_groups_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_group_groups ADD (
+ CONSTRAINT x_group_groups_FK_p_group_id FOREIGN KEY (p_group_id)
+ REFERENCES x_group (id));
+ALTER TABLE x_group_groups ADD (
+ CONSTRAINT x_group_groups_FK_group_id FOREIGN KEY (group_id)
+ REFERENCES x_group (id));
+ALTER TABLE x_perm_map ADD (
+ CONSTRAINT x_perm_map_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_perm_map ADD (
+ CONSTRAINT x_perm_map_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_perm_map ADD (
+ CONSTRAINT x_perm_map_FK_res_id FOREIGN KEY (res_id)
+ REFERENCES x_resource (id));
+ALTER TABLE x_perm_map ADD (
+ CONSTRAINT x_perm_map_FK_group_id FOREIGN KEY (group_id)
+ REFERENCES x_group (id));
+ALTER TABLE x_perm_map ADD (
+ CONSTRAINT x_perm_map_FK_user_id FOREIGN KEY (user_id)
+ REFERENCES x_user (id));
+ALTER TABLE x_audit_map ADD (
+ CONSTRAINT x_audit_map_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_audit_map ADD (
+ CONSTRAINT x_audit_map_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_audit_map ADD (
+ CONSTRAINT x_audit_map_FK_res_id FOREIGN KEY (res_id)
+ REFERENCES x_resource (id));
+ALTER TABLE x_audit_map ADD (
+ CONSTRAINT x_audit_map_FK_group_id FOREIGN KEY (group_id)
+ REFERENCES x_group (id));
+ALTER TABLE x_audit_map ADD (
+ CONSTRAINT x_audit_map_FK_user_id FOREIGN KEY (user_id)
+ REFERENCES x_user (id));
+ALTER TABLE x_policy_export_audit ADD (
+ CONSTRAINT x_policy_export_audit_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_policy_export_audit ADD (
+ CONSTRAINT x_policy_export_audit_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_trx_log ADD (
+ CONSTRAINT x_trx_log_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE x_trx_log ADD (
+ CONSTRAINT x_trx_log_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE xa_access_audit ADD (
+ CONSTRAINT xa_access_audit_FK_added_by_id FOREIGN KEY (added_by_id)
+ REFERENCES x_portal_user (id));
+ALTER TABLE xa_access_audit ADD (
+ CONSTRAINT xa_access_audit_FK_upd_by_id FOREIGN KEY (upd_by_id)
+ REFERENCES x_portal_user (id));
+
+ALTER TABLE x_portal_user ADD (
+ CONSTRAINT x_portal_user_UK_login_id UNIQUE (login_id(767)) );
+ALTER TABLE x_portal_user ADD (
+ CONSTRAINT x_portal_user_UK_email UNIQUE (email(512)) );
+
+ALTER TABLE x_db_base ADD (INDEX x_db_base_cr_time (create_time));
+ALTER TABLE x_db_base ADD (INDEX x_db_base_up_time (update_time));
+ALTER TABLE x_auth_sess ADD (INDEX x_auth_sess_cr_time (create_time));
+ALTER TABLE x_auth_sess ADD (INDEX x_auth_sess_up_time (update_time));
+ALTER TABLE x_portal_user ADD (INDEX x_portal_user_cr_time (create_time));
+ALTER TABLE x_portal_user ADD (INDEX x_portal_user_up_time (update_time));
+ALTER TABLE x_portal_user ADD (INDEX x_portal_user_name (first_name(767)));
+ALTER TABLE x_portal_user ADD (INDEX x_portal_user_email (email(512)));
+ALTER TABLE x_portal_user_role ADD (INDEX x_portal_user_role_cr_time (create_time));
+ALTER TABLE x_portal_user_role ADD (INDEX x_portal_user_role_up_time (update_time));
+ALTER TABLE x_asset ADD (INDEX x_asset_cr_time (create_time));
+ALTER TABLE x_asset ADD (INDEX x_asset_up_time (update_time));
+ALTER TABLE x_resource ADD (INDEX x_resource_cr_time (create_time));
+ALTER TABLE x_resource ADD (INDEX x_resource_up_time (update_time));
+ALTER TABLE x_cred_store ADD (INDEX x_cred_store_cr_time (create_time));
+ALTER TABLE x_cred_store ADD (INDEX x_cred_store_up_time (update_time));
+ALTER TABLE x_group ADD (INDEX x_group_cr_time (create_time));
+ALTER TABLE x_group ADD (INDEX x_group_up_time (update_time));
+ALTER TABLE x_user ADD (INDEX x_user_cr_time (create_time));
+ALTER TABLE x_user ADD (INDEX x_user_up_time (update_time));
+ALTER TABLE x_group_users ADD (INDEX x_group_users_cr_time (create_time));
+ALTER TABLE x_group_users ADD (INDEX x_group_users_up_time (update_time));
+ALTER TABLE x_group_groups ADD (INDEX x_group_groups_cr_time (create_time));
+ALTER TABLE x_group_groups ADD (INDEX x_group_groups_up_time (update_time));
+ALTER TABLE x_perm_map ADD (INDEX x_perm_map_cr_time (create_time));
+ALTER TABLE x_perm_map ADD (INDEX x_perm_map_up_time (update_time));
+ALTER TABLE x_audit_map ADD (INDEX x_audit_map_cr_time (create_time));
+ALTER TABLE x_audit_map ADD (INDEX x_audit_map_up_time (update_time));
+ALTER TABLE x_policy_export_audit ADD (INDEX x_policy_export_audit_cr_time (create_time));
+ALTER TABLE x_policy_export_audit ADD (INDEX x_policy_export_audit_up_time (update_time));
+ALTER TABLE x_trx_log ADD (INDEX x_trx_log_cr_time (create_time));
+ALTER TABLE x_trx_log ADD (INDEX x_trx_log_up_time (update_time));
+ALTER TABLE xa_access_audit ADD (INDEX xa_access_audit_cr_time (create_time));
+ALTER TABLE xa_access_audit ADD (INDEX xa_access_audit_up_time (update_time));
+SET SQL_MODE=@OLD_SQL_MODE;
+SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
+SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
+##champlain changes
+ALTER TABLE `x_group` ADD `group_src` INT NOT NULL DEFAULT 0;
+ALTER TABLE `x_resource` ADD `policy_name` VARCHAR( 500 ) NULL DEFAULT NULL;
+ALTER TABLE `x_resource` ADD UNIQUE `x_resource_UK_policy_name` ( `policy_name` );
+ALTER TABLE `x_resource` ADD `res_topologies` TEXT NULL DEFAULT NULL ;
+ALTER TABLE `x_resource` ADD `res_services` TEXT NULL DEFAULT NULL;
+ALTER TABLE `x_perm_map` ADD `ip_address` TEXT NULL DEFAULT NULL;
+ALTER TABLE `x_asset` CHANGE `config` `config` LONGTEXT NULL DEFAULT NULL ;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/001-groupsource.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/001-groupsource.sql b/security-admin/db/mysql/patches/001-groupsource.sql
new file mode 100644
index 0000000..c49d8cb
--- /dev/null
+++ b/security-admin/db/mysql/patches/001-groupsource.sql
@@ -0,0 +1,34 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+ drop procedure if exists add_group_source_column_to_x_group_table;
+
+delimiter ;;
+ create procedure add_group_source_column_to_x_group_table() begin
+
+ /* add group source column if not exist */
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_group') then
+ if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_group' and column_name = 'group_src') then
+ ALTER TABLE `x_group` ADD `group_src` INT NOT NULL DEFAULT 0;
+ end if;
+ end if;
+
+end;;
+
+delimiter ;
+
+ call add_group_source_column_to_x_group_table();
+
+ drop procedure if exists add_group_source_column_to_x_group_table;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/002-policyname.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/002-policyname.sql b/security-admin/db/mysql/patches/002-policyname.sql
new file mode 100644
index 0000000..35927f5
--- /dev/null
+++ b/security-admin/db/mysql/patches/002-policyname.sql
@@ -0,0 +1,37 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+drop procedure if exists add_policy_name_column_to_x_resource_table;
+
+delimiter ;;
+create procedure add_policy_name_column_to_x_resource_table() begin
+
+ /* add policy name column if not exist */
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource') then
+ if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource' and column_name = 'policy_name') then
+ ALTER TABLE `x_resource` ADD `policy_name` VARCHAR( 500 ) NULL DEFAULT NULL;
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource' and column_name = 'policy_name') then
+ ALTER TABLE `x_resource` ADD UNIQUE `x_resource_UK_policy_name` ( `policy_name` );
+ end if;
+ end if;
+ end if;
+
+
+end;;
+
+delimiter ;
+call add_policy_name_column_to_x_resource_table();
+
+drop procedure if exists add_policy_name_column_to_x_resource_table;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/003-knoxrepo.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/003-knoxrepo.sql b/security-admin/db/mysql/patches/003-knoxrepo.sql
new file mode 100644
index 0000000..04c050a
--- /dev/null
+++ b/security-admin/db/mysql/patches/003-knoxrepo.sql
@@ -0,0 +1,48 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+drop procedure if exists add_columns_for_knox_repository;
+
+delimiter ;;
+create procedure add_columns_for_knox_repository() begin
+
+ /* add res_topologies if not exist */
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource') then
+ if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource' and column_name = 'res_topologies') then
+ ALTER TABLE `x_resource` ADD `res_topologies` TEXT NULL DEFAULT NULL ;
+ end if;
+ end if;
+
+ /* add res_services if not exist */
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource') then
+ if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_resource' and column_name = 'res_services') then
+ ALTER TABLE `x_resource` ADD `res_services` TEXT NULL DEFAULT NULL;
+ end if;
+ end if;
+
+ /* add ip_address if not exist */
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_perm_map') then
+ if not exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_perm_map' and column_name = 'ip_address') then
+ ALTER TABLE `x_perm_map` ADD `ip_address` TEXT NULL DEFAULT NULL;
+ end if;
+ end if;
+
+
+end;;
+
+delimiter ;
+call add_columns_for_knox_repository();
+
+drop procedure if exists add_columns_for_knox_repository;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/004-assetconfigsize.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/004-assetconfigsize.sql b/security-admin/db/mysql/patches/004-assetconfigsize.sql
new file mode 100644
index 0000000..bec992b
--- /dev/null
+++ b/security-admin/db/mysql/patches/004-assetconfigsize.sql
@@ -0,0 +1,31 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+drop procedure if exists change_config_column_datatype_of_x_asset_table;
+
+delimiter ;;
+create procedure change_config_column_datatype_of_x_asset_table() begin
+
+ /* change config data type to longtext if not exist */
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_asset' and column_name = 'config' and data_type='text') then
+ ALTER TABLE `x_asset` CHANGE `config` `config` MEDIUMTEXT NULL DEFAULT NULL ;
+ end if;
+
+end;;
+
+delimiter ;
+call change_config_column_datatype_of_x_asset_table();
+
+drop procedure if exists change_config_column_datatype_of_x_asset_table;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/mysql/patches/005-xtrxlogcolumnsize.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/005-xtrxlogcolumnsize.sql b/security-admin/db/mysql/patches/005-xtrxlogcolumnsize.sql
new file mode 100644
index 0000000..4ec9a6d
--- /dev/null
+++ b/security-admin/db/mysql/patches/005-xtrxlogcolumnsize.sql
@@ -0,0 +1,34 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+drop procedure if exists change_values_columns_datatype_of_x_trx_log_table;
+
+delimiter ;;
+create procedure change_values_columns_datatype_of_x_trx_log_table() begin
+
+ /* change prev_value column data type to mediumtext */
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_trx_log' and column_name = 'prev_val' and data_type='varchar') then
+ ALTER TABLE `x_trx_log` CHANGE `prev_val` `prev_val` MEDIUMTEXT NULL DEFAULT NULL ;
+ end if;
+ if exists (select * from information_schema.columns where table_schema=database() and table_name = 'x_trx_log' and column_name = 'new_val' and data_type='varchar') then
+ ALTER TABLE `x_trx_log` CHANGE `new_val` `new_val` MEDIUMTEXT NULL DEFAULT NULL ;
+ end if;
+
+end;;
+
+delimiter ;
+call change_values_columns_datatype_of_x_trx_log_table();
+
+drop procedure if exists change_values_columns_datatype_of_x_trx_log_table;
[2/5] incubator-ranger git commit: RANGER-239: Support JDBC based SQL
invocation for setup process
Posted by ve...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/patches/007-updateBlankPolicyName.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/patches/007-updateBlankPolicyName.sql b/security-admin/db/patches/007-updateBlankPolicyName.sql
deleted file mode 100644
index d251bc2..0000000
--- a/security-admin/db/patches/007-updateBlankPolicyName.sql
+++ /dev/null
@@ -1,186 +0,0 @@
--- 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.
-
--- --------------------------------------------------------------------------------
--- Function which will return tempPolicyCount
--- which is being used by SP updateBlankPolicyName()
--- --------------------------------------------------------------------------------
-DELIMITER $$
-
-DROP FUNCTION if exists getTempPolicyCount $$
-CREATE FUNCTION `getTempPolicyCount`(assetId bigint, resId bigint) RETURNS int(11)
-BEGIN
-
-DECLARE tempPolicyCount int default 1;
-DECLARE dbResourceId bigint;
-DECLARE exitLoop int DEFAULT FALSE;
-
-DECLARE policyList CURSOR FOR
- SELECT id from x_resource where asset_id = assetId;
-
-DECLARE CONTINUE HANDLER FOR NOT FOUND SET exitLoop = true;
-OPEN policyList;
-readPolicy : LOOP
- FETCH policyList into dbResourceId;
-
- IF exitLoop THEN
- set tempPolicyCount = tempPolicyCount + 1;
- LEAVE readPolicy;
- END IF;
-
- IF (resId = dbResourceId) THEN
- LEAVE readPolicy;
- END IF;
- set tempPolicyCount = tempPolicyCount + 1;
-
-END LOOP;
-CLOSE policyList;
-
-RETURN tempPolicyCount;
-END $$
-
-
--- --------------------------------------------------------------------------------
--- Procedure that will generate policy name of policies
--- which were previously created without policy_name
--- --------------------------------------------------------------------------------
-DELIMITER $$
-
-DROP PROCEDURE if exists updateBlankPolicyName $$
-CREATE PROCEDURE `updateBlankPolicyName`()
-BEGIN
-
-DECLARE done INT;
-DECLARE resId bigint;
-DECLARE assetId bigint;
-DECLARE assetName varchar(512);
-DECLARE genPolicyName varchar(1000);
-DECLARE existPolId varchar(1000);
-DECLARE policyCount bigint;
-DECLARE currentTime varchar(100);
-DECLARE tempPolicyCount int;
-DECLARE totalPolicyCount int;
-DECLARE resourceName varchar(4000);
-
--- TrxLog fields
-DECLARE createTime datetime;
-DECLARE addedById bigint;
-DECLARE classType int;
-DECLARE objId bigint;
-DECLARE parentObjId bigint;
-DECLARE parentObjClsType int;
-DECLARE parentObjName varchar(1024);
-DECLARE objName varchar(1024);
-DECLARE attrName varchar(255);
-DECLARE prevVal varchar(1024);
-DECLARE newVal varchar(1024);
-DECLARE trxId varchar(1024);
-DECLARE act varchar(255);
-DECLARE sessType varchar(30);
-DECLARE assetTypeInt int;
-DECLARE assetType varchar(50);
-DECLARE transId varchar(50);
-
-DECLARE policyList CURSOR FOR
- select id,asset_id, res_name from x_resource res
- where res.policy_name is null or res.policy_name = '';
-
-DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
-OPEN policyList;
-
- SET done = 0;
-
- iLoop : LOOP
-
- FETCH policyList into resId, assetId, resourceName;
-
- set assetTypeInt = (select asset_type from x_asset where id = assetId);
-
- if (assetTypeInt = 1) then
- set assetType = 'HDFS';
- elseif (assetTypeInt = 2) then
- set assetType = 'HBase';
- elseif ((assetTypeInt = 3)) then
- set assetType = 'Hive';
- elseif (assetTypeInt = 4) then
- set assetType = 'XAAGENT';
- elseif (assetTypeInt = 5) then
- set assetType = 'Knox';
- elseif (assetTypeInt = 6) then
- set assetType = 'Storm';
- end if;
-
- set totalPolicyCount = (select count(*) from x_resource where asset_id = assetId);
- set assetName = (select asset_name from x_asset asset where asset.id = assetId);
-
- set tempPolicyCount = getTempPolicyCount(assetId, resId);
- set currentTime = DATE_FORMAT(utc_timestamp(), "%Y%m%d%H%i%s");
-
- set genPolicyName = concat(assetName, '-', tempPolicyCount, '-', currentTime);
- set existPolId = (select id from x_resource where policy_name = genPolicyName);
-
- if (existPolId != '') then
- set genPolicyName = concat(assetName, '-', totalPolicyCount, '-', currentTime);
- end if;
-
- if(done = 1) then
- LEAVE iLoop;
- end if;
-
- UPDATE x_resource set policy_name = genPolicyName where id = resId;
-
- -- Creating Trx Log
- set createTime = utc_timestamp();
- set addedById = 1;
- set classType = 1001;
- set objId = resId;
- set parentObjId = assetId;
- set parentObjClsType = 1000;
- set objName = resourceName;
- set attrName = 'Policy Name';
- set prevVal = null;
- set newVal = genPolicyName;
- set act = 'update';
- set sessType = 'DB Script';
- set parentObjName = assetName;
-
- set transId = concat(DATE_FORMAT(utc_timestamp(), "%Y%m%d%H%i%s"), '_', rand());
-
- insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
- class_type, object_id, parent_object_id, parent_object_class_type,
- parent_object_name, object_name, attr_name, prev_val, new_val, `action`,
- trx_id, sess_type)
- values(createTime, createTime, addedById, addedById, classType, objId,
- parentObjId, parentObjClsType, parentObjName, objName, attrName, prevVal,
- newVal, act, transId, sessType);
-
- insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
- class_type, object_id, parent_object_id, parent_object_class_type,
- parent_object_name, object_name, attr_name, prev_val, new_val, `action`,
- trx_id, sess_type)
- values(createTime, createTime, addedById, addedById, classType, objId,
- parentObjId, parentObjClsType, parentObjName, objName, 'Repository Type', prevVal,
- assetType, act, transId, sessType);
-
- END LOOP;
-
-CLOSE policyList;
-
-END $$
-DELIMITER ;
-call updateBlankPolicyName();
-
-DROP FUNCTION if exists getTempPolicyCount;
-DROP PROCEDURE if exists updateBlankPolicyName;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/patches/008-removeTrailingSlash.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/patches/008-removeTrailingSlash.sql b/security-admin/db/patches/008-removeTrailingSlash.sql
deleted file mode 100644
index 2e00f5f..0000000
--- a/security-admin/db/patches/008-removeTrailingSlash.sql
+++ /dev/null
@@ -1,144 +0,0 @@
--- 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.
-
--- --------------------------------------------------------------------------------
--- Routine DDL
--- Note: comments before and after the routine body will not be stored by the server
--- --------------------------------------------------------------------------------
-DELIMITER $$
-
-DROP FUNCTION if exists removeTrailingSlash $$
-CREATE FUNCTION `removeTrailingSlash`(resName varchar(4000), resId bigint, assetId bigint, policyName varchar(1000)) RETURNS varchar(4000) CHARSET latin1
-BEGIN
-
-DECLARE noOfCommas int;
-DECLARE updatedResName varchar(4000) default '';
-DECLARE resource varchar(1000);
-DECLARE count int default 0;
-DECLARE proceedLoop boolean default true;
-
--- TrxLog fields
-DECLARE createTime datetime;
-DECLARE addedById bigint;
-DECLARE classType int;
-DECLARE objId bigint;
-DECLARE parentObjId bigint;
-DECLARE parentObjClsType int;
-DECLARE parentObjName varchar(1024);
-DECLARE objName varchar(1024);
-DECLARE attrName varchar(255);
-DECLARE prevVal varchar(1024);
-DECLARE newVal varchar(1024);
-DECLARE trxId varchar(1024);
-DECLARE act varchar(255);
-DECLARE sessType varchar(30);
-DECLARE transId varchar(50);
-DECLARE assetTypeInt int;
-DECLARE assetType varchar(30);
-
-set noOfCommas = (LENGTH(resName)-LENGTH(REPLACE (resName, ",", "")));
-set assetTypeInt = (select asset_type from x_asset where id = assetId);
-
- if (assetTypeInt = 1) then
- set assetType = 'HDFS';
- elseif (assetTypeInt = 2) then
- set assetType = 'HBase';
- elseif ((assetTypeInt = 3)) then
- set assetType = 'Hive';
- elseif (assetTypeInt = 4) then
- set assetType = 'XAAGENT';
- elseif (assetTypeInt = 5) then
- set assetType = 'Knox';
- elseif (assetTypeInt = 6) then
- set assetType = 'Storm';
- end if;
-
-WHILE proceedLoop DO
- set count = count +1;
-
- if (count > noOfCommas) then
- set resource = SUBSTRING_INDEX(resName, ',', -1);
- set proceedLoop = false;
- else
- set resource = REPLACE(SUBSTRING(SUBSTRING_INDEX(resName, ',', count),
- LENGTH(SUBSTRING_INDEX(resName, ',', count -1)) + 1), ',', '');
- end if;
-
- if (LENGTH(resource) > 1 && SUBSTRING(resource, -(LENGTH(resource)-(LENGTH(resource)-1))) = '/') then
- set resource = SUBSTRING(resource, 1, (LENGTH(resource)-1));
- else
- set resource = resource;
- end if;
-
- if(updatedResName != '') then
- set updatedResName = CONCAT(updatedResName, ',', resource);
- else
- set updatedResName = resource;
- end if;
-
-END WHILE;
-
-if (updatedResName != resName) then
--- Generating Trx Log if value has been updated.
-
-set createTime = utc_timestamp();
-set addedById = 1;
-set classType = 1001;
-set objId = resId;
-set parentObjId = assetId;
-set parentObjClsType = 1000;
-set objName = updatedResName;
-set attrName = 'Resource Path';
-set prevVal = resName;
-set newVal = updatedResName;
-set act = 'update';
-set sessType = 'DB Script';
-
-set parentObjName = (select asset_name from x_asset where id = assetId);
-set transId = concat(DATE_FORMAT(utc_timestamp(), "%Y%m%d%H%i%s"), '_', rand());
-
-insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
- class_type, object_id, parent_object_id, parent_object_class_type,
- parent_object_name, object_name, attr_name, prev_val, new_val, `action`,
- trx_id, sess_type)
- values(createTime, createTime, addedById, addedById, classType, objId,
- parentObjId, parentObjClsType, parentObjName, objName, attrName, prevVal,
- newVal, act, transId, sessType);
-
-insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
- class_type, object_id, parent_object_id, parent_object_class_type,
- parent_object_name, object_name, attr_name, prev_val, new_val, `action`,
- trx_id, sess_type)
- values(createTime, createTime, addedById, addedById, classType, objId,
- parentObjId, parentObjClsType, parentObjName, objName, 'Policy Name', policyName,
- policyName, act, transId, sessType);
-
-insert into x_trx_log (create_time, update_time, added_by_id, upd_by_id,
- class_type, object_id, parent_object_id, parent_object_class_type,
- parent_object_name, object_name, attr_name, new_val, `action`,
- trx_id, sess_type)
- values(createTime, createTime, addedById, addedById, classType, objId,
- parentObjId, parentObjClsType, parentObjName, objName, 'Repository Type',
- assetType, act, transId, sessType);
-
-end if;
-
-RETURN updatedResName;
-END $$
-DELIMITER ;
-UPDATE x_resource res, x_asset asset set res_name = removeTrailingSlash(res.res_name, res.id, res.asset_id, res.policy_name)
- WHERE asset.asset_type = 1 and asset.id = res.asset_id;
-
-DROP FUNCTION if exists removeTrailingSlash;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/patches/009-updated_schema.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/patches/009-updated_schema.sql b/security-admin/db/patches/009-updated_schema.sql
deleted file mode 100644
index 401a1dc..0000000
--- a/security-admin/db/patches/009-updated_schema.sql
+++ /dev/null
@@ -1,419 +0,0 @@
--- 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.
-
--- Temporary table structure for view `vx_trx_log`
---
-
-DROP TABLE IF EXISTS `x_service_def`;
-CREATE TABLE `x_service_def` (
-`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,
-`version` bigint(20) DEFAULT NULL,
-`name` varchar(1024) DEFAULT NULL,
-`impl_class_name` varchar(1024) DEFAULT NULL,
-`label` varchar(1024) DEFAULT NULL,
-`description` varchar(1024) DEFAULT NULL,
-`rb_key_label` varchar(1024) DEFAULT NULL,
-`rb_key_description` varchar(1024) DEFAULT NULL,
-`is_enabled` tinyint DEFAULT 1,
-primary key (`id`),
-KEY `x_service_def_added_by_id` (`added_by_id`),
-KEY `x_service_def_upd_by_id` (`upd_by_id`),
-KEY `x_service_def_cr_time` (`create_time`),
-KEY `x_service_def_up_time` (`update_time`),
-CONSTRAINT `x_service_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_service_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-
-DROP TABLE IF EXISTS `x_service`;
-CREATE TABLE `x_service` (
-`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,
-`version` bigint(20) DEFAULT NULL,
-`type` bigint(20) DEFAULT NULL,
-`name` varchar(512) DEFAULT NULL,
-`policy_version` bigint(20) DEFAULT NULL,
-`policy_update_time`datetime DEFAULT NULL,
-`description` varchar(1024) DEFAULT NULL,
-`is_enabled` tinyint(1) NOT NULL DEFAULT '0',
-primary key (`id`),
-UNIQUE KEY `X_service_name` (`name`),
-KEY `x_service_added_by_id` (`added_by_id`),
-KEY `x_service_upd_by_id` (`upd_by_id`),
-KEY `x_service_cr_time` (`create_time`),
-KEY `x_service_up_time` (`update_time`),
-KEY `x_service_type` (`type`),
-CONSTRAINT `x_service_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_service_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_service_FK_type` FOREIGN KEY (`type`) REFERENCES `x_service_def` (`id`)
-);
-
-DROP TABLE IF EXISTS `x_policy`;
-CREATE TABLE `x_policy` (
-`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,
-`version` bigint(20) DEFAULT NULL,
-`service` bigint(20) DEFAULT NULL,
-`name` varchar(512) DEFAULT NULL,
-`description` varchar(1024) DEFAULT NULL,
-`is_enabled` tinyint(1) NOT NULL DEFAULT '0',
-`is_audit_enabled` tinyint(1) NOT NULL DEFAULT '0',
-primary key (`id`),
-UNIQUE KEY `x_policy_name` (`name`),
-KEY `x_policy_added_by_id` (`added_by_id`),
-KEY `x_policy_upd_by_id` (`upd_by_id`),
-KEY `x_policy_cr_time` (`create_time`),
-KEY `x_policy_up_time` (`update_time`),
-KEY `x_policy_service` (`service`),
-CONSTRAINT `x_policy_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_FK_service` FOREIGN KEY (`service`) REFERENCES `x_service` (`id`)
-);
-
-
-DROP TABLE IF EXISTS `x_service_config_def`;
-CREATE TABLE `x_service_config_def` (
-`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,
-`def_id` bigint(20) NOT NULL,
-`name` varchar(1024) DEFAULT NULL,
-`type` varchar(1024) DEFAULT NULL,
-`sub_type` varchar(1024) DEFAULT NULL,
-`is_mandatory` tinyint(1) NOT NULL DEFAULT '0',
-`default_value` varchar(1024) DEFAULT NULL,
-`label` varchar(1024) DEFAULT NULL,
-`description` varchar(1024) DEFAULT NULL,
-`rb_key_label` varchar(1024) DEFAULT NULL,
-`rb_key_decription` varchar(1024) DEFAULT NULL,
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (`id`),
-CONSTRAINT `x_service_config_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
-CONSTRAINT `x_service_config_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_service_config_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-
-DROP TABLE IF EXISTS `x_resource_def`;
-CREATE TABLE `x_resource_def` (
-`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,
-`def_id` bigint(20) NOT NULL,
-`name` varchar(1024) DEFAULT NULL,
-`type` varchar(1024) DEFAULT NULL,
-`level` bigint(20) DEFAULT NULL,
-`parent` bigint(20) DEFAULT NULL,
-`mandatory` tinyint(1) NOT NULL DEFAULT '0',
-`look_up_supported` tinyint(1) NOT NULL DEFAULT '0',
-`recursive_supported` tinyint(1) NOT NULL DEFAULT '0',
-`excludes_supported` tinyint(1) NOT NULL DEFAULT '0',
-`matcher` varchar(1024) DEFAULT NULL,
-`matcher_options` varchar(1024) DEFAULT NULL,
-`label` varchar(1024) DEFAULT NULL,
-`description` varchar(1024) DEFAULT NULL,
-`rb_key_label` varchar(1024) DEFAULT NULL,
-`rb_key_description` varchar(1024) DEFAULT NULL,
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (`id`),
-KEY `x_resource_def_FK_parent` (`parent`),
-CONSTRAINT `x_resource_def_FK_parent` FOREIGN KEY (`parent`) REFERENCES `x_resource_def` (`id`) ,
-CONSTRAINT `x_resource_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
-CONSTRAINT `x_resource_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_resource_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-DROP TABLE IF EXISTS `x_access_type_def`;
-CREATE TABLE `x_access_type_def` (
-`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,
-`def_id` bigint(20) NOT NULL,
-`name` varchar(1024) DEFAULT NULL,
-`label` varchar(1024) DEFAULT NULL,
-`rb_key_label` varchar(1024) DEFAULT NULL,
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (`id`) ,
-CONSTRAINT `x_access_type_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
-CONSTRAINT `x_access_type_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_access_type_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-DROP TABLE IF EXISTS `x_access_type_def_grants`;
-CREATE TABLE `x_access_type_def_grants` (
-`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,
-`atd_id` bigint(20) NOT NULL,
-`implied_grant` varchar(1024) DEFAULT NULL,
-primary key (`id`),
-CONSTRAINT `x_atd_grants_FK_atdid` FOREIGN KEY (`atd_id`) REFERENCES `x_access_type_def` (`id`),
-CONSTRAINT `x_atd_grants_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_atd_grants_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-DROP TABLE IF EXISTS `x_policy_condition_def`;
-CREATE TABLE `x_policy_condition_def` (
-`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,
-`def_id` bigint(20) NOT NULL,
-`name` varchar(1024) DEFAULT NULL,
-`evaluator` varchar(1024) DEFAULT NULL,
-`evaluator_options` varchar(1024) DEFAULT NULL,
-`label` varchar(1024) DEFAULT NULL,
-`description` varchar(1024) DEFAULT NULL,
-`rb_key_label` varchar(1024) DEFAULT NULL,
-`rb_key_description` varchar(1024) DEFAULT NULL,
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (`id`) ,
-CONSTRAINT `x_policy_condition_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
-CONSTRAINT `x_policy_condition_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_condition_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-DROP TABLE IF EXISTS `x_enum_def`;
-CREATE TABLE `x_enum_def` (
-`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,
-`def_id` bigint(20) NOT NULL,
-`name` varchar(1024) DEFAULT NULL,
-`default_index` bigint(20) DEFAULT NULL,
-primary key (`id`),
-CONSTRAINT `x_enum_def_FK_defid` FOREIGN KEY (`def_id`) REFERENCES `x_service_def` (`id`),
-CONSTRAINT `x_enum_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_enum_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-
-DROP TABLE IF EXISTS `x_enum_element_def`;
-CREATE TABLE `x_enum_element_def` (
-`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,
-`enum_def_id` bigint(20) NOT NULL,
-`name` varchar(1024) DEFAULT NULL,
-`label` varchar(1024) DEFAULT NULL,
-`rb_key_label` varchar(1024) DEFAULT NULL,
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (`id`),
-CONSTRAINT `x_enum_element_def_FK_defid` FOREIGN KEY (`enum_def_id`) REFERENCES `x_enum_def` (`id`),
-CONSTRAINT `x_enum_element_def_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_enum_element_def_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-
-DROP TABLE IF EXISTS `x_service_config_map`;
-CREATE TABLE `x_service_config_map` (
-`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,
-`service` bigint(20) NOT NULL,
-`config_key` varchar(1024) DEFAULT NULL,
-`config_value` varchar(1024) DEFAULT NULL,
-primary key (`id`),
-CONSTRAINT `x_service_config_map_FK_` FOREIGN KEY (`service`) REFERENCES `x_service` (`id`),
-CONSTRAINT `x_service_config_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_service_config_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-
-DROP TABLE IF EXISTS `x_policy_resource`;
-CREATE TABLE `x_policy_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,
-`res_def_id` bigint(20) NOT NULL,
-`is_excludes` tinyint(1) NOT NULL DEFAULT '0',
-`is_recursive` tinyint(1) NOT NULL DEFAULT '0',
-primary key (`id`),
-CONSTRAINT `x_policy_resource_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
-CONSTRAINT `x_policy_resource_FK_res_def_id` FOREIGN KEY (`res_def_id`) REFERENCES `x_resource_def` (`id`),
-CONSTRAINT `x_policy_resource_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_resource_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-
-DROP TABLE IF EXISTS `x_policy_resource_map`;
-CREATE TABLE `x_policy_resource_map` (
-`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,
-`resource_id` bigint(20) NOT NULL,
-`value` varchar(1024) DEFAULT NULL,
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (`id`),
-CONSTRAINT `x_policy_resource_map_FK_resource_id` FOREIGN KEY (`resource_id`) REFERENCES `x_policy_resource` (`id`),
-CONSTRAINT `x_policy_resource_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_resource_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-
-
-DROP TABLE IF EXISTS `x_policy_item`;
-CREATE TABLE `x_policy_item` (
-`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,
-`delegate_admin` tinyint(1) NOT NULL DEFAULT '0',
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (`id`),
-CONSTRAINT `x_policy_item_FK_policy_id` FOREIGN KEY (`policy_id`) REFERENCES `x_policy` (`id`),
-CONSTRAINT `x_policy_item_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_item_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-
-DROP TABLE IF EXISTS `x_policy_item_access`;
-CREATE TABLE `x_policy_item_access` (
-`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_item_id` bigint(20) NOT NULL,
-`type` bigint(20) NOT NULL,
-`is_allowed` tinyint(11) NOT NULL DEFAULT '0',
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (id),
-CONSTRAINT `x_policy_item_access_FK_pi_id` FOREIGN KEY (`policy_item_id`) REFERENCES `x_policy_item` (`id`) ,
-CONSTRAINT `x_policy_item_access_FK_atd_id` FOREIGN KEY (`type`) REFERENCES `x_access_type_def` (`id`),
-CONSTRAINT `x_policy_item_access_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_item_access_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-DROP TABLE IF EXISTS `x_policy_item_condition`;
-CREATE TABLE `x_policy_item_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_item_id` bigint(20) NOT NULL,
-`type` bigint(20) NOT NULL,
-`value` varchar(1024) DEFAULT NULL,
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (id),
-CONSTRAINT `x_policy_item_condition_FK_pi_id` FOREIGN KEY (`policy_item_id`) REFERENCES `x_policy_item` (`id`) ,
-CONSTRAINT `x_policy_item_condition_FK_pcd_id` FOREIGN KEY (`type`) REFERENCES `x_policy_condition_def` (`id`),
-CONSTRAINT `x_policy_item_condition_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_item_condition_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-DROP TABLE IF EXISTS `x_policy_item_user_perm`;
-CREATE TABLE `x_policy_item_user_perm` (
-`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_item_id` bigint(20) NOT NULL,
-`user_id` bigint(20) NULL DEFAULT NULL,
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (`id`),
-CONSTRAINT `x_policy_item_user_perm_FK_pi_id` FOREIGN KEY (`policy_item_id`) REFERENCES `x_policy_item` (`id`) ,
-CONSTRAINT `x_policy_item_user_perm_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`),
-CONSTRAINT `x_policy_item_user_perm_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_item_user_perm_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-
-DROP TABLE IF EXISTS `x_policy_item_group_perm`;
-CREATE TABLE `x_policy_item_group_perm` (
-`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_item_id` bigint(20) NOT NULL,
-`group_id` bigint(20) NULL DEFAULT NULL,
-`sort_order` tinyint(3) DEFAULT '0',
-primary key (`id`),
-CONSTRAINT `x_policy_item_group_perm_FK_pi_id` FOREIGN KEY (`policy_item_id`) REFERENCES `x_policy_item` (`id`) ,
-CONSTRAINT `x_policy_item_group_perm_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
-CONSTRAINT `x_policy_item_group_perm_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
-CONSTRAINT `x_policy_item_group_perm_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-);
-
-DROP TABLE IF EXISTS `x_data_hist`;
-CREATE TABLE `x_data_hist` (
-`id` bigint(20) NOT NULL AUTO_INCREMENT ,
-`create_time` datetime DEFAULT NULL,
-`update_time` datetime DEFAULT NULL,
-`obj_guid` varchar(1024) not null,
-`obj_class_type` int NOT NULL,
-`obj_id` bigint(20) not null,
-`obj_name` varchar(1024) NOT NULL,
-`version` bigint(20) DEFAULT NULL,
-`action` varchar(512) NOT NULL,
-`from_time` datetime NOT NULL,
-`to_time` datetime DEFAULT NULL,
-`content` text NOT NULL,
-primary key (`id`)
-);
-
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/reset_asset.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/reset_asset.sql b/security-admin/db/reset_asset.sql
deleted file mode 100644
index 1d53819..0000000
--- a/security-admin/db/reset_asset.sql
+++ /dev/null
@@ -1,19 +0,0 @@
--- 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.
-
-update x_asset set config = '{"username":"policymgr","password":"policymgr","fs.default.name":"hdfs://sandbox.hortonworks.com:8020","hadoop.security.authorization":"false","hadoop.security.authentication":"simple","hadoop.security.auth_to_local":"RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/ RULE:[2:$1@$0](jhs@.*)s/.*/mapred/ RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/ RULE:[2:$1@$0](hm@.*)s/.*/hbase/ RULE:[2:$1@$0](rs@.*)s/.*/hbase/ DEFAULT","dfs.datanode.kerberos.principal":"","dfs.namenode.kerberos.principal":"","dfs.secondary.namenode.kerberos.principal":"","commonNameForCertificate":""}' where asset_name = 'hadoopdev';
-update x_asset set config = '{"username":"policymgr","password":"policymgr","fs.default.name":"hdfs://sandbox.hortonworks.com:8020","hadoop.security.authorization":"false","hadoop.security.authentication":"simple","hadoop.security.auth_to_local":"RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/ RULE:[2:$1@$0](jhs@.*)s/.*/mapred/ RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/ RULE:[2:$1@$0](hm@.*)s/.*/hbase/ RULE:[2:$1@$0](rs@.*)s/.*/hbase/ DEFAULT","dfs.datanode.kerberos.principal":"","dfs.namenode.kerberos.principal":"","dfs.secondary.namenode.kerberos.principal":"","hbase.master.kerberos.principal":"","hbase.rpc.engine":"org.apache.hadoop.hbase.ipc.SecureRpcEngine","hbase.rpc.protection":"privacy","hbase.security.authentication":"simple","hbase.zookeeper.property.clientPort":"2181","hbase.zookeeper.quorum":"sandbox.hortonworks.com","commonNameForCertificate":""}' where asset_name = 'hbase' ;
-update x_asset set config = '{"username":"policymgr","password":"","jdbc.driverClassName":"org.apache.hive.jdbc.HiveDriver","jdbc.url":"jdbc:hive2://sandbox.hortonworks.com:10000/default","commonNameForCertificate":""}' where asset_name = 'dev-hive' ;
-commit ;
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/reset_audit_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/reset_audit_mysql.sh b/security-admin/db/reset_audit_mysql.sh
deleted file mode 100755
index 51a5359..0000000
--- a/security-admin/db/reset_audit_mysql.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-#
-# Script to reset mysql database
-#
-
-#if [ $# -lt 1 ]; then
-# echo "Usage: $0 <db_root_password> [db_host] <db_name>"
-# exit 1
-#fi
-#
-#db_root_password=$1
-#db_host="localhost"
-#if [ "$2" != "" ]; then
-# db_host="$2"
-#fi
-#db_name="xa_logger"
-#if [ "$3" != "" ]; then
-# db_name="$3"
-#fi
-
-audit_db_user=xaadmin
-audit_db_password=xaadmin
-audit_db_file=xa_audit_db.sql
-audit_db_name=xa_logger
-echo "Importing database file $audit_db_file.sql ... "
-set -x
-mysql -u $audit_db_user --password=$audit_db_password -e "create database IF NOT EXISTS $audit_db_name"
-mysql -u $audit_db_user --password=$audit_db_password --database=$audit_db_name < $audit_db_file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/reset_core_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/reset_core_mysql.sh b/security-admin/db/reset_core_mysql.sh
deleted file mode 100755
index 26f7d46..0000000
--- a/security-admin/db/reset_core_mysql.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-#
-# Script to reset mysql database
-#
-
-#if [ $# -lt 1 ]; then
-# echo "Usage: $0 <db_root_password> [db_host] <db_name>"
-# exit 1
-#fi
-#
-#db_root_password=$1
-#db_host="localhost"
-#if [ "$2" != "" ]; then
-# db_host="$2"
-#fi
-#db_name="xa_db"
-#if [ "$3" != "" ]; then
-# db_name="$3"
-#fi
-
-db_user=xaadmin
-db_password=xaadmin
-db_file=xa_core_db.sql
-db_name=xa_db
-
-echo "Importing database file $db_file.sql ... "
-set -x
-mysql -u $db_user --password=$db_password --database=$db_name < $db_file
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/resetdb_dev_mysql.sh
----------------------------------------------------------------------
diff --git a/security-admin/db/resetdb_dev_mysql.sh b/security-admin/db/resetdb_dev_mysql.sh
deleted file mode 100755
index c2bf5fb..0000000
--- a/security-admin/db/resetdb_dev_mysql.sh
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-#
-# Script to reset mysql database
-#
-
-#if [ $# -lt 1 ]; then
-# echo "Usage: $0 <db_root_password> [db_host]"
-# exit 1
-#fi
-#
-#db_root_password=$1
-#db_host="localhost"
-#if [ "$2" != "" ]; then
-# db_host="$2"
-#fi
-
-db_user=xaadmin
-db_password=xaadmin
-db_file=xa_core_db.sql
-db_core_file=xa_core_db.sql
-db_name=xa_db
-
-MYSQL_BIN='mysql'
-MYSQL_HOST='localhost'
-
-mysqlexec="${MYSQL_BIN} -u ${db_user} --password=${db_password} -h ${MYSQL_HOST} ${db_name}"
-
-
-#echo "Importing database file $db_file ... "
-#set -x
-#mysql -u $db_user --password=$db_password < $db_file
-
-
-log() {
- local prefix="[$(date +%Y/%m/%d\ %H:%M:%S)]: "
- echo "${prefix} $@"
-}
-
-check_ret_status(){
- if [ $1 -ne 0 ]; then
- log "[E] $2";
- exit 1;
- fi
-}
-
-import_db () {
-
- log "[I] Verifying Database: $db_name";
- existdb=`${MYSQL_BIN} -u ${db_user} --password=$db_password -h $MYSQL_HOST -B --skip-column-names -e "show databases like '${db_name}' ;"`
-
- if [ "${existdb}" = "${db_name}" ]
- then
- log "[I] - database ${db_name} already exists. deleting ..."
- $MYSQL_BIN -u $db_user --password=$db_password -h $MYSQL_HOST -e "drop database $db_name"
-
- fi
-
- log "[I] Creating Database: $db_name";
- $MYSQL_BIN -u $db_user --password=$db_password -h $MYSQL_HOST -e "create database $db_name"
- check_ret_status $? "Creating database Failed.."
-
-
- log "[I] Importing Core Database file: $db_core_file "
- $MYSQL_BIN -u $db_user --password=$db_password -h $MYSQL_HOST $db_name < $db_core_file
- check_ret_status $? "Importing Database Failed.."
-
- log "[I] Importing Database file : $db_core_file DONE";
-}
-
-run_patches(){
- log "[I] - starting upgradedb ... "
-
- DBVERSION_CATALOG_CREATION=create_dbversion_catalog.sql
-
- mysqlexec="${MYSQL_BIN} -u ${db_user} --password=${db_password} -h ${MYSQL_HOST} ${db_name}"
-
- if [ -f ${DBVERSION_CATALOG_CREATION} ]
- then
- log "[I] Verifying database version catalog table .... "
- ${mysqlexec} < ${DBVERSION_CATALOG_CREATION}
- fi
-
- dt=`date '+%s'`
- tempFile=/tmp/sql_${dt}_$$.sql
- sqlfiles=`ls -1 patches/*.sql 2> /dev/null | awk -F/ '{ print $NF }' | awk -F- '{ print $1, $0 }' | sort -k1 -n | awk '{ printf("patches/%s\n",$2) ; }'`
- for sql in ${sqlfiles}
- do
- if [ -f ${sql} ]
- then
- bn=`basename ${sql}`
- version=`echo ${bn} | awk -F'-' '{ print $1 }'`
- if [ "${version}" != "" ]
- then
- c=`${mysqlexec} -B --skip-column-names -e "select count(id) from x_db_version_h where version = '${version}' and active = 'Y'"`
- check_ret_status $? "DBVerionCheck - ${version} Failed."
- if [ ${c} -eq 0 ]
- then
- cat ${sql} > ${tempFile}
- echo >> ${tempFile}
- echo "insert into x_db_version_h (version, inst_at, inst_by, updated_at, updated_by) values ( '${version}', now(), user(), now(), user()) ;" >> ${tempFile}
- log "[I] - patch [${version}] is being applied."
- ${mysqlexec} < ${tempFile}
- check_ret_status $? "Update patch - ${version} Failed. See sql file : [${tempFile}]"
- rm -f ${tempFile}
- else
- log "[I] - patch [${version}] is already applied. Skipping ..."
- fi
- fi
- fi
- done
-}
-
-
-import_db
-run_patches
-
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/xa_audit_db.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/xa_audit_db.sql b/security-admin/db/xa_audit_db.sql
deleted file mode 100644
index dba98ce..0000000
--- a/security-admin/db/xa_audit_db.sql
+++ /dev/null
@@ -1,82 +0,0 @@
--- 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.
-
--- MySQL dump 10.13 Distrib 5.1.50, for apple-darwin10.3.0 (i386)
---
--- Host: localhost Database: xa_db
--- ------------------------------------------------------
--- Server version 5.1.50
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Table structure for table `xa_access_audit`
---
-
-DROP TABLE IF EXISTS `xa_access_audit`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `xa_access_audit` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `audit_type` int(11) NOT NULL DEFAULT '0',
- `access_result` int(11) DEFAULT '0',
- `access_type` varchar(255) DEFAULT NULL,
- `acl_enforcer` varchar(255) DEFAULT NULL,
- `agent_id` varchar(255) DEFAULT NULL,
- `client_ip` varchar(255) DEFAULT NULL,
- `client_type` varchar(255) DEFAULT NULL,
- `policy_id` bigint(20) DEFAULT '0',
- `repo_name` varchar(255) DEFAULT NULL,
- `repo_type` int(11) DEFAULT '0',
- `result_reason` varchar(255) DEFAULT NULL,
- `session_id` varchar(255) DEFAULT NULL,
- `event_time` datetime DEFAULT NULL,
- `request_user` varchar(255) DEFAULT NULL,
- `action` varchar(2000) DEFAULT NULL,
- `request_data` varchar(2000) DEFAULT NULL,
- `resource_path` varchar(2000) DEFAULT NULL,
- `resource_type` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `xa_access_audit_added_by_id` (`added_by_id`),
- KEY `xa_access_audit_upd_by_id` (`upd_by_id`),
- KEY `xa_access_audit_cr_time` (`create_time`),
- KEY `xa_access_audit_up_time` (`update_time`),
- KEY `xa_access_audit_event_time` (`event_time`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `xa_access_audit`
---
-
-LOCK TABLES `xa_access_audit` WRITE;
-/*!40000 ALTER TABLE `xa_access_audit` DISABLE KEYS */;
-/*!40000 ALTER TABLE `xa_access_audit` ENABLE KEYS */;
-UNLOCK TABLES;
-
--- Dump completed on 2014-05-25 0:07:27
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9c2f0d1f/security-admin/db/xa_core_db.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/xa_core_db.sql b/security-admin/db/xa_core_db.sql
deleted file mode 100644
index 9d889a0..0000000
--- a/security-admin/db/xa_core_db.sql
+++ /dev/null
@@ -1,754 +0,0 @@
--- 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.
-
--- MySQL dump 10.13 Distrib 5.1.50, for apple-darwin10.3.0 (i386)
---
--- Host: localhost Database: xa_db
--- ------------------------------------------------------
--- Server version 5.1.50
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Temporary table structure for view `vx_trx_log`
---
-
-DROP TABLE IF EXISTS `vx_trx_log`;
-/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE TABLE `vx_trx_log` (
- `id` bigint(20),
- `create_time` datetime,
- `update_time` datetime,
- `added_by_id` bigint(20),
- `upd_by_id` bigint(20),
- `class_type` int(11),
- `object_id` bigint(20),
- `parent_object_id` bigint(20),
- `parent_object_class_type` int(11),
- `attr_name` varchar(255),
- `parent_object_name` varchar(1024),
- `object_name` varchar(1024),
- `prev_val` varchar(1024),
- `new_val` varchar(1024),
- `trx_id` varchar(1024),
- `action` varchar(255),
- `sess_id` varchar(512),
- `req_id` varchar(30),
- `sess_type` varchar(30)
-) ENGINE=MyISAM */;
-SET character_set_client = @saved_cs_client;
-
---
--- Table structure for table `x_asset`
---
-
-DROP TABLE IF EXISTS `x_asset`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_asset` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `asset_name` varchar(1024) NOT NULL,
- `descr` varchar(4000) NOT NULL,
- `act_status` int(11) NOT NULL DEFAULT '0',
- `asset_type` int(11) NOT NULL DEFAULT '0',
- `config` text,
- `sup_native` tinyint(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `x_asset_FK_added_by_id` (`added_by_id`),
- KEY `x_asset_FK_upd_by_id` (`upd_by_id`),
- KEY `x_asset_cr_time` (`create_time`),
- KEY `x_asset_up_time` (`update_time`),
- CONSTRAINT `x_asset_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_asset_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_asset`
---
-
-LOCK TABLES `x_asset` WRITE;
-/*!40000 ALTER TABLE `x_asset` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_asset` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_audit_map`
---
-
-DROP TABLE IF EXISTS `x_audit_map`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_audit_map` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `res_id` bigint(20) DEFAULT NULL,
- `group_id` bigint(20) DEFAULT NULL,
- `user_id` bigint(20) DEFAULT NULL,
- `audit_type` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `x_audit_map_FK_added_by_id` (`added_by_id`),
- KEY `x_audit_map_FK_upd_by_id` (`upd_by_id`),
- KEY `x_audit_map_FK_res_id` (`res_id`),
- KEY `x_audit_map_FK_group_id` (`group_id`),
- KEY `x_audit_map_FK_user_id` (`user_id`),
- KEY `x_audit_map_cr_time` (`create_time`),
- KEY `x_audit_map_up_time` (`update_time`),
- CONSTRAINT `x_audit_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_audit_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_audit_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`),
- CONSTRAINT `x_audit_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_audit_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_audit_map`
---
-
-LOCK TABLES `x_audit_map` WRITE;
-/*!40000 ALTER TABLE `x_audit_map` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_audit_map` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_auth_sess`
---
-
-DROP TABLE IF EXISTS `x_auth_sess`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_auth_sess` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `login_id` varchar(767) NOT NULL,
- `user_id` bigint(20) DEFAULT NULL,
- `ext_sess_id` varchar(512) DEFAULT NULL,
- `auth_time` datetime NOT NULL,
- `auth_status` int(11) NOT NULL DEFAULT '0',
- `auth_type` int(11) NOT NULL DEFAULT '0',
- `auth_provider` int(11) NOT NULL DEFAULT '0',
- `device_type` int(11) NOT NULL DEFAULT '0',
- `req_ip` varchar(48) NOT NULL,
- `req_ua` varchar(1024) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_auth_sess_FK_added_by_id` (`added_by_id`),
- KEY `x_auth_sess_FK_upd_by_id` (`upd_by_id`),
- KEY `x_auth_sess_FK_user_id` (`user_id`),
- KEY `x_auth_sess_cr_time` (`create_time`),
- KEY `x_auth_sess_up_time` (`update_time`),
- CONSTRAINT `x_auth_sess_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_auth_sess_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_auth_sess_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_auth_sess`
---
-
-LOCK TABLES `x_auth_sess` WRITE;
-/*!40000 ALTER TABLE `x_auth_sess` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_auth_sess` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_cred_store`
---
-
-DROP TABLE IF EXISTS `x_cred_store`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_cred_store` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `store_name` varchar(1024) NOT NULL,
- `descr` varchar(4000) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `x_cred_store_FK_added_by_id` (`added_by_id`),
- KEY `x_cred_store_FK_upd_by_id` (`upd_by_id`),
- KEY `x_cred_store_cr_time` (`create_time`),
- KEY `x_cred_store_up_time` (`update_time`),
- CONSTRAINT `x_cred_store_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_cred_store_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_cred_store`
---
-
-LOCK TABLES `x_cred_store` WRITE;
-/*!40000 ALTER TABLE `x_cred_store` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_cred_store` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_db_base`
---
-
-DROP TABLE IF EXISTS `x_db_base`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_db_base` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_db_base_FK_added_by_id` (`added_by_id`),
- KEY `x_db_base_FK_upd_by_id` (`upd_by_id`),
- KEY `x_db_base_cr_time` (`create_time`),
- KEY `x_db_base_up_time` (`update_time`),
- CONSTRAINT `x_db_base_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_db_base_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_db_base`
---
-
-LOCK TABLES `x_db_base` WRITE;
-/*!40000 ALTER TABLE `x_db_base` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_db_base` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_group`
---
-
-DROP TABLE IF EXISTS `x_group`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_group` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `group_name` varchar(1024) NOT NULL,
- `descr` varchar(4000) NOT NULL,
- `status` int(11) NOT NULL DEFAULT '0',
- `group_type` int(11) NOT NULL DEFAULT '0',
- `cred_store_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_group_FK_added_by_id` (`added_by_id`),
- KEY `x_group_FK_upd_by_id` (`upd_by_id`),
- KEY `x_group_FK_cred_store_id` (`cred_store_id`),
- KEY `x_group_cr_time` (`create_time`),
- KEY `x_group_up_time` (`update_time`),
- CONSTRAINT `x_group_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_group_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`),
- CONSTRAINT `x_group_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_group`
---
-
-LOCK TABLES `x_group` WRITE;
-/*!40000 ALTER TABLE `x_group` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_group` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_group_groups`
---
-
-DROP TABLE IF EXISTS `x_group_groups`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_group_groups` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `group_name` varchar(1024) NOT NULL,
- `p_group_id` bigint(20) DEFAULT NULL,
- `group_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_group_groups_FK_added_by_id` (`added_by_id`),
- KEY `x_group_groups_FK_upd_by_id` (`upd_by_id`),
- KEY `x_group_groups_FK_p_group_id` (`p_group_id`),
- KEY `x_group_groups_FK_group_id` (`group_id`),
- KEY `x_group_groups_cr_time` (`create_time`),
- KEY `x_group_groups_up_time` (`update_time`),
- CONSTRAINT `x_group_groups_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_group_groups_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_group_groups_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_group_groups_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_group_groups`
---
-
-LOCK TABLES `x_group_groups` WRITE;
-/*!40000 ALTER TABLE `x_group_groups` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_group_groups` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_group_users`
---
-
-DROP TABLE IF EXISTS `x_group_users`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_group_users` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `group_name` varchar(1024) NOT NULL,
- `p_group_id` bigint(20) DEFAULT NULL,
- `user_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_group_users_FK_added_by_id` (`added_by_id`),
- KEY `x_group_users_FK_upd_by_id` (`upd_by_id`),
- KEY `x_group_users_FK_p_group_id` (`p_group_id`),
- KEY `x_group_users_FK_user_id` (`user_id`),
- KEY `x_group_users_cr_time` (`create_time`),
- KEY `x_group_users_up_time` (`update_time`),
- CONSTRAINT `x_group_users_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_group_users_FK_p_group_id` FOREIGN KEY (`p_group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_group_users_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_group_users_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_group_users`
---
-
-LOCK TABLES `x_group_users` WRITE;
-/*!40000 ALTER TABLE `x_group_users` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_group_users` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_perm_map`
---
-
-DROP TABLE IF EXISTS `x_perm_map`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_perm_map` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `perm_group` varchar(1024) DEFAULT NULL,
- `res_id` bigint(20) DEFAULT NULL,
- `group_id` bigint(20) DEFAULT NULL,
- `user_id` bigint(20) DEFAULT NULL,
- `perm_for` int(11) NOT NULL DEFAULT '0',
- `perm_type` int(11) NOT NULL DEFAULT '0',
- `is_recursive` int(11) NOT NULL DEFAULT '0',
- `is_wild_card` tinyint(1) NOT NULL DEFAULT '1',
- `grant_revoke` tinyint(1) NOT NULL DEFAULT '1',
- PRIMARY KEY (`id`),
- KEY `x_perm_map_FK_added_by_id` (`added_by_id`),
- KEY `x_perm_map_FK_upd_by_id` (`upd_by_id`),
- KEY `x_perm_map_FK_res_id` (`res_id`),
- KEY `x_perm_map_FK_group_id` (`group_id`),
- KEY `x_perm_map_FK_user_id` (`user_id`),
- KEY `x_perm_map_cr_time` (`create_time`),
- KEY `x_perm_map_up_time` (`update_time`),
- CONSTRAINT `x_perm_map_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_perm_map_FK_group_id` FOREIGN KEY (`group_id`) REFERENCES `x_group` (`id`),
- CONSTRAINT `x_perm_map_FK_res_id` FOREIGN KEY (`res_id`) REFERENCES `x_resource` (`id`),
- CONSTRAINT `x_perm_map_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_perm_map_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_perm_map`
---
-
-LOCK TABLES `x_perm_map` WRITE;
-/*!40000 ALTER TABLE `x_perm_map` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_perm_map` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_policy_export_audit`
---
-
-DROP TABLE IF EXISTS `x_policy_export_audit`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_policy_export_audit` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `client_ip` varchar(255) NOT NULL,
- `agent_id` varchar(255) DEFAULT NULL,
- `req_epoch` bigint(20) NOT NULL,
- `last_updated` datetime DEFAULT NULL,
- `repository_name` varchar(1024) DEFAULT NULL,
- `exported_json` text,
- `http_ret_code` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `x_policy_export_audit_FK_added_by_id` (`added_by_id`),
- KEY `x_policy_export_audit_FK_upd_by_id` (`upd_by_id`),
- KEY `x_policy_export_audit_cr_time` (`create_time`),
- KEY `x_policy_export_audit_up_time` (`update_time`),
- CONSTRAINT `x_policy_export_audit_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_policy_export_audit_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_policy_export_audit`
---
-
-LOCK TABLES `x_policy_export_audit` WRITE;
-/*!40000 ALTER TABLE `x_policy_export_audit` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_policy_export_audit` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_portal_user`
---
-
-DROP TABLE IF EXISTS `x_portal_user`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_portal_user` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `first_name` varchar(1022) DEFAULT NULL,
- `last_name` varchar(1022) DEFAULT NULL,
- `pub_scr_name` varchar(2048) DEFAULT NULL,
- `login_id` varchar(767) DEFAULT NULL,
- `password` varchar(512) NOT NULL,
- `email` varchar(512) DEFAULT NULL,
- `status` int(11) NOT NULL DEFAULT '0',
- `user_src` int(11) NOT NULL DEFAULT '0',
- `notes` varchar(4000) DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `x_portal_user_UK_login_id` (`login_id`),
- UNIQUE KEY `x_portal_user_UK_email` (`email`),
- KEY `x_portal_user_FK_added_by_id` (`added_by_id`),
- KEY `x_portal_user_FK_upd_by_id` (`upd_by_id`),
- KEY `x_portal_user_cr_time` (`create_time`),
- KEY `x_portal_user_up_time` (`update_time`),
- KEY `x_portal_user_name` (`first_name`(767)),
- KEY `x_portal_user_email` (`email`),
- CONSTRAINT `x_portal_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_portal_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_portal_user`
---
-
-LOCK TABLES `x_portal_user` WRITE;
-/*!40000 ALTER TABLE `x_portal_user` DISABLE KEYS */;
-INSERT INTO `x_portal_user` VALUES (1,'2014-05-25 00:07:26','2014-05-25 00:07:26',NULL,NULL,'Admin','','Admin','admin','ceb4f32325eda6142bd65215f4c0f371','',1,0,NULL);
-/*!40000 ALTER TABLE `x_portal_user` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_portal_user_role`
---
-
-DROP TABLE IF EXISTS `x_portal_user_role`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_portal_user_role` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `user_id` bigint(20) NOT NULL,
- `user_role` varchar(128) DEFAULT NULL,
- `status` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `x_portal_user_role_FK_added_by_id` (`added_by_id`),
- KEY `x_portal_user_role_FK_upd_by_id` (`upd_by_id`),
- KEY `x_portal_user_role_FK_user_id` (`user_id`),
- KEY `x_portal_user_role_cr_time` (`create_time`),
- KEY `x_portal_user_role_up_time` (`update_time`),
- CONSTRAINT `x_portal_user_role_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_portal_user_role_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_portal_user_role_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_portal_user_role`
---
-
-LOCK TABLES `x_portal_user_role` WRITE;
-/*!40000 ALTER TABLE `x_portal_user_role` DISABLE KEYS */;
-INSERT INTO `x_portal_user_role` VALUES (1,'2014-05-25 00:07:26','2014-05-25 00:07:26',NULL,NULL,1,'ROLE_SYS_ADMIN',1);
-/*!40000 ALTER TABLE `x_portal_user_role` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_resource`
---
-
-DROP TABLE IF EXISTS `x_resource`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_resource` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `res_name` varchar(4000) DEFAULT NULL,
- `descr` varchar(4000) DEFAULT NULL,
- `res_type` int(11) NOT NULL DEFAULT '0',
- `asset_id` bigint(20) NOT NULL,
- `parent_id` bigint(20) DEFAULT NULL,
- `parent_path` varchar(4000) DEFAULT NULL,
- `is_encrypt` int(11) NOT NULL DEFAULT '0',
- `is_recursive` int(11) NOT NULL DEFAULT '0',
- `res_group` varchar(1024) DEFAULT NULL,
- `res_dbs` text,
- `res_tables` text,
- `res_col_fams` text,
- `res_cols` text,
- `res_udfs` text,
- `res_status` int(11) NOT NULL DEFAULT '1',
- `table_type` int(11) NOT NULL DEFAULT '0',
- `col_type` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `x_resource_FK_added_by_id` (`added_by_id`),
- KEY `x_resource_FK_upd_by_id` (`upd_by_id`),
- KEY `x_resource_FK_asset_id` (`asset_id`),
- KEY `x_resource_FK_parent_id` (`parent_id`),
- KEY `x_resource_cr_time` (`create_time`),
- KEY `x_resource_up_time` (`update_time`),
- CONSTRAINT `x_resource_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_resource_FK_asset_id` FOREIGN KEY (`asset_id`) REFERENCES `x_asset` (`id`),
- CONSTRAINT `x_resource_FK_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `x_resource` (`id`),
- CONSTRAINT `x_resource_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_resource`
---
-
-LOCK TABLES `x_resource` WRITE;
-/*!40000 ALTER TABLE `x_resource` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_resource` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_trx_log`
---
-
-DROP TABLE IF EXISTS `x_trx_log`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_trx_log` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `class_type` int(11) NOT NULL DEFAULT '0',
- `object_id` bigint(20) DEFAULT NULL,
- `parent_object_id` bigint(20) DEFAULT NULL,
- `parent_object_class_type` int(11) NOT NULL DEFAULT '0',
- `parent_object_name` varchar(1024) DEFAULT NULL,
- `object_name` varchar(1024) DEFAULT NULL,
- `attr_name` varchar(255) DEFAULT NULL,
- `prev_val` varchar(1024) DEFAULT NULL,
- `new_val` varchar(1024) DEFAULT NULL,
- `trx_id` varchar(1024) DEFAULT NULL,
- `action` varchar(255) DEFAULT NULL,
- `sess_id` varchar(512) DEFAULT NULL,
- `req_id` varchar(30) DEFAULT NULL,
- `sess_type` varchar(30) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_trx_log_FK_added_by_id` (`added_by_id`),
- KEY `x_trx_log_FK_upd_by_id` (`upd_by_id`),
- KEY `x_trx_log_cr_time` (`create_time`),
- KEY `x_trx_log_up_time` (`update_time`),
- CONSTRAINT `x_trx_log_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_trx_log_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_trx_log`
---
-
-LOCK TABLES `x_trx_log` WRITE;
-/*!40000 ALTER TABLE `x_trx_log` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_trx_log` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `x_user`
---
-
-DROP TABLE IF EXISTS `x_user`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `x_user` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `user_name` varchar(1024) NOT NULL,
- `descr` varchar(4000) NOT NULL,
- `status` int(11) NOT NULL DEFAULT '0',
- `cred_store_id` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `x_user_FK_added_by_id` (`added_by_id`),
- KEY `x_user_FK_upd_by_id` (`upd_by_id`),
- KEY `x_user_FK_cred_store_id` (`cred_store_id`),
- KEY `x_user_cr_time` (`create_time`),
- KEY `x_user_up_time` (`update_time`),
- CONSTRAINT `x_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
- CONSTRAINT `x_user_FK_cred_store_id` FOREIGN KEY (`cred_store_id`) REFERENCES `x_cred_store` (`id`),
- CONSTRAINT `x_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `x_user`
---
-
-LOCK TABLES `x_user` WRITE;
-/*!40000 ALTER TABLE `x_user` DISABLE KEYS */;
-/*!40000 ALTER TABLE `x_user` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `xa_access_audit`
---
-
-DROP TABLE IF EXISTS `xa_access_audit`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `xa_access_audit` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `create_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `added_by_id` bigint(20) DEFAULT NULL,
- `upd_by_id` bigint(20) DEFAULT NULL,
- `audit_type` int(11) NOT NULL DEFAULT '0',
- `access_result` int(11) DEFAULT '0',
- `access_type` varchar(255) DEFAULT NULL,
- `acl_enforcer` varchar(255) DEFAULT NULL,
- `agent_id` varchar(255) DEFAULT NULL,
- `client_ip` varchar(255) DEFAULT NULL,
- `client_type` varchar(255) DEFAULT NULL,
- `policy_id` bigint(20) DEFAULT '0',
- `repo_name` varchar(255) DEFAULT NULL,
- `repo_type` int(11) DEFAULT '0',
- `result_reason` varchar(255) DEFAULT NULL,
- `session_id` varchar(255) DEFAULT NULL,
- `event_time` datetime DEFAULT NULL,
- `request_user` varchar(255) DEFAULT NULL,
- `action` varchar(2000) DEFAULT NULL,
- `request_data` varchar(2000) DEFAULT NULL,
- `resource_path` varchar(2000) DEFAULT NULL,
- `resource_type` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `xa_access_audit_added_by_id` (`added_by_id`),
- KEY `xa_access_audit_upd_by_id` (`upd_by_id`),
- KEY `xa_access_audit_cr_time` (`create_time`),
- KEY `xa_access_audit_up_time` (`update_time`),
- KEY `xa_access_audit_event_time` (`event_time`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `xa_access_audit`
---
-
-LOCK TABLES `xa_access_audit` WRITE;
-/*!40000 ALTER TABLE `xa_access_audit` DISABLE KEYS */;
-/*!40000 ALTER TABLE `xa_access_audit` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Final view structure for view `vx_trx_log`
---
-
-/*!50001 DROP TABLE IF EXISTS `vx_trx_log`*/;
-/*!50001 DROP VIEW IF EXISTS `vx_trx_log`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = latin1 */;
-/*!50001 SET character_set_results = latin1 */;
-/*!50001 SET collation_connection = latin1_swedish_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50001 VIEW `vx_trx_log` AS select `x_trx_log`.`id` AS `id`,`x_trx_log`.`create_time` AS `create_time`,`x_trx_log`.`update_time` AS `update_time`,`x_trx_log`.`added_by_id` AS `added_by_id`,`x_trx_log`.`upd_by_id` AS `upd_by_id`,`x_trx_log`.`class_type` AS `class_type`,`x_trx_log`.`object_id` AS `object_id`,`x_trx_log`.`parent_object_id` AS `parent_object_id`,`x_trx_log`.`parent_object_class_type` AS `parent_object_class_type`,`x_trx_log`.`attr_name` AS `attr_name`,`x_trx_log`.`parent_object_name` AS `parent_object_name`,`x_trx_log`.`object_name` AS `object_name`,`x_trx_log`.`prev_val` AS `prev_val`,`x_trx_log`.`new_val` AS `new_val`,`x_trx_log`.`trx_id` AS `trx_id`,`x_trx_log`.`action` AS `action`,`x_trx_log`.`sess_id` AS `sess_id`,`x_trx_log`.`req_id` AS `req_id`,`x_trx_log`.`sess_type` AS `sess_type` from `x_trx_log` group by `x_trx_log`.`trx_id` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2014-05-25 0:07:27
\ No newline at end of file