Skip to content

add_named_matching_func not fully functional in 1.2.0 #171

@natbusa

Description

@natbusa

Hi, there is some change applied in 1.2.0 which is preventing the following code and rules to run as they were in 1.1.3
The policy was working fine in 1.1.3. I believe it has something to do with "g2", add_named_matching_func and fm functions

code:

enforcer = casbin.Enforcer("./rbac.conf", "./policy.csv")
enforcer.add_named_matching_func("g2", enforcer.fm.fm["globMatch"])

rbac.conf:

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, role

[role_definition]
g  = _, _
g2 = _, _

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

[matchers]
m = g2(r.act, p.role) && (g(r.sub, p.sub) || p.sub=='*') && keyMatch(r.obj, p.obj)

policy.csv

p, root, *, owner
g, root@localhost, root
g2, *.*, owner

expected:
root@localhost, /, org.create -> PASS (get a FAIL in 1.2.0)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions