Closed zhengzhishanliang closed 2 years ago
@leeqvip
@zhengzhishanliang This is related to the priority of the policy. It works fine in your editor because this policy is hit first:
p, admin, domain1, /api/admins/permissions, get
If you move the (p, admin, domain1, /api/admins/permissions, *
) policy to the front and make it a higher priority, it will also generate an error. because *
is not a valid regular expression .
see: https://casbin.org/casbin-editor/#BNLXPXAK7
@leeqvip 由衷表示感谢!Thank you very much! you solved my problem. Allow me to ask an additional question: I want to have both and GET data for the same url, for example, "alice,/orders," means that alice can request /orders for GET/POST and /orders/:id for GET /PUT/DELETE. "bob ,/orders,GET" means that bob can only request /orders by GET. For this case, I can't use *, then how should I structure my data. Thanks again!
@zhengzhishanliang
alice, /orders, (get|post)
@leeqvip thanks !
背景: laravel8+,采取的是restful风格路由,角色绑定路由
1、在casbin的官网编辑器中示例如下:![1646038097(1)](https://user-images.githubusercontent.com/50315515/155952557-0382e6f5-6ddc-40f5-b978-55f197b8e2cf.png)
2、在laravel插件里配置如下:![1646038214](https://user-images.githubusercontent.com/50315515/155952777-8d489fe7-d2e3-4d7e-9f9a-7e64bb6318a3.png)
3、laravel代码如下:![1646038610(1)](https://user-images.githubusercontent.com/50315515/155953661-730d2b69-40f6-4ffb-b04a-41d52d0fde85.png)
4、请求结果如下:
![1646038706(1)](https://user-images.githubusercontent.com/50315515/155953948-51373b2f-ac4b-493c-88ab-0eac0c48daae.png)
5、查看日志问题出在regexMatch方法校验。![1646038768(1)](https://user-images.githubusercontent.com/50315515/155954124-1dcd6d21-e2de-4709-8fb4-f91a50f8b6e5.png)
6、我未重写regexMatch方法。
谢谢大佬们的指导,拜谢。