00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 $installer = $this;
00028
00029
00030 $installer->startSetup();
00031
00032 $installer->run("
00033
00034 -- DROP TABLE IF EXISTS {$this->getTable('admin_assert')};
00035 CREATE TABLE {$this->getTable('admin_assert')} (
00036 `assert_id` int(10) unsigned NOT NULL auto_increment,
00037 `assert_type` varchar(20) character set utf8 NOT NULL default '',
00038 `assert_data` text character set utf8,
00039 PRIMARY KEY (`assert_id`)
00040 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ACL Asserts';
00041
00042 -- DROP TABLE IF EXISTS {$this->getTable('admin_role')};
00043 CREATE TABLE {$this->getTable('admin_role')} (
00044 `role_id` int(10) unsigned NOT NULL auto_increment,
00045 `parent_id` int(10) unsigned NOT NULL default '0',
00046 `tree_level` tinyint(3) unsigned NOT NULL default '0',
00047 `sort_order` tinyint(3) unsigned NOT NULL default '0',
00048 `role_type` char(1) character set utf8 NOT NULL default '0',
00049 `user_id` int(11) unsigned NOT NULL default '0',
00050 `role_name` varchar(50) character set utf8 NOT NULL default '',
00051 PRIMARY KEY (`role_id`),
00052 KEY `parent_id` (`parent_id`,`sort_order`),
00053 KEY `tree_level` (`tree_level`)
00054 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ACL Roles';
00055
00056 insert into {$this->getTable('admin_role')}(`role_id`,`parent_id`,`tree_level`,`sort_order`,`role_type`,`user_id`,`role_name`) values (1,0,1,1,'G',0,'Administrators'),(2,1,2,1,'U',1,'Administrator');
00057
00058 -- DROP TABLE IF EXISTS {$this->getTable('admin_rule')};
00059 CREATE TABLE {$this->getTable('admin_rule')} (
00060 `rule_id` int(10) unsigned NOT NULL auto_increment,
00061 `role_id` int(10) unsigned NOT NULL default '0',
00062 `resource_id` varchar(255) character set utf8 NOT NULL default '',
00063 `privileges` varchar(20) character set utf8 NOT NULL default '',
00064 `assert_id` int(10) unsigned NOT NULL default '0',
00065 `role_type` char(1) default NULL,
00066 `permission` varchar(10) default NULL,
00067 PRIMARY KEY (`rule_id`),
00068 KEY `resource` (`resource_id`,`role_id`),
00069 KEY `role_id` (`role_id`,`resource_id`),
00070 CONSTRAINT `FK_admin_rule` FOREIGN KEY (`role_id`) REFERENCES {$this->getTable('admin_role')} (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE
00071 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ACL Rules';
00072
00073 insert into {$this->getTable('admin_rule')}(`rule_id`, `role_id`, `resource_id`, `privileges`, `assert_id`, `role_type`, `permission`) values (1,1,'all','',0,'G','allow');
00074
00075 -- DROP TABLE IF EXISTS {$this->getTable('admin_user')};
00076 CREATE TABLE {$this->getTable('admin_user')} (
00077 `user_id` mediumint(9) unsigned NOT NULL auto_increment,
00078 `firstname` varchar(32) character set utf8 NOT NULL default '',
00079 `lastname` varchar(32) character set utf8 NOT NULL default '',
00080 `email` varchar(128) character set utf8 NOT NULL default '',
00081 `username` varchar(40) character set utf8 NOT NULL default '',
00082 `password` varchar(40) character set utf8 NOT NULL default '',
00083 `created` datetime NOT NULL default '0000-00-00 00:00:00',
00084 `modified` datetime default NULL,
00085 `logdate` datetime default NULL,
00086 `lognum` smallint(5) unsigned NOT NULL default '0',
00087 `reload_acl_flag` tinyint(1) NOT NULL default '0',
00088 `is_active` tinyint(1) NOT NULL default '1',
00089 PRIMARY KEY (`user_id`)
00090 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Users';
00091
00092 insert into {$this->getTable('admin_user')}(`user_id`,`firstname`,`lastname`,`email`,`username`,`password`,`created`,`modified`,`logdate`,`lognum`,`reload_acl_flag`,`is_active`) values (1,'admin','admin','admin@your_domain.com','admin','4297f44b13955235245b2497399d7a93',NOW(),NOW(),NOW(),1,0,1);
00093
00094 ");
00095
00096 $installer->endSetup();