Skip to content

Commit

Permalink
Fixes error code #74
Browse files Browse the repository at this point in the history
  • Loading branch information
arietimmerman committed Dec 12, 2024
1 parent a5f9fa7 commit 8968f02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Attribute/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function replace($value, &$object, $path = null)
$current = json_encode($this->read($object)?->value);

if (json_encode($value) != $current) {
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');
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');
}

$this->dirty = true;
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/ResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected static function validateScim(ResourceType $resourceType, $flattened, ?
public static function createFromSCIM($resourceType, $input, PolicyDecisionPoint $pdp = null, Request $request = null, $allowAlways = false, $isMe = false)
{
if (!isset($input['schemas']) || !is_array($input['schemas'])) {
throw (new SCIMException('Missing a valid schemas-attribute.'))->setCode(500);
throw (new SCIMException('Missing a valid schemas-attribute.'))->setCode(400);
}

$flattened = Helper::flatten($input, $input['schemas']);
Expand Down
5 changes: 5 additions & 0 deletions tests/GroupsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,9 @@ public function testBulk(){
// confirm testgroup1 exists
$this->assertNotNull(Group::where('displayName', 'TestGroup2')->first());
}

public function testGroupCreationFailure(){
$response = $this->post('/scim/v2/Groups', []);
$response->assertStatus(400);
}
}

0 comments on commit 8968f02

Please sign in to comment.