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

How do I fetch all the permissions using batch enforce, can you point me to any doc or example

A

@hsluoyz But I dont want to enforce, instead I want to retrieve all the permissions (Implicit included) assigned to a user

A

Hello Everyone,

I'm trying to get all the permissions for user bob using getImplicitPermissionsForUser("userA") but to my surprise, it is only fetching the policy directly assigned to user - userA and not fetching implicit permission of admin role.

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

looks to me a bug in the getImplicitPermissionsForUser("userA") method. Could someone check and let me know what could be wrong here.

Thanks,

A

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