🚀 我的第一个webman插件webman/casbin权限控制插件

Tinywan

🔰🔰🔰 为了方便维护,源仓库 webman-casbin 插件贡献给了 PHP-Casbin 官方

🔰🔰🔰 为了方便维护,源仓库 webman-casbin 插件贡献给了 PHP-Casbin 官方

🔰🔰🔰 为了方便维护,源仓库 webman-casbin 插件贡献给了 PHP-Casbin 官方

立即使用 https://www.workerman.net/plugin/6

3027 7 1
7个评论

walkor

果然强大

  • 暂无评论
yzh52521

666

  • 暂无评论
Tinywan

该版本使用多进程 Redis Watcher替换了之前的定时器(Timer)模式(无效的刷新策略问题)

  1. 由于webman是基于workerman的常驻内存框架。运行模式为多进程,而多进程中数据是互相隔离的。
  2. 在webman中使用casbin,当Enforcer中的策略发生变化时,调用 Watcher,向消息队列(MQ)中推动消息,监听该消息队列的Enforcer收到后,自动刷新该实例中的策略
  3. 这里通过 workerman/redis 的发布订阅模式实现
864328615

ValueError: array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements in /Users/xx/office/xx/webman-admin/vendor/casbin/casbin/src/CoreEnforcer.php:644
Stack trace:
请问做权限验证 报这个错误是什么原因呢

864328615

截图 我这边么理解的 然后

if (Permission::enforce("test", "monitor", "serve")) {
echo '恭喜你!通过权限认证';
} else {
echo '对不起,您没有该资源访问权限';
}

就包错了 ValueError: array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements in /Users/xx/office/xx/webman-admin/vendor/casbin/casbin/src/CoreEnforcer.php:644

Tinywan

@864328615 正确的策略存储方式应该是这样的。你上面的存储方式明显是多了一列

截图

xtn

大佬 您好 可以使用laravel数据库吗 要如何需改?感谢

  • Tinywan 2023-07-25

    可以使用,直接配置就行了

年代过于久远,无法发表评论

Tinywan

11140
积分
0
获赞数
0
粉丝数
2020-01-14 加入
🔝