Compare commits
No commits in common. "c9e93c49713bbadd530cf2a79f0eeeb0f0713230" and "c7768e27fe1d9bad1a860d106145b3a7f7852972" have entirely different histories.
c9e93c4971
...
c7768e27fe
@ -296,13 +296,7 @@ private function hydrateGroupPolicyConfiguration(string $tenantIdentifier, Tenan
|
|||||||
}
|
}
|
||||||
|
|
||||||
$definitionValues = array_merge($definitionValues, $response->data['value'] ?? []);
|
$definitionValues = array_merge($definitionValues, $response->data['value'] ?? []);
|
||||||
$nextLink = $response->data['@odata.nextLink'] ?? null;
|
$nextPath = $response->data['@odata.nextLink'] ?? null;
|
||||||
|
|
||||||
if (! $nextLink) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$nextPath = $this->stripGraphBaseUrl((string) $nextLink);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hydrationStatus === 'failed') {
|
if ($hydrationStatus === 'failed') {
|
||||||
@ -374,13 +368,7 @@ private function hydrateGroupPolicyConfiguration(string $tenantIdentifier, Tenan
|
|||||||
}
|
}
|
||||||
|
|
||||||
$presentationValues = array_merge($presentationValues, $pvResponse->data['value'] ?? []);
|
$presentationValues = array_merge($presentationValues, $pvResponse->data['value'] ?? []);
|
||||||
$presentationNextLink = $pvResponse->data['@odata.nextLink'] ?? null;
|
$presentationNext = $pvResponse->data['@odata.nextLink'] ?? null;
|
||||||
|
|
||||||
if (! $presentationNextLink) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$presentationNext = $this->stripGraphBaseUrl((string) $presentationNextLink);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($presentationValues !== []) {
|
if ($presentationValues !== []) {
|
||||||
|
|||||||
@ -627,7 +627,7 @@ public function execute(
|
|||||||
'restore_run_id' => $restoreRun->id,
|
'restore_run_id' => $restoreRun->id,
|
||||||
'backup_item_id' => $item->id,
|
'backup_item_id' => $item->id,
|
||||||
],
|
],
|
||||||
assignments: $item->assignments,
|
assignments: $restoredAssignments,
|
||||||
scopeTags: $scopeTagsForVersion,
|
scopeTags: $scopeTagsForVersion,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,4 @@
|
|||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
@php
|
|
||||||
$scopeTags = $version->scope_tags['names'] ?? [];
|
|
||||||
@endphp
|
|
||||||
@if(!empty($scopeTags))
|
|
||||||
<x-filament::section heading="Scope Tags">
|
|
||||||
<div class="flex flex-wrap gap-2">
|
|
||||||
@foreach($scopeTags as $tag)
|
|
||||||
<span class="inline-flex items-center rounded-md bg-primary-50 px-2 py-1 text-xs font-medium text-primary-700 ring-1 ring-inset ring-primary-700/10 dark:bg-primary-400/10 dark:text-primary-400 dark:ring-primary-400/30">
|
|
||||||
{{ $tag }}
|
|
||||||
</span>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</x-filament::section>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if($version->assignments && count($version->assignments) > 0)
|
@if($version->assignments && count($version->assignments) > 0)
|
||||||
<x-filament::section
|
<x-filament::section
|
||||||
heading="Assignments"
|
heading="Assignments"
|
||||||
@ -33,6 +18,22 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@php
|
||||||
|
$scopeTags = $version->scope_tags['names'] ?? [];
|
||||||
|
@endphp
|
||||||
|
@if(!empty($scopeTags))
|
||||||
|
<div>
|
||||||
|
<h4 class="text-sm font-medium text-gray-950 dark:text-white">Scope Tags</h4>
|
||||||
|
<div class="mt-2 flex flex-wrap gap-2">
|
||||||
|
@foreach($scopeTags as $tag)
|
||||||
|
<span class="inline-flex items-center rounded-md bg-primary-50 px-2 py-1 text-xs font-medium text-primary-700 ring-1 ring-inset ring-primary-700/10 dark:bg-primary-400/10 dark:text-primary-400 dark:ring-primary-400/30">
|
||||||
|
{{ $tag }}
|
||||||
|
</span>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h4 class="text-sm font-medium text-gray-950 dark:text-white">Assignment Details</h4>
|
<h4 class="text-sm font-medium text-gray-950 dark:text-white">Assignment Details</h4>
|
||||||
<div class="mt-2 space-y-2">
|
<div class="mt-2 space-y-2">
|
||||||
|
|||||||
@ -1,59 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Filament\Resources\PolicyVersionResource;
|
|
||||||
use App\Models\Policy;
|
|
||||||
use App\Models\PolicyVersion;
|
|
||||||
use App\Models\Tenant;
|
|
||||||
use App\Models\User;
|
|
||||||
use Carbon\CarbonImmutable;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
|
|
||||||
uses(RefreshDatabase::class);
|
|
||||||
|
|
||||||
test('policy version view shows scope tags even when assignments are missing', function () {
|
|
||||||
$tenant = Tenant::create([
|
|
||||||
'tenant_id' => env('INTUNE_TENANT_ID', 'local-tenant'),
|
|
||||||
'name' => 'Tenant One',
|
|
||||||
'metadata' => [],
|
|
||||||
'is_current' => true,
|
|
||||||
]);
|
|
||||||
|
|
||||||
putenv('INTUNE_TENANT_ID='.$tenant->tenant_id);
|
|
||||||
$tenant->makeCurrent();
|
|
||||||
|
|
||||||
$policy = Policy::create([
|
|
||||||
'tenant_id' => $tenant->id,
|
|
||||||
'external_id' => 'policy-1',
|
|
||||||
'policy_type' => 'deviceConfiguration',
|
|
||||||
'display_name' => 'Policy A',
|
|
||||||
'platform' => 'windows',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$version = PolicyVersion::create([
|
|
||||||
'tenant_id' => $tenant->id,
|
|
||||||
'policy_id' => $policy->id,
|
|
||||||
'version_number' => 1,
|
|
||||||
'policy_type' => $policy->policy_type,
|
|
||||||
'platform' => $policy->platform,
|
|
||||||
'created_by' => 'tester@example.com',
|
|
||||||
'captured_at' => CarbonImmutable::now(),
|
|
||||||
'snapshot' => [
|
|
||||||
'displayName' => 'Policy A',
|
|
||||||
],
|
|
||||||
'assignments' => null,
|
|
||||||
'scope_tags' => [
|
|
||||||
'ids' => ['0', 'scope-1'],
|
|
||||||
'names' => ['Default', 'Verbund-1'],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$user = User::factory()->create();
|
|
||||||
|
|
||||||
$response = $this->actingAs($user)
|
|
||||||
->get(PolicyVersionResource::getUrl('view', ['record' => $version]));
|
|
||||||
|
|
||||||
$response->assertOk();
|
|
||||||
$response->assertSee('Scope Tags');
|
|
||||||
$response->assertSee('Default');
|
|
||||||
$response->assertSee('Verbund-1');
|
|
||||||
});
|
|
||||||
@ -49,8 +49,6 @@ public function getServicePrincipalPermissions(array $options = []): GraphRespon
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
config()->set('graph_contracts.types.deviceConfiguration.assignments_payload_key', 'assignments');
|
|
||||||
|
|
||||||
$tenant = Tenant::create([
|
$tenant = Tenant::create([
|
||||||
'tenant_id' => 'tenant-1',
|
'tenant_id' => 'tenant-1',
|
||||||
'name' => 'Tenant One',
|
'name' => 'Tenant One',
|
||||||
@ -87,16 +85,6 @@ public function getServicePrincipalPermissions(array $options = []): GraphRespon
|
|||||||
'scope_tag_ids' => ['0', 'scope-1'],
|
'scope_tag_ids' => ['0', 'scope-1'],
|
||||||
'scope_tag_names' => ['Default', 'Verbund-1'],
|
'scope_tag_names' => ['Default', 'Verbund-1'],
|
||||||
],
|
],
|
||||||
'assignments' => [
|
|
||||||
[
|
|
||||||
'target' => [
|
|
||||||
'@odata.type' => '#microsoft.graph.groupAssignmentTarget',
|
|
||||||
'groupId' => 'group-1',
|
|
||||||
'group_display_name' => 'Group One',
|
|
||||||
],
|
|
||||||
'intent' => 'apply',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user = User::factory()->create(['email' => 'tester@example.com']);
|
$user = User::factory()->create(['email' => 'tester@example.com']);
|
||||||
@ -128,7 +116,6 @@ public function getServicePrincipalPermissions(array $options = []): GraphRespon
|
|||||||
'ids' => ['0', 'scope-1'],
|
'ids' => ['0', 'scope-1'],
|
||||||
'names' => ['Default', 'Verbund-1'],
|
'names' => ['Default', 'Verbund-1'],
|
||||||
]);
|
]);
|
||||||
expect($version->assignments)->toBe($backupItem->assignments);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('restore execution records foundation mappings', function () {
|
test('restore execution records foundation mappings', function () {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user