adonis-guard
adonis-guard copied to clipboard
Async Gate functions issue
https://github.com/RomainLanz/adonis-guard/blob/d89338e00dca869e7ac0eb13b3c2e2a8a2dd7508/src/Middleware/Can.js#L14
I believe await
should be added to the condition in this line. If an async
function is added to Gate.define
, this condition will ignore the gate result and allow the unauthorized calls to pass.
Yes,
More information on this here: https://github.com/RomainLanz/adonis-guard/issues/5
Would you mind sharing a PR?
I created a Can
middleware in my project that overrides the middleware in adonis-guard. I only changed the following line in it.
if (!await guard.can(auth.user).pass(method).for(argument)) {
I can't push to this repo, in case you wanted me to create a PR for this fix.