donjan-deng / hyperf-casbin

适配 Hyperf 的开源访问控制框架Casbin
Apache License 2.0
88 stars 21 forks source link

hyperf3.0 删除全部权限 ErrorException: Undefined property: Swoole\Coroutine\Http\Server::$setting #33

Open spaceBlack opened 1 year ago

spaceBlack commented 1 year ago

//model ** [request_definition] r = sub, obj, act

[policy_definition] p = sub, obj, act

[roledefinition] g = , _

[policy_effect] e = some(where (p.eft == allow))

[matchers] m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act ** //调用接口 Enforcer::deletePermissionsForUser($id); //报错 [ERROR] ErrorException: Undefined property: Swoole\Coroutine\Http\Server::$setting in /data/project/vendor/donjan-deng/hyperf-casbin/src/Process/CasbinProcess.php:34 Stack trace:

0 /data/project/vendor/donjan-deng/hyperf-casbin/src/Process/CasbinProcess.php(34): Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler::Hyperf\ExceptionHandler\Listener{closure}()

1 [internal function]: Donjan\Casbin\Process\CasbinProcess->Donjan\Casbin\Process{closure}()

2 /data/project/vendor/hyperf/redis/src/RedisConnection.php(197): Redis->subscribe()

3 /data/project/vendor/hyperf/redis/src/RedisConnection.php(83): Hyperf\Redis\RedisConnection->retry()

4 /data/project/vendor/hyperf/redis/src/Redis.php(40): Hyperf\Redis\RedisConnection->__call()

5 /data/project/vendor/donjan-deng/hyperf-casbin/src/Process/CasbinProcess.php(38): Hyperf\Redis\Redis->__call()

6 /data/project/vendor/hyperf/process/src/AbstractProcess.php(134): Donjan\Casbin\Process\CasbinProcess->handle()

7 /data/project/vendor/hyperf/utils/src/Coroutine.php(67): Hyperf\Process\AbstractProcess->Hyperf\Process{closure}()

8 {main}

hsluoyz commented 1 year ago

@donjan-deng

donjan-deng commented 1 year ago

检查redis是否连接成功,推荐使用username对用户进行授权,而不是id

dygin commented 1 year ago

这个关于Server类直接查看hyperf的autoload下的server配置就好,你的type应该引用的是CoroutineServer 去掉或者改成Server就好了