Skip to content

Commit

Permalink
Merge pull request #9 from windhoney/develop
Browse files Browse the repository at this point in the history
no message
  • Loading branch information
windhoney committed Sep 28, 2017
2 parents 91bb202 + 880ebe2 commit 0b3ff0c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# yii2-rest-rbac


> Yii2权限系统,rest版,根据[yii2-admin(https://github.com/mdmsoft/yii2-admin)](https://github.com/mdmsoft/yii2-admin)修改

### **使用**

* **配置oauth2和rbac**
Expand Down Expand Up @@ -43,30 +41,34 @@
'class' => 'wind\rest\components\AccessControl',
'allowActions' => [
'site/*',//允许访问的节点,可自行添加
'rbac/menu/user-menu',//允许所有人访问admin节点及其子节点
'oauth2/*',//允许所有人访问admin节点及其子节点
'rbac/menu/user-menu',
'oauth2/*',
]
],
```


* **创建所需要的表**
```
//用户表user和菜单表menu
```php
yii migrate --migrationPath=@vendor/windhoney/yii2-rest-rbac/migrations
```
//rbac相关权限表
```php
yii migrate --migrationPath=@yii/rbac/migrations/
```
//oauth2相关表
```php
yii migrate --migrationPath=@vendor/filsh/yii2-oauth2-server/migrations
```

* **添加路由配置**

将yii2-rest-rbac/example/rbac_route.php文件内容配置到项目的urlManager的rules规则下
也可在main.php文件中 添加
```
```php
$dir = __DIR__ . "/route";
$main = RbacHelper::addRoute($dir, $main);
$main = wind\rest\helper\RbacHelper::addRoute($dir, $main);
return $main;
```
直接将此文件放到config/route/rbac_route.php
Expand Down

0 comments on commit 0b3ff0c

Please sign in to comment.