merge: agent session work
This commit is contained in:
commit
2e95ae480c
@ -157,6 +157,12 @@ public static function table(Table $table): Table
|
||||
->url(fn (Tenant $record) => static::adminConsentUrl($record))
|
||||
->visible(fn (Tenant $record) => static::adminConsentUrl($record) !== null)
|
||||
->openUrlInNewTab(),
|
||||
Actions\Action::make('open_in_entra')
|
||||
->label('Open in Entra')
|
||||
->icon('heroicon-o-arrow-top-right-on-square')
|
||||
->url(fn (Tenant $record) => static::entraUrl($record))
|
||||
->visible(fn (Tenant $record) => static::entraUrl($record) !== null)
|
||||
->openUrlInNewTab(),
|
||||
Actions\Action::make('verify')
|
||||
->label('Verify configuration')
|
||||
->icon('heroicon-o-check-badge')
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
use App\Services\Intune\TenantConfigService;
|
||||
use App\Services\Intune\TenantPermissionService;
|
||||
use Filament\Actions;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewTenant extends ViewRecord
|
||||
@ -47,6 +48,30 @@ protected function getHeaderActions(): array
|
||||
TenantResource::verifyTenant($record, $configService, $permissionService, $rbacHealthService, $auditLogger);
|
||||
}),
|
||||
TenantResource::rbacAction(),
|
||||
Actions\Action::make('archive')
|
||||
->label('Deactivate')
|
||||
->color('danger')
|
||||
->icon('heroicon-o-archive-box-x-mark')
|
||||
->requiresConfirmation()
|
||||
->visible(fn (Tenant $record) => ! $record->trashed())
|
||||
->action(function (Tenant $record, AuditLogger $auditLogger) {
|
||||
$record->delete();
|
||||
|
||||
$auditLogger->log(
|
||||
tenant: $record,
|
||||
action: 'tenant.archived',
|
||||
resourceType: 'tenant',
|
||||
resourceId: (string) $record->id,
|
||||
status: 'success',
|
||||
context: ['metadata' => ['tenant_id' => $record->tenant_id]]
|
||||
);
|
||||
|
||||
Notification::make()
|
||||
->title('Tenant deactivated')
|
||||
->body('The tenant has been archived and hidden from lists.')
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
])
|
||||
->label('Actions')
|
||||
->icon('heroicon-o-ellipsis-vertical')
|
||||
|
||||
@ -177,3 +177,34 @@ public function request(string $method, string $path, array $options = []): Grap
|
||||
$response->assertSee('ok');
|
||||
$response->assertSee('missing');
|
||||
});
|
||||
|
||||
test('tenant list shows Open in Entra action', function () {
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
|
||||
Tenant::create([
|
||||
'tenant_id' => 'tenant-ui-list',
|
||||
'name' => 'UI Tenant List',
|
||||
'app_client_id' => 'client-123',
|
||||
]);
|
||||
|
||||
$response = $this->get(route('filament.admin.resources.tenants.index'));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('Open in Entra');
|
||||
});
|
||||
|
||||
test('tenant can be deactivated from the tenant detail action menu', function () {
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
|
||||
$tenant = Tenant::create([
|
||||
'tenant_id' => 'tenant-ui-deactivate',
|
||||
'name' => 'UI Tenant Deactivate',
|
||||
]);
|
||||
|
||||
Livewire::test(ViewTenant::class, ['record' => $tenant->getRouteKey()])
|
||||
->callAction('archive');
|
||||
|
||||
$this->assertSoftDeleted('tenants', ['id' => $tenant->id]);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user