|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace app\controllers\admin; |
|
4
|
|
|
|
|
5
|
|
|
use app\traits\{LanguageTrait, AdminBeforeActionTrait, AccessTrait}; |
|
6
|
|
|
use Itstructure\RbacModule\controllers\PermissionController as BasePermissionController; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class PermissionController |
|
10
|
|
|
* PermissionController implements the CRUD actions for Permission model. |
|
11
|
|
|
* |
|
12
|
|
|
* @package app\controllers\admin |
|
13
|
|
|
* |
|
14
|
|
|
* @author Andrey Girnik <[email protected]> |
|
15
|
|
|
*/ |
|
16
|
|
|
class PermissionController extends BasePermissionController |
|
17
|
|
|
{ |
|
18
|
|
|
use LanguageTrait, AdminBeforeActionTrait, AccessTrait; |
|
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @return mixed|string |
|
22
|
|
|
*/ |
|
23
|
|
|
public function actionIndex() |
|
24
|
|
|
{ |
|
25
|
|
|
if (!$this->checkAccessToIndex()) { |
|
26
|
|
|
return $this->accessError(); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
return parent::actionIndex(); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param int|string $id |
|
34
|
|
|
* |
|
35
|
|
|
* @return mixed |
|
36
|
|
|
*/ |
|
37
|
|
|
public function actionView($id) |
|
38
|
|
|
{ |
|
39
|
|
|
if (!$this->checkAccessToView()) { |
|
40
|
|
|
return $this->accessError(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
return parent::actionView($id); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @return mixed|string|\yii\web\Response |
|
48
|
|
|
*/ |
|
49
|
|
|
public function actionCreate() |
|
50
|
|
|
{ |
|
51
|
|
|
if (!$this->checkAccessToCreate()) { |
|
52
|
|
|
return $this->accessError(); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
return parent::actionCreate(); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @param int|string $id |
|
60
|
|
|
* |
|
61
|
|
|
* @return string|\yii\web\Response |
|
62
|
|
|
*/ |
|
63
|
|
|
public function actionUpdate($id) |
|
64
|
|
|
{ |
|
65
|
|
|
if (!$this->checkAccessToUpdate()) { |
|
66
|
|
|
return $this->accessError(); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
return parent::actionUpdate($id); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param int|string $id |
|
74
|
|
|
* |
|
75
|
|
|
* @return mixed|\yii\web\Response |
|
76
|
|
|
*/ |
|
77
|
|
|
public function actionDelete($id) |
|
78
|
|
|
{ |
|
79
|
|
|
if (!$this->checkAccessToDelete()) { |
|
80
|
|
|
return $this->accessError(); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
return parent::actionDelete($id); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|