TenantAtlas/apps/platform/app/Services/TenantConfiguration/ExchangePowerShellContentOnlyEvidenceGuard.php
ahmido a23131cdbc feat: add Exchange evidence capture adapter guard (#501)
Summary: add Spec 434 Exchange PowerShell evidence capture adapter and prerequisite/identity/content-only guards; cap Exchange evidence at content_backed while preserving Graph capture. Validation: php artisan test --filter=Spec434 --compact; ./vendor/bin/pint --dirty --test; git diff --cached --check. Product Surface: N/A - no rendered UI surface changed; no deployment impact.
Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #501
2026-07-08 10:46:05 +00:00

38 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Services\TenantConfiguration;
use App\Models\TenantConfigurationResource;
use App\Models\TenantConfigurationResourceEvidence;
use App\Support\TenantConfiguration\ClaimState;
use App\Support\TenantConfiguration\CoverageLevel;
use App\Support\TenantConfiguration\EvidenceState;
use InvalidArgumentException;
final class ExchangePowerShellContentOnlyEvidenceGuard
{
public function maximumCoverageLevel(): CoverageLevel
{
return CoverageLevel::ContentBacked;
}
public function assertContentOnly(
TenantConfigurationResourceEvidence $evidence,
TenantConfigurationResource $resource,
): void {
if ($evidence->coverage_level !== CoverageLevel::ContentBacked) {
throw new InvalidArgumentException('Exchange PowerShell evidence exceeded the content-backed maximum.');
}
if ($evidence->evidence_state !== EvidenceState::ContentBacked) {
throw new InvalidArgumentException('Exchange PowerShell evidence state must remain content-backed.');
}
if ($resource->latest_claim_state !== ClaimState::InternalOnly) {
throw new InvalidArgumentException('Exchange PowerShell evidence must remain internal-only for this slice.');
}
}
}