Skip to content

Commit

Permalink
Feature/base guarded fn - 4th time lucky (#67)
Browse files Browse the repository at this point in the history
* fn that returns array of base guarded functions

* style ci

* bump
  • Loading branch information
rayzor65 authored Aug 23, 2016
1 parent 5140a3d commit bbdc09b
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Controllers/EntityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,50 @@ protected function getValidationRules($entityKey = null, array $requestEntity =
{
return $this->getModel()->getValidationRules($entityKey, $requestEntity);
}

/**
* Default functions in the controller that check permissions.
* @return array
*/
public static function getBaseGuardedFunctions()
{
return [
static::class.'@getOne' => [
'type' => 'permission',
'description' => 'Get one',
],
static::class.'@getAll' => [
'type' => 'permission',
'description' => 'Get all',
],
static::class.'@postOne' => [
'type' => 'permission',
'description' => 'Post one',
],
static::class.'@putOne' => [
'type' => 'permission',
'description' => 'Put one',
],
static::class.'@putMany' => [
'type' => 'permission',
'description' => 'Put many',
],
static::class.'@patchOne' => [
'type' => 'permission',
'description' => 'Patch one',
],
static::class.'@patchMany' => [
'type' => 'permission',
'description' => 'Patch many',
],
static::class.'@deleteOne' => [
'type' => 'permission',
'description' => 'Delete one',
],
static::class.'@deleteMany' => [
'type' => 'permission',
'description' => 'Delete many',
],
];
}
}

0 comments on commit bbdc09b

Please sign in to comment.