## Summary - rebuild the public Tenantial homepage around an evidence-first Microsoft tenant governance narrative - replace the old hero visual with a new static dashboard preview and add dedicated Trust Bar and Feature Pillars sections - update the shared public shell, navigation, footer, dark design tokens, assets, and homepage content to match the new brand direction - align website smoke coverage and Spec 400 artifacts with the rebuilt homepage ## Testing - not run in this pass - updated website smoke specs under apps/website/tests/smoke ## Note - `website-dev` was pushed to `origin` so the requested PR base exists remotely - the remote `website-dev` branch is an ancestor of `origin/dev`, so this PR may also show upstream `dev` history relative to that base Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #387
117 lines
3.9 KiB
PHP
117 lines
3.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Tenant;
|
|
use App\Models\User;
|
|
use App\Models\WorkspaceMembership;
|
|
use App\Policies\TenantOnboardingSessionPolicy;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Illuminate\Auth\Access\Response;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('returns not found for actors outside the active workspace when viewing a draft', function (): void {
|
|
$tenant = Tenant::factory()->onboarding()->create();
|
|
$owner = User::factory()->create();
|
|
$otherWorkspaceUser = User::factory()->create();
|
|
$otherWorkspace = \App\Models\Workspace::factory()->create();
|
|
|
|
createUserWithTenant(
|
|
tenant: $tenant,
|
|
user: $owner,
|
|
role: 'owner',
|
|
workspaceRole: 'owner',
|
|
ensureDefaultMicrosoftProviderConnection: false,
|
|
);
|
|
|
|
WorkspaceMembership::factory()->create([
|
|
'workspace_id' => (int) $otherWorkspace->getKey(),
|
|
'user_id' => (int) $otherWorkspaceUser->getKey(),
|
|
'role' => 'owner',
|
|
]);
|
|
|
|
$draft = createOnboardingDraft([
|
|
'workspace' => $tenant->workspace,
|
|
'tenant' => $tenant,
|
|
'started_by' => $owner,
|
|
'updated_by' => $owner,
|
|
]);
|
|
|
|
session()->put(WorkspaceContext::SESSION_KEY, (int) $otherWorkspace->getKey());
|
|
|
|
$result = app(TenantOnboardingSessionPolicy::class)->view($otherWorkspaceUser, $draft);
|
|
|
|
expect($result)->toBeInstanceOf(Response::class)
|
|
->and($result->allowed())->toBeFalse()
|
|
->and($result->status())->toBe(404);
|
|
});
|
|
|
|
it('returns not found for workspace members missing linked tenant entitlement', function (): void {
|
|
$tenant = Tenant::factory()->onboarding()->create();
|
|
$owner = User::factory()->create();
|
|
$workspaceOnlyUser = User::factory()->create();
|
|
|
|
createUserWithTenant(
|
|
tenant: $tenant,
|
|
user: $owner,
|
|
role: 'owner',
|
|
workspaceRole: 'owner',
|
|
ensureDefaultMicrosoftProviderConnection: false,
|
|
);
|
|
|
|
WorkspaceMembership::factory()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'user_id' => (int) $workspaceOnlyUser->getKey(),
|
|
'role' => 'owner',
|
|
]);
|
|
|
|
$draft = createOnboardingDraft([
|
|
'workspace' => $tenant->workspace,
|
|
'tenant' => $tenant,
|
|
'started_by' => $owner,
|
|
'updated_by' => $owner,
|
|
]);
|
|
|
|
session()->put(WorkspaceContext::SESSION_KEY, (int) $tenant->workspace_id);
|
|
|
|
$result = app(TenantOnboardingSessionPolicy::class)->view($workspaceOnlyUser, $draft);
|
|
|
|
expect($result)->toBeInstanceOf(Response::class)
|
|
->and($result->allowed())->toBeFalse()
|
|
->and($result->status())->toBe(404);
|
|
});
|
|
|
|
it('returns an honest forbidden message for entitled actors missing onboarding capability', function (): void {
|
|
$tenant = Tenant::factory()->onboarding()->create();
|
|
$readonlyUser = User::factory()->create();
|
|
|
|
createUserWithTenant(
|
|
tenant: $tenant,
|
|
user: $readonlyUser,
|
|
role: 'readonly',
|
|
workspaceRole: 'readonly',
|
|
ensureDefaultMicrosoftProviderConnection: false,
|
|
);
|
|
|
|
$draft = createOnboardingDraft([
|
|
'workspace' => $tenant->workspace,
|
|
'tenant' => $tenant,
|
|
'started_by' => $readonlyUser,
|
|
'updated_by' => $readonlyUser,
|
|
]);
|
|
|
|
session()->put(WorkspaceContext::SESSION_KEY, (int) $tenant->workspace_id);
|
|
|
|
$viewResult = app(TenantOnboardingSessionPolicy::class)->view($readonlyUser, $draft);
|
|
$cancelResult = app(TenantOnboardingSessionPolicy::class)->cancel($readonlyUser, $draft);
|
|
|
|
expect($viewResult)->toBeInstanceOf(Response::class)
|
|
->and($viewResult->allowed())->toBeFalse()
|
|
->and($viewResult->message())->toBe('You do not have permission to continue this onboarding draft.')
|
|
->and($cancelResult)->toBeInstanceOf(Response::class)
|
|
->and($cancelResult->allowed())->toBeFalse()
|
|
->and($cancelResult->message())->toBe('You do not have permission to cancel this onboarding draft.');
|
|
});
|