@@ 13-57 (lines=45) @@ | ||
10 | * |
|
11 | * @package Itstructure\RbacModule\controllers |
|
12 | */ |
|
13 | class PermissionController extends BaseController |
|
14 | { |
|
15 | /** |
|
16 | * Initialize. |
|
17 | * Set viewPath and validateComponent. |
|
18 | */ |
|
19 | public function init() |
|
20 | { |
|
21 | $this->viewPath = '@rbac/views/permissions'; |
|
22 | ||
23 | $this->validateComponent = $this->module->get('rbac-validate-component'); |
|
24 | ||
25 | parent::init(); |
|
26 | } |
|
27 | ||
28 | /** |
|
29 | * Returns Permission model name. |
|
30 | * |
|
31 | * @return string |
|
32 | */ |
|
33 | protected function getModelName():string |
|
34 | { |
|
35 | return Permission::class; |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * Returns PermissionSearch model name. |
|
40 | * |
|
41 | * @return string|null |
|
42 | */ |
|
43 | protected function getSearchModelName():string |
|
44 | { |
|
45 | return PermissionSearch::class; |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * Returns new object of search main model. |
|
50 | * |
|
51 | * @return mixed |
|
52 | */ |
|
53 | protected function getNewSearchModel() |
|
54 | { |
|
55 | return parent::getNewSearchModel()->setAuthManager($this->validateComponent->getAuthManager()); |
|
56 | } |
|
57 | } |
|
58 |
@@ 13-57 (lines=45) @@ | ||
10 | * |
|
11 | * @package Itstructure\RbacModule\controllers |
|
12 | */ |
|
13 | class RoleController extends BaseController |
|
14 | { |
|
15 | /** |
|
16 | * Initialize. |
|
17 | * Set viewPath and validateComponent. |
|
18 | */ |
|
19 | public function init() |
|
20 | { |
|
21 | $this->viewPath = '@rbac/views/roles'; |
|
22 | ||
23 | $this->validateComponent = $this->module->get('rbac-validate-component'); |
|
24 | ||
25 | parent::init(); |
|
26 | } |
|
27 | ||
28 | /** |
|
29 | * Returns Role model name. |
|
30 | * |
|
31 | * @return string |
|
32 | */ |
|
33 | protected function getModelName(): string |
|
34 | { |
|
35 | return Role::class; |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * Returns RoleSearch model name. |
|
40 | * |
|
41 | * @return string|null |
|
42 | */ |
|
43 | protected function getSearchModelName(): string |
|
44 | { |
|
45 | return RoleSearch::class; |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * Returns new object of search main model. |
|
50 | * |
|
51 | * @return mixed |
|
52 | */ |
|
53 | protected function getNewSearchModel() |
|
54 | { |
|
55 | return parent::getNewSearchModel()->setAuthManager($this->validateComponent->getAuthManager()); |
|
56 | } |
|
57 | } |
|
58 |