From 30f7b2ea9bc92b34afb7e261bf16959e735754f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=87=E5=B0=91=E6=B3=A2?= <756684177@qq.com> Date: Wed, 23 Mar 2022 14:18:52 +0800 Subject: [PATCH] =?UTF-8?q?Model=20=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/Model/RuleModel.php | 6 +++--- src/Permission.php | 4 ++-- src/config/plugin/casbin/webman-permission/permission.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e2f04ac..3d0bd1b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ An authorization library that supports access control models like ACL, RBAC, ABA ## Installation ```sh -composer require tinywan/casbin +composer require casbin/webman-permission ``` ## Configure diff --git a/src/Model/RuleModel.php b/src/Model/RuleModel.php index 815cc82..f61ee44 100644 --- a/src/Model/RuleModel.php +++ b/src/Model/RuleModel.php @@ -39,7 +39,7 @@ class RuleModel extends Model implements Arrayable * @access public * @param array $data 数据 */ - public function __construct($data = []) + public function __construct(array $data = []) { $this->connection = $this->config('database.connection') ?: ''; $this->table = $this->config('database.rules_table'); @@ -57,7 +57,7 @@ public function __construct($data = []) */ protected function config(string $key = null, $default = null) { - $driver = config('plugin.tinywan.casbin.permission.default'); - return config('plugin.tinywan.casbin.permission.' . $driver . '.' . $key, $default); + $driver = config('plugin.casbin.webman-permission.permission.default'); + return config('plugin.casbin.webman-permission.permission.' . $driver . '.' . $key, $default); } } diff --git a/src/Permission.php b/src/Permission.php index 93473f3..cff8dd3 100644 --- a/src/Permission.php +++ b/src/Permission.php @@ -48,9 +48,9 @@ class Permission implements Bootstrap { /** - * @var $_manager + * @var Enforcer|null $_manager */ - protected static $_manager = null; + protected static ?Enforcer $_manager = null; /** * @param Worker $worker diff --git a/src/config/plugin/casbin/webman-permission/permission.php b/src/config/plugin/casbin/webman-permission/permission.php index e9b6add..3d44e8d 100644 --- a/src/config/plugin/casbin/webman-permission/permission.php +++ b/src/config/plugin/casbin/webman-permission/permission.php @@ -10,7 +10,7 @@ # Model 设置 'model' => [ 'config_type' => 'file', - 'config_file_path' => config_path() . '/plugin/tinywan/casbin/rbac-model.conf', + 'config_file_path' => config_path() . '/plugin/casbin/webman-permission/rbac-model.conf', 'config_text' => '', ], # 适配器