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

Hi everyone, how are you?

I read the casbin docs and I found this: https://casbin.org/docs/rbac-api#getimplicitresourcesforuser
GetImplicitResourcesForUser returns all policies that should be true for user.
For example:

p, alice, data1, read
p, bob, data2, write
p, data2_admin, data2, read
p, data2_admin, data2, write

g, alice, data2_admin

GetImplicitResourcesForUser("alice") will return [[alice data1 read] [alice data2 read] [alice data2 write]]```

This is good, I need this in my project. However, I need the opposite as well. Get all user (implicit as well) for a resource.
For example1:

p, alice, data1, read
p, bob, data2, write
p, data2_admin, data2, read
p, data2_admin, data2, write

g, alice, data2_admin

GetImplicitUsersForResource("data2") will return [[alice data2 read] [alice data2 write] [bob data2 write]]```

For example2:

p, alice, data1, read
p, bob, data2, write
p, data2_admin, data2, read
p, data2_admin, data2, write

g, alice, data2_admin

GetImplicitUsersForResource("data1") will return [[alice data1 read]]```

Can I get this result? Did I miss something in the docs?
1views
1 minread
1 / 3
May 2023