## Summary - move the Laravel application into `apps/platform` and keep the repository root for orchestration, docs, and tooling - update the local command model, Sail/Docker wiring, runtime paths, and ignore rules around the new platform location - add relocation quickstart/contracts plus focused smoke coverage for bootstrap, command model, routes, and runtime behavior ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/PlatformRelocation` - integrated browser smoke validated `/up`, `/`, `/admin`, `/admin/choose-workspace`, and tenant route semantics for `200`, `403`, and `404` ## Remaining Rollout Checks - validate Dokploy build context and working-directory assumptions against the new `apps/platform` layout - confirm web, queue, and scheduler processes all start from the expected working directory in staging/production - verify no legacy volume mounts or asset-publish paths still point at the old root-level `public/` or `storage/` locations Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #213
104 lines
3.6 KiB
PHP
104 lines
3.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Operations;
|
|
|
|
final readonly class QueuedExecutionLegitimacyDecision
|
|
{
|
|
/**
|
|
* @param array{identity_type:string,user_id:int|null}|null $initiator
|
|
* @param array{workspace_id:int,tenant_id:int|null,provider_connection_id:int|null} $targetScope
|
|
* @param array{workspace_scope:string,tenant_scope:string,capability:string,tenant_operability:string,execution_prerequisites:string} $checks
|
|
* @param array<string, mixed> $metadata
|
|
*/
|
|
public function __construct(
|
|
public string $operationType,
|
|
public bool $allowed,
|
|
public ExecutionAuthorityMode $authorityMode,
|
|
public ?array $initiator,
|
|
public array $targetScope,
|
|
public array $checks,
|
|
public ?ExecutionDenialClass $denialClass = null,
|
|
public ?ExecutionDenialReasonCode $reasonCode = null,
|
|
public bool $retryable = false,
|
|
public array $metadata = [],
|
|
) {}
|
|
|
|
/**
|
|
* @param array{workspace_scope:string,tenant_scope:string,capability:string,tenant_operability:string,execution_prerequisites:string} $checks
|
|
* @param array<string, mixed> $metadata
|
|
*/
|
|
public static function allow(QueuedExecutionContext $context, array $checks, array $metadata = []): self
|
|
{
|
|
return new self(
|
|
operationType: $context->operationType,
|
|
allowed: true,
|
|
authorityMode: $context->authorityMode,
|
|
initiator: $context->initiatorSnapshot(),
|
|
targetScope: $context->targetScope,
|
|
checks: $checks,
|
|
metadata: $metadata,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @param array{workspace_scope:string,tenant_scope:string,capability:string,tenant_operability:string,execution_prerequisites:string} $checks
|
|
* @param array<string, mixed> $metadata
|
|
*/
|
|
public static function deny(
|
|
QueuedExecutionContext $context,
|
|
array $checks,
|
|
ExecutionDenialReasonCode $reasonCode,
|
|
array $metadata = [],
|
|
): self {
|
|
$denialClass = $reasonCode->denialClass();
|
|
|
|
return new self(
|
|
operationType: $context->operationType,
|
|
allowed: false,
|
|
authorityMode: $context->authorityMode,
|
|
initiator: $context->initiatorSnapshot(),
|
|
targetScope: $context->targetScope,
|
|
checks: $checks,
|
|
denialClass: $denialClass,
|
|
reasonCode: $reasonCode,
|
|
retryable: $denialClass->isRetryable(),
|
|
metadata: $metadata,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @return array{workspace_scope:string,tenant_scope:string,capability:string,tenant_operability:string,execution_prerequisites:string}
|
|
*/
|
|
public static function defaultChecks(): array
|
|
{
|
|
return [
|
|
'workspace_scope' => 'not_applicable',
|
|
'tenant_scope' => 'not_applicable',
|
|
'capability' => 'not_applicable',
|
|
'tenant_operability' => 'not_applicable',
|
|
'execution_prerequisites' => 'not_applicable',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'operation_type' => $this->operationType,
|
|
'authority_mode' => $this->authorityMode->value,
|
|
'allowed' => $this->allowed,
|
|
'retryable' => $this->retryable,
|
|
'reason_code' => $this->reasonCode?->value,
|
|
'denial_class' => $this->denialClass?->value,
|
|
'initiator' => $this->initiator,
|
|
'target_scope' => $this->targetScope,
|
|
'checks' => $this->checks,
|
|
'metadata' => $this->metadata,
|
|
];
|
|
}
|
|
}
|