47 lines
2.6 KiB
PHP
47 lines
2.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Operations;
|
|
|
|
enum ExecutionDenialReasonCode: string
|
|
{
|
|
case WorkspaceMismatch = 'workspace_mismatch';
|
|
case TenantNotEntitled = 'tenant_not_entitled';
|
|
case MissingCapability = 'missing_capability';
|
|
case TenantNotOperable = 'tenant_not_operable';
|
|
case TenantMissing = 'tenant_missing';
|
|
case InitiatorMissing = 'initiator_missing';
|
|
case InitiatorNotEntitled = 'initiator_not_entitled';
|
|
case ProviderConnectionInvalid = 'provider_connection_invalid';
|
|
case WriteGateBlocked = 'write_gate_blocked';
|
|
case ExecutionPrerequisiteInvalid = 'execution_prerequisite_invalid';
|
|
|
|
public function denialClass(): ExecutionDenialClass
|
|
{
|
|
return match ($this) {
|
|
self::WorkspaceMismatch, self::TenantNotEntitled, self::TenantMissing => ExecutionDenialClass::ScopeDenied,
|
|
self::MissingCapability => ExecutionDenialClass::CapabilityDenied,
|
|
self::TenantNotOperable => ExecutionDenialClass::TenantNotOperable,
|
|
self::ProviderConnectionInvalid, self::WriteGateBlocked, self::ExecutionPrerequisiteInvalid => ExecutionDenialClass::PrerequisiteInvalid,
|
|
self::InitiatorMissing, self::InitiatorNotEntitled => ExecutionDenialClass::InitiatorInvalid,
|
|
};
|
|
}
|
|
|
|
public function message(): string
|
|
{
|
|
return match ($this) {
|
|
self::WorkspaceMismatch => 'Operation blocked because the queued run no longer matches the current workspace scope.',
|
|
self::TenantNotEntitled => 'Operation blocked because the target tenant is no longer entitled for this run.',
|
|
self::MissingCapability => 'Operation blocked because the initiating actor no longer has the required capability.',
|
|
self::TenantNotOperable => 'Operation blocked because the target tenant is not currently operable for this action.',
|
|
self::TenantMissing => 'Operation blocked because the target tenant could not be resolved at execution time.',
|
|
self::InitiatorMissing => 'Operation blocked because the initiating actor could not be resolved at execution time.',
|
|
self::InitiatorNotEntitled => 'Operation blocked because the initiating actor is no longer entitled to the tenant.',
|
|
self::ProviderConnectionInvalid => 'Operation blocked because the provider connection is no longer valid for the queued scope.',
|
|
self::WriteGateBlocked => 'Operation blocked because write hardening currently refuses execution for this tenant.',
|
|
self::ExecutionPrerequisiteInvalid => 'Operation blocked because the queued execution prerequisites are no longer satisfied.',
|
|
};
|
|
}
|
|
}
|