From b367a62a83cc95696c6d5b337e164af6dc235608 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Wed, 18 Sep 2013 22:20:01 -0700 Subject: [PATCH] Add ACL related DB schema. --- setup/db/db/schema-420to430.sql | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/setup/db/db/schema-420to430.sql b/setup/db/db/schema-420to430.sql index 44a884d99ef..3c75278b872 100644 --- a/setup/db/db/schema-420to430.sql +++ b/setup/db/db/schema-420to430.sql @@ -281,3 +281,53 @@ CREATE VIEW `cloud`.`template_view` AS and (resource_tags.resource_type = 'Template' or resource_tags.resource_type='ISO') where vm_template.state='Active'; + +-- ACL DB schema +CREATE TABLE `cloud`.`acl_group` ( + `id` bigint unsigned NOT NULL UNIQUE auto_increment, + `name` varchar(255) NOT NULL, + `uuid` varchar(40), + `removed` datetime COMMENT 'date the group was removed', + `created` datetime COMMENT 'date the group was created', + PRIMARY KEY (`id`), + INDEX `i_acl_group__removed`(`removed`), + CONSTRAINT `uc_acl_group__uuid` UNIQUE (`uuid`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`acl_group_account_map` ( + `id` bigint unsigned NOT NULL auto_increment, + `group_id` bigint unsigned NOT NULL, + `account_id` bigint unsigned NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_acl_group_vm_map___group_id` FOREIGN KEY(`group_id`) REFERENCES `acl_group` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_acl_group_vm_map___account_id` FOREIGN KEY(`account_id`) REFERENCES `account` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`acl_role` ( + `id` bigint unsigned NOT NULL UNIQUE auto_increment, + `name` varchar(255) NOT NULL, + `uuid` varchar(40), + `removed` datetime COMMENT 'date the role was removed', + `created` datetime COMMENT 'date the role was created', + PRIMARY KEY (`id`), + INDEX `i_acl_role__removed`(`removed`), + CONSTRAINT `uc_acl_role__uuid` UNIQUE (`uuid`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`acl_api_permission` ( + `id` bigint unsigned NOT NULL UNIQUE auto_increment, + `role_id` bigint unsigned NOT NULL, + `api` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_acl_api_permission___role_id` FOREIGN KEY(`role_id`) REFERENCES `acl_role` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`acl_entity_permission` ( + `id` bigint unsigned NOT NULL UNIQUE auto_increment, + `group_id` bigint unsigned NOT NULL, + `entity_type` varchar(100) NOT NULL, + `entity_id` bigint unsigned NOT NULL, + `access_type` varchar(40) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_acl_entity_permission___group_id` FOREIGN KEY(`group_id`) REFERENCES `acl_group` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8;