TenantAtlas/apps/platform/app/Support/Navigation/NavigationScope.php
ahmido 5722c4f051 feat: clean up managed environment terminology copy (#353)
## Summary
- replace tenant-first operator copy with environment and managed environment terminology across Filament pages, resources, services, Blade views, and localization
- align baseline compare, findings, governance, monitoring, backup schedule, and required-permissions surfaces with the managed-environment vocabulary
- update guard, feature, and browser smoke coverage and add the Spec 298 audit artifacts documenting allowed provider, internal, and regression-guard tenant references

## Validation
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Guards
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Localization
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Workspaces
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/ProviderConnections
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/RequiredPermissions
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Browser/Spec190BaselineCompareMatrixSmokeTest.php tests/Browser/Spec281ProviderConnectionScopeSmokeTest.php tests/Browser/Spec285WorkspaceRbacEnvironmentAccessSmokeTest.php tests/Browser/Dashboard/TenantDashboardProductizationSmokeTest.php
- cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent

## Notes
- Filament remains on Livewire v4.
- No panel provider or asset-strategy changes are included in this branch.
- Existing destructive actions retain their confirmation and authorization behavior.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #353
2026-05-13 09:34:08 +00:00

56 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Support\Navigation;
use App\Support\Tenants\TenantPageCategory;
use Illuminate\Http\Request;
final class NavigationScope
{
public static function isWorkspaceSurface(?Request $request = null): bool
{
return ! self::isEnvironmentSurface($request);
}
public static function isEnvironmentSurface(?Request $request = null): bool
{
return in_array(self::pageCategory($request), [
TenantPageCategory::TenantBound,
TenantPageCategory::TenantScopedEvidence,
], true);
}
public static function shouldRegisterEnvironmentNavigation(?Request $request = null): bool
{
return self::isEnvironmentSurface($request);
}
public static function pageCategory(?Request $request = null): TenantPageCategory
{
return TenantPageCategory::fromPath(self::effectivePath($request));
}
private static function effectivePath(?Request $request = null): string
{
$request ??= request();
$path = '/'.ltrim((string) $request->path(), '/');
if (! self::isLivewireUpdatePath($path)) {
return $path;
}
$refererPath = parse_url((string) $request->headers->get('referer', ''), PHP_URL_PATH);
return is_string($refererPath) && $refererPath !== ''
? '/'.ltrim($refererPath, '/')
: $path;
}
private static function isLivewireUpdatePath(string $path): bool
{
return preg_match('#^/livewire(?:-[^/]+)?/update$#', $path) === 1;
}
}