Add back TransientToken check (#968)

This commit is contained in:
MartinOscar 2025-02-05 12:58:10 +01:00 committed by GitHub
parent 431c1977e3
commit b8c1b68328
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@ namespace App\Http\Requests\Api\Application;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use App\Models\ApiKey; use App\Models\ApiKey;
use Laravel\Sanctum\TransientToken;
use Illuminate\Validation\Validator; use Illuminate\Validation\Validator;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use App\Services\Acl\Api\AdminAcl; use App\Services\Acl\Api\AdminAcl;
@ -36,9 +37,13 @@ abstract class ApplicationApiRequest extends FormRequest
throw new PanelException('An ACL resource must be defined on API requests.'); throw new PanelException('An ACL resource must be defined on API requests.');
} }
/** @var TransientToken|ApiKey $token */
$token = $this->user()->currentAccessToken(); $token = $this->user()->currentAccessToken();
/** @var ApiKey $token */ if ($token instanceof TransientToken) {
return true;
}
if ($token->key_type === ApiKey::TYPE_ACCOUNT) { if ($token->key_type === ApiKey::TYPE_ACCOUNT) {
return true; return true;
} }