Skip to content

Commit 0b106c5

Browse files
committed
Fix test
1 parent 9701230 commit 0b106c5

File tree

9 files changed

+57
-33
lines changed

9 files changed

+57
-33
lines changed

tests/specs/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/mysql/controllers/PetCommentController.php

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class PetCommentController extends \app\controllers\base\PetCommentController
66
{
7-
87
public function checkAccess($action, $model = null, $params = [])
98
{
109
//TODO implement checkAccess
@@ -14,7 +13,5 @@ public function actionList()
1413
{
1514
//TODO implement actionList
1615
}
17-
18-
1916
}
2017

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace app\controllers;
4+
5+
class PetController extends \app\controllers\base\PetController
6+
{
7+
public function checkAccess($action, $model = null, $params = [])
8+
{
9+
//TODO implement checkAccess
10+
}
11+
}
12+
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/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/mysql/modules/api/v2/controllers/CommentController.php

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class CommentController extends \app\some\controllers\base\CommentController
66
{
7-
87
public function checkAccess($action, $model = null, $params = [])
98
{
109
//TODO implement checkAccess
@@ -14,7 +13,5 @@ public function actionList()
1413
{
1514
//TODO implement actionList
1615
}
17-
18-
1916
}
2017

tests/specs/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/mysql/modules/forum/controllers/Pet2DetailController.php

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class Pet2DetailController extends \app\modules\forum\controllers\base\Pet2DetailController
66
{
7-
87
public function checkAccess($action, $model = null, $params = [])
98
{
109
//TODO implement checkAccess
@@ -14,7 +13,5 @@ public function actionList()
1413
{
1514
//TODO implement actionList
1615
}
17-
18-
1916
}
2017

tests/specs/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/mysql/modules/forum2/controllers/Pet3DetailController.php

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class Pet3DetailController extends \app\forum2\controllers\base\Pet3DetailController
66
{
7-
87
public function checkAccess($action, $model = null, $params = [])
98
{
109
//TODO implement checkAccess
@@ -14,7 +13,5 @@ public function actionList()
1413
{
1514
//TODO implement actionList
1615
}
17-
18-
1916
}
2017

tests/specs/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/mysql/modules/petinfo/controllers/PetDetailController.php

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class PetDetailController extends \app\modules\petinfo\controllers\base\PetDetailController
66
{
7-
87
public function checkAccess($action, $model = null, $params = [])
98
{
109
//TODO implement checkAccess
@@ -14,7 +13,5 @@ public function actionList()
1413
{
1514
//TODO implement actionList
1615
}
17-
18-
1916
}
2017

tests/specs/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/mysql/modules/some/controllers/PetController.php

-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44

55
class PetController extends \app\api\v1\controllers\base\PetController
66
{
7-
87
public function checkAccess($action, $model = null, $params = [])
98
{
109
//TODO implement checkAccess
1110
}
12-
13-
1411
}
1512

tests/specs/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/mysql/modules/some/controllers/base/PetController.php

-15
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)