## Summary - add Spec 288 no-legacy route/helper and provider-core/role-authority guard coverage - extend the pinned Spec 281 and Spec 285 browser smokes plus lane/report classification wording for classification-only fallout handling - add the Spec 288 artifact package and contributor-facing quality-gate guidance while keeping Package Execution deferred to Spec 289 ## Validation - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && REPO_ROOT="$(git rev-parse --show-toplevel)" && (cd "$REPO_ROOT/apps/platform" && ./vendor/bin/sail artisan test --compact tests/Feature/Guards/Spec288NoLegacyRouteAndHelperGuardTest.php tests/Feature/Guards/Spec288ProviderCoreAndRoleAuthorityGuardTest.php tests/Feature/Guards/AdminWorkspaceRoutesGuardTest.php tests/Feature/Guards/ProviderBoundaryPlatformCoreGuardTest.php tests/Feature/ProviderConnections/LegacyRedirectTest.php tests/Feature/ManagedEnvironment/LegacyTenantCoreGuardTest.php tests/Feature/Spec080WorkspaceManagedTenantAdminMigrationTest.php tests/Feature/Rbac/ProviderConnectionWorkspaceFirstPolicyTest.php tests/Feature/Filament/ManagedEnvironmentAccessScopeManagementTest.php tests/Feature/Guards/BrowserLaneIsolationTest.php tests/Feature/Guards/CiLaneFailureClassificationContractTest.php tests/Feature/Guards/CiHeavyBrowserWorkflowContractTest.php tests/Unit/Auth/NoRoleStringChecksTest.php)` - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && REPO_ROOT="$(git rev-parse --show-toplevel)" && (cd "$REPO_ROOT/apps/platform" && ./vendor/bin/sail artisan test --compact tests/Browser/Spec281ProviderConnectionScopeSmokeTest.php tests/Browser/Spec285WorkspaceRbacEnvironmentAccessSmokeTest.php)` - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && REPO_ROOT="$(git rev-parse --show-toplevel)" && (cd "$REPO_ROOT/apps/platform" && ./vendor/bin/sail bin pint --dirty --format agent)` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #347
78 lines
3.0 KiB
PHP
78 lines
3.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\FindingResource;
|
|
use App\Models\Finding;
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Models\User;
|
|
use App\Models\Workspace;
|
|
use App\Models\WorkspaceMembership;
|
|
use App\Services\Auth\TenantMembershipManager;
|
|
use App\Services\Auth\WorkspaceMembershipManager;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
pest()->browser()->timeout(20_000);
|
|
|
|
it('smokes workspace role management plus scoped environment drilldown', function (): void {
|
|
$workspace = Workspace::factory()->create([
|
|
'name' => 'Spec 285 Workspace',
|
|
]);
|
|
$allowedTenant = ManagedEnvironment::factory()->active()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'name' => 'Spec 285 Allowed',
|
|
'slug' => 'spec-285-allowed',
|
|
]);
|
|
$deniedTenant = ManagedEnvironment::factory()->active()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'name' => 'Spec 285 Denied',
|
|
'slug' => 'spec-285-denied',
|
|
]);
|
|
$owner = User::factory()->create();
|
|
$member = User::factory()->create();
|
|
|
|
WorkspaceMembership::factory()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'user_id' => (int) $owner->getKey(),
|
|
'role' => 'owner',
|
|
]);
|
|
$memberMembership = WorkspaceMembership::factory()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'user_id' => (int) $member->getKey(),
|
|
'role' => 'readonly',
|
|
]);
|
|
|
|
app(WorkspaceMembershipManager::class)->changeRole($workspace, $owner, $memberMembership, 'operator');
|
|
app(TenantMembershipManager::class)->grantScope($allowedTenant, $owner, $member, source: 'manual');
|
|
|
|
Finding::factory()->for($allowedTenant)->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'severity' => Finding::SEVERITY_HIGH,
|
|
]);
|
|
|
|
$this->actingAs($member)->withSession([
|
|
WorkspaceContext::SESSION_KEY => (int) $workspace->getKey(),
|
|
]);
|
|
session()->put(WorkspaceContext::SESSION_KEY, (int) $workspace->getKey());
|
|
|
|
$managedTenantsPath = (string) parse_url(route('admin.workspace.managed-tenants.index', ['workspace' => $workspace]), PHP_URL_PATH);
|
|
$findingsIndexPath = (string) parse_url(FindingResource::getUrl('index', tenant: $allowedTenant, panel: 'admin'), PHP_URL_PATH);
|
|
|
|
visit(route('admin.workspace.managed-tenants.index', ['workspace' => $workspace]))
|
|
->waitForText('Spec 285 Allowed')
|
|
->assertScript("window.location.pathname === '{$managedTenantsPath}'", true)
|
|
->assertSee('Spec 285 Allowed')
|
|
->assertDontSee('Spec 285 Denied')
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
|
|
visit(FindingResource::getUrl('index', tenant: $allowedTenant, panel: 'admin'))
|
|
->waitForText('Findings')
|
|
->assertScript("window.location.pathname === '{$findingsIndexPath}'", true)
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoConsoleLogs();
|
|
});
|