Skip to content

Commit 2c7ecc4

Browse files
committed
Merge remote-tracking branch 'upstream/master'
Backed out php minimum of 7.4 to remain compatible with upstream
2 parents ff10197 + fa53c43 commit 2c7ecc4

File tree

8 files changed

+1103
-907
lines changed

8 files changed

+1103
-907
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v2
1111
- uses: php-actions/composer@v6
12+
with:
13+
php_version: 8
1214
- uses: php-actions/phpunit@v3
1315
with:
14-
php_version: 7.4
16+
php_version: 8

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^7.4|^8.0",
14-
"illuminate/database": "^6.0|^7.0|^8.0",
15-
"illuminate/support": "^6.0|^7.0|^8.0",
16-
"illuminate/console": "^6.0|^7.0|^8.0",
13+
"php": "^7.0|^8.0",
14+
"illuminate/database": "^6.0|^7.0|^8.0|^9.0",
15+
"illuminate/support": "^6.0|^7.0|^8.0|^9.0",
16+
"illuminate/console": "^6.0|^7.0|^8.0|^9.0",
1717
"tmilos/scim-schema": "^0.1.0",
1818
"tmilos/scim-filter-parser": "^1.3"
1919
},

composer.lock

Lines changed: 1069 additions & 887 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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/Attribute/AttributeMapping.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ public function applyWhereCondition(&$query, $operator, $value)
616616

617617
//only filter on OWN eloquent attributes
618618
if (empty($this->eloquentAttributes)) {
619-
throw new SCIMException("Can't filter on . " + $this->getFullKey());
619+
throw new SCIMException("Can't filter on . " . $this->getFullKey());
620620
}
621621

622622
$attribute = $this->eloquentAttributes[0];

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
}

src/Http/Controllers/SchemaController.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,46 @@ public function getSchemas()
1818
}
1919

2020
$config = resolve(SCIMConfig::class)->getConfig();
21-
21+
2222
$schemas = [];
23-
23+
2424
foreach ($config as $key => $value) {
2525
if ($key != 'Users' && $key != 'Group') {
2626
continue;
2727
}
2828

2929
// TODO: FIX THIS. Schema is now an array but should be a string
3030
$schema = (new SchemaBuilderV2())->get($value['schema'][0]);
31-
31+
3232
if ($schema == null) {
3333
throw new SCIMException("Schema not found");
3434
}
35-
36-
$schema->getMeta()->setLocation(route('scim.schemas', ['id' => '23']));
37-
35+
36+
$schema->getMeta()->setLocation(route('scim.schemas', ['id' => $schema->getId()]));
37+
3838
$schemas[] = $schema->serializeObject();
3939
}
40-
40+
4141
$this->schemas = collect($schemas);
4242

4343
return $this->schemas;
4444
}
45-
45+
4646
public function show($id)
4747
{
48-
$result = $this->schemas->first(
48+
$result = $this->getSchemas()->first(
4949
function ($value, $key) use ($id) {
5050
return $value['id'] == $id;
5151
}
5252
);
53-
53+
5454
if ($result == null) {
5555
throw (new SCIMException(sprintf('Resource "%s" not found', $id)))->setCode(404);
5656
}
57-
57+
5858
return $result;
5959
}
60-
60+
6161
public function index()
6262
{
6363
return new ListResponse($this->getSchemas(), 1, $this->getSchemas()->count());

src/SCIM/Schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Contracts\Support\Jsonable;
66

7-
class Schema implements JsonAble
7+
class Schema implements Jsonable
88
{
99
const SCHEMA_USER = "urn:ietf:params:scim:schemas:core:2.0:User";
1010
const SCHEMA_GROUP = "urn:ietf:params:scim:schemas:core:2.0:Group";

0 commit comments

Comments
 (0)