Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SCIMConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected function doRead(&$object, $attributes = [])
return route(
'scim.resource',
[
'resourceType' => 'Group',
'resourceType' => 'Groups',
'resourceObject' => $object->id ?? "not-saved"
]
);
Expand Down
24 changes: 24 additions & 0 deletions tests/BasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,4 +557,28 @@ public function testPostTopLevelEmptyName()
$this->assertEquals('[email protected]', $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');
}
}
}
}
}