Skip to content

Commit f60960c

Browse files
committed
Fix failing test
1 parent 7660080 commit f60960c

File tree

3 files changed

+60
-15
lines changed

3 files changed

+60
-15
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace app\controllers;
4+
5+
class PetController extends \app\controllers\base\PetController
6+
{
7+
8+
public function checkAccess($action, $model = null, $params = [])
9+
{
10+
//TODO implement checkAccess
11+
}
12+
13+
14+
}
15+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace app\controllers\base;
4+
5+
abstract class PetController extends \yii\rest\Controller
6+
{
7+
public function actions()
8+
{
9+
return [
10+
'view' => [
11+
'class' => \yii\rest\ViewAction::class,
12+
'modelClass' => \app\models\Pet::class,
13+
'checkAccess' => [$this, 'checkAccess'],
14+
],
15+
'delete' => [
16+
'class' => \yii\rest\DeleteAction::class,
17+
'modelClass' => \app\models\Pet::class,
18+
'checkAccess' => [$this, 'checkAccess'],
19+
],
20+
'update' => [
21+
'class' => \yii\rest\UpdateAction::class,
22+
'modelClass' => \app\models\Pet::class,
23+
'checkAccess' => [$this, 'checkAccess'],
24+
],
25+
'options' => [
26+
'class' => \yii\rest\OptionsAction::class,
27+
],
28+
];
29+
}
30+
31+
/**
32+
* Checks the privilege of the current user.
33+
*
34+
* This method checks whether the current user has the privilege
35+
* to run the specified action against the specified data model.
36+
* If the user does not have access, a [[ForbiddenHttpException]] should be thrown.
37+
*
38+
* @param string $action the ID of the action to be executed
39+
* @param object $model the model to be accessed. If null, it means no specific model is being accessed.
40+
* @param array $params additional parameters
41+
* @throws \yii\web\ForbiddenHttpException if the user does not have access
42+
*/
43+
abstract public function checkAccess($action, $model = null, $params = []);
44+
45+
}

tests/specs/petstore_urlprefixes/modules/api/v1/controllers/base/PetController.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,6 @@ public function actions()
1717
'modelClass' => \app\models\Pet::class,
1818
'checkAccess' => [$this, 'checkAccess'],
1919
],
20-
'view' => [
21-
'class' => \yii\rest\ViewAction::class,
22-
'modelClass' => \app\models\Pet::class,
23-
'checkAccess' => [$this, 'checkAccess'],
24-
],
25-
'delete' => [
26-
'class' => \yii\rest\DeleteAction::class,
27-
'modelClass' => \app\models\Pet::class,
28-
'checkAccess' => [$this, 'checkAccess'],
29-
],
30-
'update' => [
31-
'class' => \yii\rest\UpdateAction::class,
32-
'modelClass' => \app\models\Pet::class,
33-
'checkAccess' => [$this, 'checkAccess'],
34-
],
3520
'options' => [
3621
'class' => \yii\rest\OptionsAction::class,
3722
],

0 commit comments

Comments
 (0)