Casbin Forum runs on Casnode, the open-source Discourse-style forum. Try the Casnode demo →
Casbin Forum

Hello Everyone,

I'm new to casbin and trying to develop the authorization using jcasbin lib.I am able to develop all the happy flows but stuck with few ABAC usecases. Therefore, need seeking your help

[policy_definition]
p = sub, sub_role, obj, condition, act

role definition

[role_definition]
g = _, _

Policies are
p, alice, contractor, data1, r.obj.creator_id == p.sub, read
p, bob, admin, data2, (r.obj.creator_id == p.sub && r.sub_role == p.sub_role), write
p, *, admin, data2, (r.obj.creator_id == p.sub && r.sub_role == p.sub_role), read

g, bob, admin
g, alice, contractor

I'm trying to get all the permissions for user bob using getImplicitPermissionsForUser("bob") but to my surprise, it is only fetching [p, bob, admin, data2, (r.obj.creator_id == p.sub && r.sub_role == p.sub_role), write] and not fetching it's implicit permissions as admin one.

Could someone see if there is any issue with this method as it tries to search at the principal index though it should have searched at role index.

Will really appreciate.

Thanks,
Abhinav

1views
2users
1 minread
1 / 2
Jul 2024