rbac的用法
http://www.yiichina.com/tutorial/485
CREATE TABLE IF NOT EXISTS `auth_assignment` (
`item_name` varchar(64) NOT NULL,
`user_id` varchar(64) NOT NULL,
`created_at` int(11) DEFAULT NULL,
PRIMARY KEY (`item_name`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `auth_assignment`
--
INSERT INTO `auth_assignment` (`item_name`, `user_id`, `created_at`) VALUES
(‘咨询‘, ‘6‘, 1433566566),
(‘导医‘, ‘5‘, 1433566505),
(‘竞价‘, ‘3‘, 1433565005),
(‘竞价‘, ‘4‘, 1433565733),
(‘管理员‘, ‘1‘, 1433573415),
(‘管理员‘, ‘2‘, 1433556404),
(‘管理员‘, ‘3‘, 1433565005);
-- --------------------------------------------------------
--
-- 表的结构 `auth_item`
--
CREATE TABLE IF NOT EXISTS `auth_item` (
`name` varchar(64) NOT NULL,
`type` int(11) NOT NULL,
`description` text,
`rule_name` varchar(64) DEFAULT NULL,
`data` text,
`created_at` int(11) DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL,
PRIMARY KEY (`name`),
KEY `rule_name` (`rule_name`),
KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `auth_item`
--
INSERT INTO `auth_item` (`name`, `type`, `description`, `rule_name`, `data`, `created_at`, `updated_at`) VALUES
(‘Channel‘, 2, ‘渠道管理‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/cost‘, 2, ‘渠道消费管理‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/costcreate‘, 2, ‘添加渠道消费‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/costdel‘, 2, ‘删除渠道消费‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/costedit‘, 2, ‘编辑渠道消费‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/costlist‘, 2, ‘查看渠道消费‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/create‘, 2, ‘添加渠道‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/del‘, 2, ‘删除渠道‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/edit‘, 2, ‘编辑渠道‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/index‘, 2, ‘渠道管理‘, NULL, NULL, 1433552508, 1433552508),
(‘channel/list‘, 2, ‘查看渠道‘, NULL, NULL, 1433552508, 1433552508),
(‘department/create‘, 2, ‘添加科室‘, NULL, NULL, 1433552508, 1433552508),
(‘department/del‘, 2, ‘删除科室‘, NULL, NULL, 1433552508, 1433552508),
(‘department/edit‘, 2, ‘编辑科室‘, NULL, NULL, 1433552508, 1433552508),
(‘department/index‘, 2, ‘科室管理‘, NULL, NULL, 1433552508, 1433552508),
(‘department/list‘, 2, ‘查看科室‘, NULL, NULL, 1433552508, 1433552508),
(‘department/merge‘, 2, ‘合并科室‘, NULL, NULL, 1433552508, 1433552508),
(‘doctor/create‘, 2, ‘添加医生‘, NULL, NULL, 1433552509, 1433552509),
(‘doctor/del‘, 2, ‘删除医生‘, NULL, NULL, 1433552509, 1433552509),
(‘doctor/edit‘, 2, ‘编辑医生‘, NULL, NULL, 1433552509, 1433552509),
(‘doctor/index‘, 2, ‘医生管理‘, NULL, NULL, 1433552509, 1433552509),
(‘doctor/list‘, 2, ‘查看医生‘, NULL, NULL, 1433552509, 1433552509),
(‘Record‘, 2, ‘患者管理‘, NULL, NULL, 1433552508, 1433552508),
(‘record/allocate‘, 2, ‘分诊‘, NULL, NULL, 1433552508, 1433552508),
(‘record/appointment‘, 2, ‘预约管理‘, NULL, NULL, 1433552508, 1433552508),
(‘record/appointmentlist‘, 2, ‘查看预约‘, NULL, NULL, 1433552508, 1433552508),
(‘record/create‘, 2, ‘添加对话‘, NULL, NULL, 1433552508, 1433552508),
(‘record/del‘, 2, ‘删除对话‘, NULL, NULL, 1433552508, 1433552508),
(‘record/edit‘, 2, ‘编辑对话‘, NULL, NULL, 1433552508, 1433552508),
(‘record/index‘, 2, ‘对话管理‘, NULL, NULL, 1433552508, 1433552508),
(‘record/list‘, 2, ‘查看对话‘, NULL, NULL, 1433552508, 1433552508),
(‘Report‘, 2, ‘统计报表‘, NULL, NULL, 1433552509, 1433552509),
(‘report/channel‘, 2, ‘渠道报表‘, NULL, NULL, 1433552509, 1433552509),
(‘report/channelreport‘, 2, ‘查看渠道报表‘, NULL, NULL, 1433552509, 1433552509),
(‘report/user‘, 2, ‘用户报表‘, NULL, NULL, 1433552509, 1433552509),
(‘report/userreport‘, 2, ‘查看用户报表‘, NULL, NULL, 1433552509, 1433552509),
(‘User‘, 2, ‘权限管理‘, NULL, NULL, 1433572341, 1433572341),
(‘user/create‘, 2, ‘添加用户‘, NULL, NULL, 1433572341, 1433572341),
(‘user/del‘, 2, ‘删除用户‘, NULL, NULL, 1433572341, 1433572341),
(‘user/edit‘, 2, ‘编辑用户‘, NULL, NULL, 1433572341, 1433572341),
(‘user/index‘, 2, ‘用户管理‘, NULL, NULL, 1433572341, 1433572341),
(‘user/list‘, 2, ‘查看用户‘, NULL, NULL, 1433572341, 1433572341),
(‘user/role‘, 2, ‘角色管理‘, NULL, NULL, 1433572341, 1433572341),
(‘user/rolecreate‘, 2, ‘添加角色‘, NULL, NULL, 1433572342, 1433572342),
(‘user/roledel‘, 2, ‘删除角色‘, NULL, NULL, 1433572342, 1433572342),
(‘user/roleedit‘, 2, ‘编辑角色‘, NULL, NULL, 1433572342, 1433572342),
(‘user/rolelist‘, 2, ‘查看角色‘, NULL, NULL, 1433572342, 1433572342),
(‘咨询‘, 1, NULL, NULL, NULL, 1433566416, 1433566416),
(‘咨询主管‘, 1, NULL, NULL, NULL, 1433566448, 1433566448),
(‘导医‘, 1, NULL, NULL, NULL, 1433566477, 1433566477),
(‘竞价‘, 1, NULL, NULL, NULL, 1433552524, 1433552524),
(‘管理员‘, 1, NULL, NULL, NULL, 1433552560, 1433552560),
(‘网络总监‘, 1, NULL, NULL, NULL, 1433566686, 1433566686);
-- --------------------------------------------------------
--
-- 表的结构 `auth_item_child`
--
CREATE TABLE IF NOT EXISTS `auth_item_child` (
`parent` varchar(64) NOT NULL,
`child` varchar(64) NOT NULL,
PRIMARY KEY (`parent`,`child`),
KEY `child` (`child`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `auth_item_child`
--
INSERT INTO `auth_item_child` (`parent`, `child`) VALUES
(‘管理员‘, ‘Channel‘),
(‘网络总监‘, ‘Channel‘),
(‘管理员‘, ‘channel/cost‘),
(‘网络总监‘, ‘channel/cost‘),
(‘管理员‘, ‘channel/costdel‘),
(‘管理员‘, ‘channel/costedit‘),
(‘管理员‘, ‘channel/costlist‘),
(‘网络总监‘, ‘channel/costlist‘),
(‘管理员‘, ‘channel/del‘),
(‘管理员‘, ‘channel/edit‘),
(‘管理员‘, ‘channel/index‘),
(‘网络总监‘, ‘channel/index‘),
(‘管理员‘, ‘channel/list‘),
(‘网络总监‘, ‘channel/list‘),
(‘咨询主管‘, ‘department/del‘),
(‘管理员‘, ‘department/del‘),
(‘咨询主管‘, ‘department/edit‘),
(‘管理员‘, ‘department/edit‘),
(‘咨询主管‘, ‘department/index‘),
(‘管理员‘, ‘department/index‘),
(‘网络总监‘, ‘department/index‘),
(‘咨询主管‘, ‘department/list‘),
(‘管理员‘, ‘department/list‘),
(‘网络总监‘, ‘department/list‘),
(‘咨询主管‘, ‘department/merge‘),
(‘管理员‘, ‘department/merge‘),
(‘咨询主管‘, ‘doctor/del‘),
(‘管理员‘, ‘doctor/del‘),
(‘咨询主管‘, ‘doctor/edit‘),
(‘管理员‘, ‘doctor/edit‘),
(‘咨询主管‘, ‘doctor/index‘),
(‘管理员‘, ‘doctor/index‘),
(‘网络总监‘, ‘doctor/index‘),
(‘咨询主管‘, ‘doctor/list‘),
(‘管理员‘, ‘doctor/list‘),
(‘网络总监‘, ‘doctor/list‘),
(‘咨询‘, ‘Record‘),
(‘咨询主管‘, ‘Record‘),
(‘导医‘, ‘Record‘),
(‘竞价‘, ‘Record‘),
(‘管理员‘, ‘Record‘),
(‘网络总监‘, ‘Record‘),
(‘咨询主管‘, ‘record/allocate‘),
(‘导医‘, ‘record/allocate‘),
(‘管理员‘, ‘record/allocate‘),
(‘咨询‘, ‘record/appointment‘),
(‘咨询主管‘, ‘record/appointment‘),
(‘导医‘, ‘record/appointment‘),
(‘管理员‘, ‘record/appointment‘),
(‘网络总监‘, ‘record/appointment‘),
(‘咨询‘, ‘record/appointmentlist‘),
(‘咨询主管‘, ‘record/appointmentlist‘),
(‘导医‘, ‘record/appointmentlist‘),
(‘管理员‘, ‘record/appointmentlist‘),
(‘网络总监‘, ‘record/appointmentlist‘),
(‘咨询主管‘, ‘record/del‘),
(‘管理员‘, ‘record/del‘),
(‘咨询‘, ‘record/edit‘),
(‘咨询主管‘, ‘record/edit‘),
(‘管理员‘, ‘record/edit‘),
(‘咨询‘, ‘record/index‘),
(‘咨询主管‘, ‘record/index‘),
(‘管理员‘, ‘record/index‘),
(‘网络总监‘, ‘record/index‘),
(‘咨询‘, ‘record/list‘),
(‘咨询主管‘, ‘record/list‘),
(‘管理员‘, ‘record/list‘),
(‘网络总监‘, ‘record/list‘),
(‘咨询‘, ‘Report‘),
(‘咨询主管‘, ‘Report‘),
(‘竞价‘, ‘Report‘),
(‘管理员‘, ‘Report‘),
(‘网络总监‘, ‘Report‘),
(‘管理员‘, ‘report/channel‘),
(‘网络总监‘, ‘report/channel‘),
(‘管理员‘, ‘report/channelreport‘),
(‘网络总监‘, ‘report/channelreport‘),
(‘咨询‘, ‘report/user‘),
(‘咨询主管‘, ‘report/user‘),
(‘竞价‘, ‘report/user‘),
(‘管理员‘, ‘report/user‘),
(‘网络总监‘, ‘report/user‘),
(‘咨询‘, ‘report/userreport‘),
(‘咨询主管‘, ‘report/userreport‘),
(‘竞价‘, ‘report/userreport‘),
(‘管理员‘, ‘report/userreport‘),
(‘网络总监‘, ‘report/userreport‘),
(‘管理员‘, ‘User‘),
(‘管理员‘, ‘user/del‘),
(‘管理员‘, ‘user/edit‘),
(‘管理员‘, ‘user/index‘),
(‘管理员‘, ‘user/list‘),
(‘管理员‘, ‘user/role‘),
(‘管理员‘, ‘user/roledel‘),
(‘管理员‘, ‘user/roleedit‘),
(‘管理员‘, ‘user/rolelist‘);
-- --------------------------------------------------------
--
-- 表的结构 `auth_rule`
--
CREATE TABLE IF NOT EXISTS `auth_rule` (
`name` varchar(64) NOT NULL,
`data` text,
`created_at` int(11) DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- 表的结构 `tbl_user`
--
CREATE TABLE IF NOT EXISTS `tbl_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`auth_key` varchar(50) NOT NULL,
`access_token` varchar(50) NOT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`enabled` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
--
-- 转存表中的数据 `tbl_user`
--
INSERT INTO `tbl_user` (`id`, `username`, `password`, `auth_key`, `access_token`, `created_at`, `updated_at`, `enabled`) VALUES
(1, ‘admin‘, ‘$2y$13$J0lXtYNHmwUs1X8kUE62dOte45Cmdm68qM9RvVQx/0scKsM4mFTAS‘, ‘uyd1EhlCtakkk4zP5ERN_PRjA7etK8CK‘, ‘‘, 1433556404, 1438870839, 1),
(2, ‘user1‘, ‘$2y$13$Wx77UBYyZMIMh1rjACmi/unNcpG8kF.s2.O2Pq/evSLo.No3IEQ4u‘, ‘ctpNT1G3ioE1OYcHentQqmnU4tuIiVt7‘, ‘‘, 1433556404, 1433568105, 1),
(4, ‘李某‘, ‘$2y$13$CPvWlvjxkPsEPh.Zl549v.f0n1vNtVGV1tw1qAfWipzX6ON7z8A.u‘, ‘_FnmPq_8ZFKFEmM07hM_zgkaX4_uTv_M‘, ‘‘, 1433565725, 1433565942, 1),
(5, ‘user2‘, ‘$2y$13$nCZUtNgU2dD5hP0eop6QkOo5oOCtsJvWmC9rWehzkvWZLS0SqgFUe‘, ‘WP9M-LeKpVIHFOvqCKCTJp0n1c9wjSiu‘, ‘‘, 1433566505, 1433573477, 1),
(6, ‘user3‘, ‘$2y$13$.2dakXf/MLj.HKqBna37OOK38IE/FXuQKB1zNq0ns3TaBLzQxtPFC‘, ‘HJtWAqBReSLhKOntnWb0Vgjc9KItf1IR‘, ‘‘, 1433566566, 1433566579, 1);