From 7947cbe79bb4b4e84856214452ac828dec9d28eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=80=99=E5=AD=A6=E6=9D=B0?= Date: Wed, 7 Feb 2018 15:55:27 +0800 Subject: [PATCH] fix --- src/PdAuth/Middleware/Authenticate.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/PdAuth/Middleware/Authenticate.php b/src/PdAuth/Middleware/Authenticate.php index ee82fe3..5a92107 100644 --- a/src/PdAuth/Middleware/Authenticate.php +++ b/src/PdAuth/Middleware/Authenticate.php @@ -80,7 +80,14 @@ class Authenticate $match = []; foreach ($user['roles'] as $role) { if (array_key_exists($role, $privileges)) { - $match = array_merge($match,$privileges[$role]); + //如果设置了 * ,则跳过权限检测 + if (is_string($privileges[$role]) && $privileges[$role] == '*') { + return $next($request); + } + if (!is_array($privileges[$role])) { + throw new \Exception('pdauth 配置错误!'); + } + $match = array_merge($match, $privileges[$role]); } }