accesscontrol
accesscontrol copied to clipboard
Rules support?
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)
@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.