Skip to content

Commit

Permalink
Add back TransientToken check (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
RMartinOscar authored Feb 5, 2025
1 parent 431c197 commit b8c1b68
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/Http/Requests/Api/Application/ApplicationApiRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Webmozart\Assert\Assert;
use App\Models\ApiKey;
use Laravel\Sanctum\TransientToken;
use Illuminate\Validation\Validator;
use Illuminate\Database\Eloquent\Model;
use App\Services\Acl\Api\AdminAcl;
Expand Down Expand Up @@ -36,9 +37,13 @@ public function authorize(): bool
throw new PanelException('An ACL resource must be defined on API requests.');
}

/** @var TransientToken|ApiKey $token */
$token = $this->user()->currentAccessToken();

/** @var ApiKey $token */
if ($token instanceof TransientToken) {
return true;
}

if ($token->key_type === ApiKey::TYPE_ACCOUNT) {
return true;
}
Expand Down

0 comments on commit b8c1b68

Please sign in to comment.