mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-09 17:57:38 +08:00
RBAC: decoupled rules from assignments and items, implemented php manager
This commit is contained in:
@ -9,36 +9,46 @@
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
drop table if exists 'auth_assignment';
|
||||
drop table if exists 'auth_item_child';
|
||||
drop table if exists 'auth_item';
|
||||
drop table if exists "auth_assignment";
|
||||
drop table if exists "auth_item_child";
|
||||
drop table if exists "auth_item";
|
||||
drop table if exists "auth_rule";
|
||||
|
||||
create table 'auth_item'
|
||||
create table "auth_rule"
|
||||
(
|
||||
"name" varchar(64) not null,
|
||||
"data" text,
|
||||
primary key ("name")
|
||||
);
|
||||
|
||||
create table "auth_item"
|
||||
(
|
||||
"name" varchar(64) not null,
|
||||
"type" integer not null,
|
||||
"description" text,
|
||||
"biz_rule" text,
|
||||
"rule_name" varchar(64),
|
||||
"data" text,
|
||||
primary key ("name"),
|
||||
foreign key ("rule_name") references "auth_rule" ("name") on delete set null on update cascade,
|
||||
key "type" ("type")
|
||||
);
|
||||
|
||||
create table 'auth_item_child'
|
||||
create table "auth_item_child"
|
||||
(
|
||||
"parent" varchar(64) not null,
|
||||
"child" varchar(64) not null,
|
||||
primary key ("parent","child"),
|
||||
foreign key ("parent") references 'auth_item' ("name") on delete cascade on update cascade,
|
||||
foreign key ("child") references 'auth_item' ("name") on delete cascade on update cascade
|
||||
foreign key ("parent") references "auth_item" ("name") on delete cascade on update cascade,
|
||||
foreign key ("child") references "auth_item" ("name") on delete cascade on update cascade
|
||||
);
|
||||
|
||||
create table 'auth_assignment'
|
||||
create table "auth_assignment"
|
||||
(
|
||||
"item_name" varchar(64) not null,
|
||||
"user_id" varchar(64) not null,
|
||||
"biz_rule" text,
|
||||
"rule_name" varchar(64),
|
||||
"data" text,
|
||||
primary key ("item_name","user_id"),
|
||||
foreign key ("item_name") references 'auth_item' ("name") on delete cascade on update cascade
|
||||
foreign key ("item_name") references "auth_item" ("name") on delete cascade on update cascade,
|
||||
foreign key ("rule_name") references "auth_rule" ("name") on delete set null on update cascade
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user