-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
Handle multiple guards. #489
Conversation
@derekrprice Can we make it to work like this: |
The parsing would be easy enough, but how do you want me to make that work with the "require_all" flag? That is documented here as being separated from "guard:" specs by a pipe. Can I assume that require_all will always come first? If it appears like this, "guard:api|require_all", the syntax you suggested will interpret "require_all" as a guard, and that might be a breaking change for existing implementations. Similarly, requiring a comma between require_all and guard: could disambiguate it, but that would also be a breaking change. |
I think that one is separated by the comma as you can see here: |
I was worried about this one: |
I made this change locally and, in fact, you have several tests that use the
|
I suppose that I could just add a special case to the parser and assume that require_all isn't a guard regardless of where it appears, for backwards compatibility. Is that what you want me to do? |
Done. Any of these syntaxes work correctly now:
Also should be resilient to stupid mistakes like the following, (silently) falling back on the default guard in all cases:
|
Sorry @derekrprice I think your first option was the best one. Because the third set after the second comma are the extra options for the middleware so it's better to repeat |
Shoot. I force-pushed the change. Is there a way to revert a single commit after an |
Maybe you can close the PR, delete the remote branch and in your local revert to the previous commit and then push it again and open the PR again |
The |
There you go. Didn't have to redo too much. |
This has been outstanding a long time. I still like the syntax, but I don't think my implementation was correct. This allowed the multiple guards but would sometimes find the wrong user when there was an ID overlap. In any case, I'm no longer working with the code that I needed this for, so I am just going to close this PR. |
Fixes #488.