File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 11# yii2-rest-rbac
22
3-
43> Yii2权限系统,rest版,根据[ yii2-admin(https://github.com/mdmsoft/yii2-admin) ] ( https://github.com/mdmsoft/yii2-admin ) 修改
54
6-
75### ** 使用**
86
97* ** 配置oauth2和rbac**
4341 'class' => 'wind\rest\components\AccessControl',
4442 'allowActions' => [
4543 'site/*',//允许访问的节点,可自行添加
46- 'rbac/menu/user-menu',//允许所有人访问admin节点及其子节点
47- 'oauth2/*',//允许所有人访问admin节点及其子节点
44+ 'rbac/menu/user-menu',
45+ 'oauth2/*',
4846 ]
4947 ],
5048```
5149
5250
5351* ** 创建所需要的表**
54- ```
5552//用户表user和菜单表menu
53+ ``` php
5654yii migrate --migrationPath=@vendor/windhoney/yii2-rest-rbac/migrations
55+ ```
5756//rbac相关权限表
57+ ``` php
5858yii migrate --migrationPath=@yii/rbac/migrations/
59+ ```
5960//oauth2相关表
61+ ``` php
6062yii migrate --migrationPath=@vendor/filsh/yii2-oauth2-server/migrations
6163```
6264
6365* ** 添加路由配置**
6466
6567将yii2-rest-rbac/example/rbac_route.php文件内容配置到项目的urlManager的rules规则下
6668也可在main.php文件中 添加
67- ```
69+ ``` php
6870$dir = __DIR__ . "/route";
69- $main = RbacHelper::addRoute($dir, $main);
71+ $main = wind\rest\helper\ RbacHelper::addRoute($dir, $main);
7072return $main;
7173```
7274直接将此文件放到config/route/rbac_route.php
You can’t perform that action at this time.
0 commit comments