Skip to content

Commit 3b0e900

Browse files
Merge pull request #144 from limosa-io/groups-url-fix
Fix wrong ref link in Demo Server Docker Image
2 parents 7a0e381 + 75253fe commit 3b0e900

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/SCIMConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ protected function doRead(&$object, $attributes = [])
121121
return route(
122122
'scim.resource',
123123
[
124-
'resourceType' => 'Group',
124+
'resourceType' => 'Groups',
125125
'resourceObject' => $object->id ?? "not-saved"
126126
]
127127
);

tests/BasicTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,4 +557,28 @@ public function testPostTopLevelEmptyName()
557557
$this->assertEquals('[email protected]', $json['urn:ietf:params:scim:schemas:core:2.0:User']['emails'][0]['value']);
558558
$this->assertEquals('Dr. Marie Jo', $json['urn:ietf:params:scim:schemas:core:2.0:User']['userName']);
559559
}
560+
561+
public function testGroupReferencesHaveCorrectUri()
562+
{
563+
// Get a user with groups to check the $ref URIs
564+
$response = $this->get('/scim/v2/Users?startIndex=1&count=1');
565+
566+
$response->assertStatus(200);
567+
$this->assertGreaterThan(0, count($response->json('Resources')));
568+
569+
$user = $response->json('Resources.0.urn:ietf:params:scim:schemas:core:2.0:User');
570+
571+
// Check if user has groups
572+
if (isset($user['groups']) && count($user['groups']) > 0) {
573+
foreach ($user['groups'] as $group) {
574+
// Verify that the $ref field contains "Groups" (plural) not "Group" (singular)
575+
if (isset($group['$ref'])) {
576+
$this->assertStringContainsString('/scim/v2/Groups/', $group['$ref'],
577+
'Group reference should use "Groups" (plural) in URI, not "Group" (singular)');
578+
$this->assertStringNotContainsString('/scim/v2/Group/', $group['$ref'],
579+
'Group reference should not use "Group" (singular) in URI');
580+
}
581+
}
582+
}
583+
}
560584
}

0 commit comments

Comments
 (0)