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 (#96)
  • Loading branch information
miguelwicht authored Dec 11, 2024
1 parent f913bbf commit a5f9fa7
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 @@ -55,9 +55,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 @@ -68,7 +68,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 @@ -82,7 +82,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 @@ -130,7 +130,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 @@ -185,7 +185,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 a5f9fa7

Please sign in to comment.