## Summary - consolidate internal platform naming from `Tenant` to `Environment` / `ManagedEnvironment` across models, controllers, services, and Filament resources - rename environment-scoped UI surfaces such as dashboards, chooser flows, navigation, and related widgets to match the updated environment-first domain language - align middleware, onboarding/review lifecycle services, jobs, and route/context controllers with the new environment-scoped architecture ## Validation - not rerun as part of this commit/push/PR request ## Notes - branch is 1 commit ahead of `platform-dev` - main commit: `refactor: consolidate internal tenant model naming` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #355
54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Livewire\TrustedState;
|
|
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Models\ManagedEnvironmentOnboardingSession;
|
|
use App\Models\User;
|
|
use App\Models\Workspace;
|
|
use App\Services\Onboarding\OnboardingDraftResolver;
|
|
use App\Services\System\AllowedTenantUniverse;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Illuminate\Http\Request;
|
|
|
|
final class TrustedStateResolver
|
|
{
|
|
/**
|
|
* @return array<string>
|
|
*/
|
|
public function requiredAuthoritySources(string $component, TrustedStatePolicy $policy): array
|
|
{
|
|
return $policy->forComponent($component)['authority_sources'];
|
|
}
|
|
|
|
public function currentWorkspaceForMember(User $user, WorkspaceContext $workspaceContext, ?Request $request = null): Workspace
|
|
{
|
|
return $workspaceContext->currentWorkspaceForMemberOrFail($user, $request);
|
|
}
|
|
|
|
public function resolveOnboardingDraft(
|
|
ManagedEnvironmentOnboardingSession|int|string $draft,
|
|
User $user,
|
|
Workspace $workspace,
|
|
OnboardingDraftResolver $resolver,
|
|
): ManagedEnvironmentOnboardingSession {
|
|
return $resolver->resolveForTrustedAction($draft, $user, $workspace);
|
|
}
|
|
|
|
public function resolveAllowedTenantProposal(
|
|
int|string|null $tenantId,
|
|
AllowedTenantUniverse $allowedTenantUniverse,
|
|
): ?ManagedEnvironment {
|
|
return $allowedTenantUniverse->resolveAllowed($tenantId);
|
|
}
|
|
|
|
public function resolveAllowedTenantProposalOrFail(
|
|
int|string|null $tenantId,
|
|
AllowedTenantUniverse $allowedTenantUniverse,
|
|
): ManagedEnvironment {
|
|
return $allowedTenantUniverse->resolveAllowedOrFail($tenantId);
|
|
}
|
|
}
|