Fixes wrong error code.
This commit is contained in:
parent
15c29d3305
commit
cc6f90b107
1 changed files with 7 additions and 5 deletions
|
@ -145,11 +145,11 @@ class GroupController extends ASCIMGroup {
|
||||||
public function create( string $displayName = '',
|
public function create( string $displayName = '',
|
||||||
array $members = []): SCIMJSONResponse {
|
array $members = []): SCIMJSONResponse {
|
||||||
|
|
||||||
$id=urldecode($displayName);
|
$id = urlencode($displayName);
|
||||||
// Validate name
|
// Validate name
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
$this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
|
$this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
|
||||||
return new SCIMErrorResponse(['message' => 'Invalid group name'], 101);
|
return new SCIMErrorResponse(['message' => 'Invalid group name'], 400);
|
||||||
}
|
}
|
||||||
// Check if it exists
|
// Check if it exists
|
||||||
if ($this->groupManager->groupExists($id)) {
|
if ($this->groupManager->groupExists($id)) {
|
||||||
|
@ -159,10 +159,9 @@ class GroupController extends ASCIMGroup {
|
||||||
if ($group === null) {
|
if ($group === null) {
|
||||||
return new SCIMErrorResponse(['message' => 'Not supported by backend'], 103);
|
return new SCIMErrorResponse(['message' => 'Not supported by backend'], 103);
|
||||||
}
|
}
|
||||||
if ($displayname !== '') {
|
$group->setDisplayName($displayName);
|
||||||
$group->setDisplayName($displayName);
|
|
||||||
}
|
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
|
$this->logger->error('Group name not supplied' . $member['value'], ['app' => 'provisioning_api']);
|
||||||
$targetUser = $this->userManager->get($member['value']);
|
$targetUser = $this->userManager->get($member['value']);
|
||||||
$group->addUser($targetUser);
|
$group->addUser($targetUser);
|
||||||
}
|
}
|
||||||
|
@ -184,6 +183,9 @@ class GroupController extends ASCIMGroup {
|
||||||
string $displayName = '',
|
string $displayName = '',
|
||||||
array $members = []): SCIMJSONResponse {
|
array $members = []): SCIMJSONResponse {
|
||||||
$group = $this->groupManager->get($id);
|
$group = $this->groupManager->get($id);
|
||||||
|
if (!$this->groupManager->groupExists($id)) {
|
||||||
|
return new SCIMErrorResponse(['message' => 'Group not found'], 404);
|
||||||
|
}
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
$targetUser = $this->userManager->get($member['value']);
|
$targetUser = $this->userManager->get($member['value']);
|
||||||
$group->addUser($targetUser);
|
$group->addUser($targetUser);
|
||||||
|
|
Loading…
Reference in a new issue