We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type User struct { Name string Age int } var abacConf = `[request_definition] r = sub, obj, act [policy_definition] p = sub_rule, obj, act [policy_effect] e = some(where (p.eft == allow)) [matchers] m = eval(p.sub_rule) && r.obj == p.obj && r.act == p.act || r.sub.Name == 'admin'` func TestABAC(t *testing.T) { m, _ := model.NewModelFromString(abacConf) e, _ := casbin.NewEnforcer(m, false) // e.AddPolicy("r.sub.Age > 18", "res", "read") // if uncomment this line, we get result(ok is true, err is nil). ok, err := e.Enforce(&User{ Name: "admin", Age: 17, }, "res", "read") t.Log(ok, err) // false please make sure rule exists in policy when using eval() in matcher }
it returns the error now even that sub is a admin, how to deal with this?
The text was updated successfully, but these errors were encountered:
@tangyang9464 @JalinWang
Sorry, something went wrong.
hsluoyz
No branches or pull requests
it returns the error now even that sub is a admin, how to deal with this?
The text was updated successfully, but these errors were encountered: