Skip to content

Commit

Permalink
Use static instead of self when calling static functions to allow eas…
Browse files Browse the repository at this point in the history
…ier customisation in subclasses
  • Loading branch information
miguelwicht committed Oct 18, 2024
1 parent fd2dbac commit 121679b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Http/Controllers/ResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public static function createFromSCIM($resourceType, $input, PolicyDecisionPoint
}

$flattened = Helper::flatten($input, $input['schemas']);
$flattened = self::validateScim($resourceType, $flattened, null);
$flattened = static::validateScim($resourceType, $flattened, null);

if (!$allowAlways && !self::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_POST, $flattened, $resourceType, null, $isMe)) {
if (!$allowAlways && !static::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_POST, $flattened, $resourceType, null, $isMe)) {
throw (new SCIMException('This is not allowed'))->setCode(403);
}

Expand All @@ -67,7 +67,7 @@ public static function createFromSCIM($resourceType, $input, PolicyDecisionPoint
//validate
$newObject = Helper::flatten(Helper::objectToSCIMArray($resourceObject, $resourceType), $resourceType->getSchema());

$flattened = self::validateScim($resourceType, $newObject, $resourceObject);
$flattened = static::validateScim($resourceType, $newObject, $resourceObject);

$resourceObject->save();

Expand All @@ -81,7 +81,7 @@ public function createObject(Request $request, PolicyDecisionPoint $pdp, Resourc
{
$input = $request->input();

$resourceObject = self::createFromSCIM($resourceType, $input, $pdp, $request, false, $isMe);
$resourceObject = static::createFromSCIM($resourceType, $input, $pdp, $request, false, $isMe);

event(new Create($resourceObject, $resourceType, $isMe, $request->input()));

Expand Down Expand Up @@ -129,7 +129,7 @@ public function replace(Request $request, PolicyDecisionPoint $pdp, ResourceType

$flattened = $this->validateScim($resourceType, $newObject, $resourceObject);

if (!self::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_PATCH, $flattened, $resourceType, null)) {
if (!static::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_PATCH, $flattened, $resourceType, null)) {
throw new SCIMException('This is not allowed');
}

Expand Down Expand Up @@ -184,7 +184,7 @@ public function update(Request $request, PolicyDecisionPoint $pdp, ResourceType

$flattened = $this->validateScim($resourceType, $newObject, $resourceObject);

if (!self::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_PATCH, $flattened, $resourceType, null)) {
if (!static::isAllowed($pdp, $request, PolicyDecisionPoint::OPERATION_PATCH, $flattened, $resourceType, null)) {
throw new SCIMException('This is not allowed');
}

Expand Down

0 comments on commit 121679b

Please sign in to comment.