Casbin = way to authorization
A place for Casbin developers and users
Sign Up Now
For Existing Member  Sign In
Choose theme
Default ✅
v2ex-zhihu-theme 
tuyunlei
tuyunlei

我想了一个办法,不知道用起来怎么样

首先将默认权限的 policy 主体设为 default

然后 matcher 里对角色的匹配从

g (r.user, p.user)

改为

(g (r.user, p.user) || p.user == 'default')

About   ·   FAQ   ·   API   ·   Mission   ·   Advertise   ·   Thanks   ·   Tools   ·   20 Online   Highest 40   ·     Select Language  ·     Select Editor
Community of Creators
World is powered by code
VERSION: 2c477f2 · 9ms · UTC 09:09 · PVG 17:09 · LAX 02:09 · JFK 05:09
♥ Do have faith in what you're doing.