## Summary - remove tenant-based Graph options access from runtime service paths and enforce provider-only resolution - add `MicrosoftGraphOptionsResolver` and `ProviderConfigurationRequiredException` for centralized, actionable provider-config errors - turn `Tenant::graphOptions()` into a fail-fast kill switch to prevent legacy runtime usage - add and update tests (including guardrail) to enforce no reintroduction in `app/` - update Spec 088 artifacts (`spec`, `plan`, `research`, `tasks`, checklist) ## Validation - `vendor/bin/sail bin pint --dirty` - `vendor/bin/sail artisan test --compact --filter=NoLegacyTenantGraphOptions` - `vendor/bin/sail artisan test --compact tests/Feature/Filament` - `CI=1 vendor/bin/sail artisan test --compact` ## Notes - Branch includes the guardrail test for legacy callsite detection in `app/`. - Full suite currently green: 1227 passed, 5 skipped. Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box> Reviewed-on: #105
32 lines
857 B
PHP
32 lines
857 B
PHP
<?php
|
|
|
|
namespace App\Services\Providers;
|
|
|
|
use App\Models\Tenant;
|
|
|
|
final class MicrosoftGraphOptionsResolver
|
|
{
|
|
public function __construct(
|
|
private readonly ProviderConnectionResolver $connections,
|
|
private readonly ProviderGateway $gateway,
|
|
) {}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function resolveForTenant(Tenant $tenant, array $overrides = []): array
|
|
{
|
|
$resolution = $this->connections->resolveDefault($tenant, 'microsoft');
|
|
|
|
if (! $resolution->resolved || $resolution->connection === null) {
|
|
throw ProviderConfigurationRequiredException::forTenant(
|
|
$tenant,
|
|
provider: 'microsoft',
|
|
resolution: $resolution,
|
|
);
|
|
}
|
|
|
|
return $this->gateway->graphOptions($resolution->connection, $overrides);
|
|
}
|
|
}
|