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

Rules support? #98

Open
ptheofan opened this issue Jun 21, 2021 · 1 comment
Open

Rules support? #98

ptheofan opened this issue Jun 21, 2021 · 1 comment

Comments

@ptheofan
Copy link

The project looks great but going through the documentation I could not find anything with regard to rules. If you wanted to do the typical following use case, how would you go about it with accesscontrol?

Author -> updateArticle::(only articles owned by author)
@hamxabaig
Copy link

@ptheofan I think it's in the documentation and is the very common use case. You could do the following:

ac.can(role).updateOwn('article')

article is the resource. Before this role, you have to make sure that the article in question is actually owned by that user. That "check" is not part of this library and that's something the application should do beforehand. It's in FAQs.

https://onury.io/accesscontrol/?content=faq#can-i-use-accesscontroljs-with-a-database--how-

Hope that helps.

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

No branches or pull requests

2 participants