Skip to content

Commit 03dc0f8

Browse files
authored
Fixed hardcoded schema id in urls (limosa-io#29)
1 parent 22f77b5 commit 03dc0f8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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());

0 commit comments

Comments
 (0)