1111
1212An authorization library that supports access control models like ACL, RBAC, ABAC for webman plugin
1313
14- ## Installation
14+ # 安装
1515
1616``` sh
1717composer require -W casbin/webman-permission
1818```
1919
20- ## Configuration
20+ # 使用
2121
22- ### 1. DI Configuration
22+ > ** 1. 依赖注入配置 **
2323
24- ` config/container.php ` :
24+ 修改配置 ` config/container.php ` ,其最终内容如下 :
2525
2626``` php
2727$builder = new \DI\ContainerBuilder();
@@ -30,17 +30,19 @@ $builder->useAutowiring(true);
3030return $builder->build();
3131```
3232
33- ### 2. database
33+ > ** 2. 数据库配置 **
3434
35- > 默认策略存储是使用的` ThinkORM ` 。
36- > 如使用 ` laravel ` 的数据库 [ illuminate/database] ( https://github.com/illuminate/database ) ,请按照官方文档按照相应的依赖包:https://www.workerman.net/doc/webman/db/tutorial.html
35+ 默认策略存储是使用的ThinkORM。
3736
38- ** 模型配置**
37+ ** 1、 模型配置**
3938
4039默认使用ThinkORM。修改数据库 ` thinkorm.php ` 配置
4140
42- ` casbin_rule ` 表
41+ > 如使用laravel数据库,配置参考如下
42+ - 修改数据库 ` database.php ` 配置
43+ - 修改数据库 ` permission.php ` 的` adapter ` 适配器为laravel适配器
4344
45+ ** 2、创建 ` casbin_rule ` 数据表**
4446``` sql
4547CREATE TABLE `casbin_rule ` (
4648 ` id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -61,8 +63,9 @@ CREATE TABLE `casbin_rule` (
6163 KEY ` idx_v5` ( ` v5` ) USING BTREE
6264) ENGINE = INNODB CHARSET = utf8mb4 COMMENT = ' 策略规则表' ;
6365```
66+ ** 3、配置 ` config/redis ` 配置**
6467
65- ## 重启webman
68+ ** 4、 重启webman**
6669
6770```
6871php start.php restart
@@ -72,9 +75,7 @@ php start.php restart
7275php start.php restart -d
7376```
7477
75- ## 用法
76-
77- ### 快速开始
78+ # 使用
7879
7980安装成功后,可以这样使用:
8081
@@ -99,7 +100,7 @@ if (\Casbin\WebmanPermission\Permission::enforce('eve', 'articles', 'edit')) {
99100}
100101```
101102
102- ### 多套驱动配置
103+ # 多套驱动配置
103104
104105``` php
105106$permission = \Casbin\WebmanPermission\Permission::driver('restful_conf');
@@ -119,14 +120,14 @@ if ($permission->enforce('eve', 'articles', 'edit')) {
119120
120121更多 ` API ` 参考 [ Casbin API] ( https://casbin.org/docs/en/management-api ) 。
121122
122- ## 教程
123+ # 教程
123124* [ Casbin权限实战:入门分享(中文)] ( https://www.bilibili.com/video/BV1A541187M4/?vd_source=a9321be9ed112f8d6fdc8ee87640be1b )
124125* [ Casbin权限实战:基于角色的RBAC授权] ( https://www.bilibili.com/video/BV1A541187M4/?vd_source=a9321be9ed112f8d6fdc8ee87640be1b )
125126* [ Casbin权限实战:RESTful及中间件使用] ( https://www.bilibili.com/video/BV1uk4y117up/?vd_source=a9321be9ed112f8d6fdc8ee87640be1b )
126127* [ Casbin权限实战:如何使用自定义匹配函数] ( https://www.bilibili.com/video/BV1dq4y1Z78g/?vd_source=a9321be9ed112f8d6fdc8ee87640be1b )
127128* [ Webman实战教程:如何使用casbin权限控制] ( https://www.bilibili.com/video/BV1X34y1Q7ZH/?vd_source=a9321be9ed112f8d6fdc8ee87640be1b )
128129
129- ## 感谢
130+ # 感谢
130131
131132[ Casbin] ( https://github.com/php-casbin/php-casbin ) ,你可以查看全部文档在其 [ 官网] ( https://casbin.org/ ) 上。
132133
0 commit comments