Implements provider access hardening for Intune write operations: - RBAC-based write gate with configurable staleness thresholds - Gate enforced at restore start and in jobs (execute + assignments) - UI affordances: disabled rerun action, tenant RBAC status card, refresh RBAC action - Audit logging for blocked writes - Ops UX label: `rbac.health_check` now displays as “RBAC health check” - Adds/updates Pest tests and SpecKit artifacts for feature 108 Notes: - Filament v5 / Livewire v4 compliant. - Destructive actions require confirmation. - Assets: no new global assets. Tested: - `vendor/bin/sail artisan test --compact` (suite previously green) + focused OpsUx tests for OperationCatalog labels. - `vendor/bin/sail bin pint --dirty`. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #132
54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Tenant;
|
|
use App\Models\Workspace;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Tenant>
|
|
*/
|
|
class TenantFactory extends Factory
|
|
{
|
|
public function configure(): static
|
|
{
|
|
return $this->afterCreating(function (Tenant $tenant): void {
|
|
if ($tenant->workspace_id !== null) {
|
|
return;
|
|
}
|
|
|
|
$workspace = Workspace::factory()->create();
|
|
|
|
$tenant->forceFill([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
])->save();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => fake()->company(),
|
|
'external_id' => fake()->uuid(),
|
|
'tenant_id' => fake()->uuid(),
|
|
'app_client_id' => fake()->uuid(),
|
|
'app_client_secret' => null, // Skip encryption in tests
|
|
'app_certificate_thumbprint' => null,
|
|
'app_status' => 'ok',
|
|
'app_notes' => null,
|
|
'status' => 'active',
|
|
'environment' => 'other',
|
|
'is_current' => false,
|
|
'metadata' => [],
|
|
'rbac_status' => 'ok',
|
|
'rbac_last_checked_at' => now(),
|
|
];
|
|
}
|
|
}
|