Skip to content

Commit 376c612

Browse files
Fixes error code limosa-io#74 (limosa-io#101)
1 parent a5f9fa7 commit 376c612

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/Attribute/Constant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function replace($value, &$object, $path = null)
3232
$current = json_encode($this->read($object)?->value);
3333

3434
if (json_encode($value) != $current) {
35-
throw (new SCIMException(sprintf('Write to "%s" is not supported, tried to change "%s" to "%s"', $this->getFullKey(), $current, json_encode($value))))->setCode(500)->setScimType('mutability');
35+
throw (new SCIMException(sprintf('Write to "%s" is not supported, tried to change "%s" to "%s"', $this->getFullKey(), $current, json_encode($value))))->setCode(403)->setScimType('mutability');
3636
}
3737

3838
$this->dirty = true;

src/Http/Controllers/ResourceController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected static function validateScim(ResourceType $resourceType, $flattened, ?
5151
public static function createFromSCIM($resourceType, $input, PolicyDecisionPoint $pdp = null, Request $request = null, $allowAlways = false, $isMe = false)
5252
{
5353
if (!isset($input['schemas']) || !is_array($input['schemas'])) {
54-
throw (new SCIMException('Missing a valid schemas-attribute.'))->setCode(500);
54+
throw (new SCIMException('Missing a valid schemas-attribute.'))->setCode(400);
5555
}
5656

5757
$flattened = Helper::flatten($input, $input['schemas']);

tests/GroupsTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,9 @@ public function testBulk(){
142142
// confirm testgroup1 exists
143143
$this->assertNotNull(Group::where('displayName', 'TestGroup2')->first());
144144
}
145+
146+
public function testGroupCreationFailure(){
147+
$response = $this->post('/scim/v2/Groups', []);
148+
$response->assertStatus(400);
149+
}
145150
}

0 commit comments

Comments
 (0)