-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Check for permission without a subject #1
Comments
Will I have no intention of mapping Laravel's functionality 1:1 I do see the use case for this. To register a function to resolve the permission you'd write like this: acl.rule('generate-statistics', user => user.isAdmin()) There is a bit of a conflict with the current implementation. The second argument to
1. Pass a 'global rule' subjectacl.rule('generate-statistics', Acl.GlobalRule, user => user.isAdmin()) pro: No API changes 2. Limit class names to begin with uppercaseE.g. if the function name is Post it is intended as subject but if function name is post, it will be treated as a handler. pro: simple API 3. Allow only nameless handler functionsThe third options is to assume that all handler functions are nameless. That way if you pass a nameless function as the second param (and there is no third argument) we'll know that we are dealing with a subjectless rule. UPDATE: Also this method will now allow you to pass additional params to the handler.
I'm leaning towards the third option as you'll usually use fat-arrow syntax or a nameless unbound function. |
Ok thanks |
The above is not implemented. Pushing a solution now. |
@shadoWalker89 please see this section https://github.com/mblarsen/browser-acl/tree/feat-global-rules#additional-parameters-and-global-rules --- does this fit your use case? |
@mblarsen yes |
It has been published as version 0.5.0 on npm |
Hi,
Laravel does not require a subject for permission checks, you can just do
I see that your package does require a subject wich will not allow doing what i described above.
The text was updated successfully, but these errors were encountered: