1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace app\controllers\admin; |
4
|
|
|
|
5
|
|
|
use app\traits\{AdminBeforeActionTrait, AccessTrait}; |
6
|
|
|
use Itstructure\RbacModule\controllers\RoleController as BaseRoleController; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class RoleController |
10
|
|
|
* RoleController implements the CRUD actions for Role model. |
11
|
|
|
* |
12
|
|
|
* @package app\controllers\admin |
13
|
|
|
* |
14
|
|
|
* @author Andrey Girnik <[email protected]> |
15
|
|
|
*/ |
16
|
|
|
class RoleController extends BaseRoleController |
17
|
|
|
{ |
18
|
|
|
use 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
|
|
|
|