Skip to content
New issue

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

[Question] How to get permissions while using resource roles #1360

Open
yanwii opened this issue Feb 19, 2024 · 2 comments
Open

[Question] How to get permissions while using resource roles #1360

yanwii opened this issue Feb 19, 2024 · 2 comments

Comments

@yanwii
Copy link

yanwii commented Feb 19, 2024

Want to prioritize this issue? Try:

issuehunt-to-marktext


What's your scenario? What do you want to achieve?
Your answer here

Your model:

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

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

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

[matchers]
m = g(r.sub, p.sub) && g2(r.obj, p.obj) && r.act == p.act

Your policy:

p, alice, data_group, write

g, alice, data_group_admin
g2, data1, data_group
g2, data2, data_group

Your request(s):

If I want to get all permissions for user alice and resource data1, it doesn't work

enforcer.GetFilteredPolicy(0, "alice", "data1")
expected: [["alice", "data1", "write"]...]
actual: []

enforcer.GetImplicitPermissionsForUser("alice") 
expected: [["alice", "data1", "write"]...]
actual: [["alice", "data_group", "write"]...]

Is there any API supporte this action?

@casbin-bot
Copy link
Member

@tangyang9464 @JalinWang

@hsluoyz
Copy link
Member

hsluoyz commented May 15, 2024

@yanwii right now, GetFilteredPolicy() doesn't support g or g2. GetImplicitPermissionsForUser() only supports g but doesn't support g2.

We need to support both g and g2 in GetImplicitPermissionsForUser()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants