Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

How dose g(r.sub, p.sub) work? #1

Open
txjjjjj opened this issue Jan 21, 2020 · 4 comments
Open

How dose g(r.sub, p.sub) work? #1

txjjjjj opened this issue Jan 21, 2020 · 4 comments

Comments

@txjjjjj
Copy link

txjjjjj commented Jan 21, 2020

m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act 
# defines the workflow of authorization:
1. check user's role 
2. check the resource which user is trying to access
3. check the action of user.

can u explain how dose this 1. check user's role work ?
why should we pass r.sub and p.sub info g() when we check if a user belongs to a group?
if a user do not belong to a group just return faild?

@txjjjjj txjjjjj changed the title how g(r.sub, p.sub) work? How dose g(r.sub, p.sub) work? Jan 21, 2020
@maxwellhertz
Copy link
Owner

m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act 
# defines the workflow of authorization:
1. check user's role 
2. check the resource which user is trying to access
3. check the action of user.

can u explain how dose this 1. check user's role work ?
why should we pass r.sub and p.sub info g() when we check if a user belongs to a group?
if a user do not belong to a group just return faild?

Hi, mmaotai. I haven't dived into the source code of Casbin yet but my instinct tells me that you're right.

@hsluoyz
Copy link

hsluoyz commented Jan 21, 2020

@mmaotai you are right. See the docs: https://casbin.org/docs/en/rbac

@txjjjjj
Copy link
Author

txjjjjj commented Jan 22, 2020

@mmaotai you are right. See the docs: casbin.org/docs/en/rbac

I have to say, its documents are really unfriendly.

It's a great tool,
Can you write the document and the case more clearly?

@hsluoyz
Copy link

hsluoyz commented Jan 22, 2020

@mmaotai can you describe which part of docs needs to be improved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants