/*
SQLyog Ultimate v12.5.1 (32 bit)
*********************************************************************
*/



/*Table structure for table `acc_access_grant_types` */

CREATE TABLE `acc_access_grant_types` (
  `access_grant_type_id` tinyint(4) NOT NULL,
  `name` varchar(64) NOT NULL,
  `description` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`access_grant_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `acc_access_grant_types` */

insert  into `acc_access_grant_types`(`access_grant_type_id`,`name`,`description`) values 
(1,'Role','Grant object as role'),
(2,'Individual','Grant object to individual subject'),
(3,'Individual role','Grant role to individual subject'),
(4,'Individual Level','Grant level to individual subject');

/*Table structure for table `acc_access_grants` */

CREATE TABLE `acc_access_grants` (
  `access_grant_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `access_grant_type_id` tinyint(4) NOT NULL,
  `access_object_code` varchar(32) NOT NULL,
  `access_permission_id` tinyint(4) NOT NULL,
  `subject` bigint(20) NOT NULL,
  `valid_from` datetime NOT NULL,
  `valid_until` datetime DEFAULT NULL,
  PRIMARY KEY (`access_grant_id`),
  UNIQUE KEY `IDU_GRANT_NODUPLICATE` (`access_grant_type_id`,`access_object_code`,`subject`,`valid_until`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;

/*Data for the table `acc_access_grants` */

insert  into `acc_access_grants`(`access_grant_id`,`access_grant_type_id`,`access_object_code`,`access_permission_id`,`subject`,`valid_from`,`valid_until`) values 
(1,1,'login',3,1,'2019-12-12 09:24:32','9999-09-09 00:00:00'),
(2,1,'page_naf_module',3,1,'2019-12-12 09:24:32','9999-09-09 00:00:00'),
(3,1,'page_naf_theme',3,1,'2019-12-12 09:24:32','9999-09-09 00:00:00'),
(4,1,'page_access_grant',4,1,'2019-12-12 09:24:32','9999-09-09 00:00:00'),
(5,1,'mnu_uac',4,1,'2019-12-12 00:00:00','9999-09-09 00:00:00'),
(6,1,'mnu_access_entity',4,1,'2019-12-12 00:00:00','9999-09-09 00:00:00'),
(7,1,'mnu_access_role',4,1,'2019-12-12 00:00:00','9999-09-09 00:00:00'),
(9,1,'mnu_actor_user',4,1,'2019-12-12 00:00:00','9999-09-09 00:00:00'),
(11,3,'admin',3,1,'2019-12-12 09:24:33','2019-12-12 21:59:51'),
(12,3,'admin',4,1,'2019-12-12 22:00:51',NULL),
(13,3,'user',4,1,'2019-12-12 22:00:51',NULL),
(14,3,'hrd',4,1,'2019-12-12 22:00:51',NULL);

/*Table structure for table `acc_access_levels` */

CREATE TABLE `acc_access_levels` (
  `level_id` bigint(20) NOT NULL,
  `parent_level_id` bigint(20) DEFAULT NULL,
  `code` varchar(32) NOT NULL,
  `name` varchar(64) NOT NULL,
  `description` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`level_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `acc_access_levels` */

insert  into `acc_access_levels`(`level_id`,`parent_level_id`,`code`,`name`,`description`) values 
(1,NULL,'level_1','Level 1','Level 1'),
(2,NULL,'level_2','Level 2','Level 2'),
(3,NULL,'level_2','Level 3','Level 3');

/*Table structure for table `acc_access_object_types` */

CREATE TABLE `acc_access_object_types` (
  `access_object_type_id` tinyint(4) NOT NULL,
  `name` varchar(45) NOT NULL,
  `description` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`access_object_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `acc_access_object_types` */

insert  into `acc_access_object_types`(`access_object_type_id`,`name`,`description`) values 
(1,'Menu','Menu access'),
(2,'Page','Page access'),
(3,'Action','Action access');

/*Table structure for table `acc_access_objects` */

CREATE TABLE `acc_access_objects` (
  `access_object_code` varchar(32) NOT NULL,
  `access_object_type_id` tinyint(4) NOT NULL,
  `access_object_parent` varchar(32) DEFAULT NULL,
  `name` varchar(64) NOT NULL,
  `module` varchar(32) DEFAULT NULL,
  `description` varchar(128) DEFAULT NULL,
  `reference` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`access_object_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `acc_access_objects` */

insert  into `acc_access_objects`(`access_object_code`,`access_object_type_id`,`access_object_parent`,`name`,`module`,`description`,`reference`) values 
('login',3,NULL,'Login','Core','Login to application',NULL),
('mnu_access_entity',1,'mnu_uac','Manage Entities','Global',NULL,'/access/form/entity'),
('mnu_access_role',1,'mnu_uac','Manage Roles','Global',NULL,'/access/form/role'),
('mnu_actor_user',1,'mnu_uac','Manage Users','Global',NULL,'/actor/form/user'),
('mnu_uac',1,NULL,'Users &amp; Access','Global',NULL,NULL),
('page_access_grant',2,NULL,'Edit Grant','Access','Edit Grant',NULL),
('page_naf_module',2,NULL,'Manage modules','Core','Manage installed modules',NULL),
('page_naf_theme',2,NULL,'Change theme','Core','Change application theme',NULL);

/*Table structure for table `acc_access_permissions` */

CREATE TABLE `acc_access_permissions` (
  `access_permission_id` tinyint(4) NOT NULL,
  `name` varchar(64) NOT NULL,
  `description` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`access_permission_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `acc_access_permissions` */

insert  into `acc_access_permissions`(`access_permission_id`,`name`,`description`) values 
(1,'view','View'),
(2,'modify','View and modify'),
(3,'execute','View and execute'),
(4,'all','View, modify, and execute');

/*Table structure for table `acc_access_roles` */

CREATE TABLE `acc_access_roles` (
  `access_role_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `code` varchar(32) NOT NULL,
  `name` varchar(64) NOT NULL,
  `description` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`access_role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

/*Data for the table `acc_access_roles` */

insert  into `acc_access_roles`(`access_role_id`,`code`,`name`,`description`) values 
(1,'admin','Administrator','System administrator'),
(2,'user','User','Role for user'),
(3,'hrd','HRD','Human resource Development');

/*Data for the table `act_password_history` */

/*Table structure for table `act_user_pictures` */

CREATE TABLE `act_user_pictures` (
  `user_picture_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) NOT NULL,
  `upload_dtm` datetime NOT NULL,
  `name` varchar(64) NOT NULL,
  `width` bigint(20) DEFAULT 0,
  `height` bigint(20) DEFAULT 0,
  `active` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`user_picture_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `act_user_pictures` */

/*Table structure for table `act_user_statuses` */

CREATE TABLE `act_user_statuses` (
  `user_status_id` tinyint(4) NOT NULL,
  `name` varchar(64) NOT NULL,
  `description` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`user_status_id`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `act_user_statuses` */

insert  into `act_user_statuses`(`user_status_id`,`name`,`description`) values 
(1,'Candidate','Kandidat, sudah registrasi belum aktif'),
(2,'Inactive','Sudah tidak aktif'),
(3,'Active','Aktif'),
(4,'Suspend','Suspend / locked'),
(5,'None','?');

/*Data for the table `mvc_guids` */

/*Table structure for table `naf_config` */

CREATE TABLE `naf_config` (
  `config_code` varchar(64) NOT NULL,
  `config_data` varchar(512) NOT NULL,
  PRIMARY KEY (`config_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `naf_config` */

/*Table structure for table `naf_registers` */

CREATE TABLE `naf_registers` (
  `register_code` varchar(32) NOT NULL,
  `register_usage` tinyint(4) DEFAULT NULL,
  `register_flag` tinyint(4) DEFAULT NULL,
  `update_dtm` date NOT NULL,
  UNIQUE KEY `UDX_REGISTER_CODE_USAGE` (`register_code`,`register_usage`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `naf_registers` */

insert  into `naf_registers`(`register_code`,`register_usage`,`register_flag`,`update_dtm`) values 
('mnu_uac',1,1,'2019-12-12'),
('mnu_access_entity',1,1,'2019-12-12'),
('mnu_access_role',1,1,'2019-12-12'),
('mnu_actor_user',1,1,'2019-12-12');

