Skip to content

Commit fa53c43

Browse files
Option to omit main schema (limosa-io#31)
1 parent 03dc0f8 commit fa53c43

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

config/scim.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

33
return [
4-
"publish_routes" => true
4+
"publish_routes" => true,
5+
'omit_main_schema_in_return' => false
56
];

src/Helper.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace ArieTimmerman\Laravel\SCIMServer;
34

45
use ArieTimmerman\Laravel\SCIMServer\Attribute\AttributeMapping;
@@ -96,6 +97,16 @@ public static function objectToSCIMArray($object, ResourceType $resourceType = n
9697
$parent[$key] = AttributeMapping::eloquentAttributeToString($value);
9798
}
9899
}
100+
101+
if (config('scim.omit_main_schema_in_return')) {
102+
$defaultSchema = collect($mapping->getDefaultSchema())->first();
103+
104+
$main = $result[$defaultSchema];
105+
unset($result[$defaultSchema]);
106+
107+
$result = array_merge($result, $main);
108+
}
109+
99110
} else {
100111
$result = $userArray;
101112
}

0 commit comments

Comments
 (0)