From 75253fe270f0e650750025cbbd46ff57a7e1978f Mon Sep 17 00:00:00 2001 From: Arie Timmerman Date: Wed, 22 Oct 2025 04:37:01 +0000 Subject: [PATCH] Fix Wrong Ref link in Demo Server Docker Image Fixes #142 --- src/SCIMConfig.php | 2 +- tests/BasicTest.php | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/SCIMConfig.php b/src/SCIMConfig.php index 8a3d63c..d2f5329 100644 --- a/src/SCIMConfig.php +++ b/src/SCIMConfig.php @@ -121,7 +121,7 @@ protected function doRead(&$object, $attributes = []) return route( 'scim.resource', [ - 'resourceType' => 'Group', + 'resourceType' => 'Groups', 'resourceObject' => $object->id ?? "not-saved" ] ); diff --git a/tests/BasicTest.php b/tests/BasicTest.php index 5d2ae17..ad94fd9 100644 --- a/tests/BasicTest.php +++ b/tests/BasicTest.php @@ -557,4 +557,28 @@ public function testPostTopLevelEmptyName() $this->assertEquals('mariejo@example.com', $json['urn:ietf:params:scim:schemas:core:2.0:User']['emails'][0]['value']); $this->assertEquals('Dr. Marie Jo', $json['urn:ietf:params:scim:schemas:core:2.0:User']['userName']); } + + public function testGroupReferencesHaveCorrectUri() + { + // Get a user with groups to check the $ref URIs + $response = $this->get('/scim/v2/Users?startIndex=1&count=1'); + + $response->assertStatus(200); + $this->assertGreaterThan(0, count($response->json('Resources'))); + + $user = $response->json('Resources.0.urn:ietf:params:scim:schemas:core:2.0:User'); + + // Check if user has groups + if (isset($user['groups']) && count($user['groups']) > 0) { + foreach ($user['groups'] as $group) { + // Verify that the $ref field contains "Groups" (plural) not "Group" (singular) + if (isset($group['$ref'])) { + $this->assertStringContainsString('/scim/v2/Groups/', $group['$ref'], + 'Group reference should use "Groups" (plural) in URI, not "Group" (singular)'); + $this->assertStringNotContainsString('/scim/v2/Group/', $group['$ref'], + 'Group reference should not use "Group" (singular) in URI'); + } + } + } + } }