1 | <?php |
||
17 | class VaultConfig extends InjectableConfig |
||
18 | { |
||
19 | /** |
||
20 | * Configuration section. |
||
21 | */ |
||
22 | const CONFIG = 'modules/vault'; |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $config = [ |
||
28 | 'guard' => [ |
||
29 | 'namespace' => 'vault' |
||
30 | ], |
||
31 | |||
32 | //Allowed vault controllers |
||
33 | 'controllers' => [], |
||
34 | |||
35 | //Example: vault/users/addresses/1/remove/123 |
||
36 | 'route' => [ |
||
37 | 'name' => 'vault', |
||
38 | 'pattern' => 'vault[/<controller>[/<action>[/<id>[/<operation>[/<childID>]]]]]', |
||
39 | 'defaults' => [], |
||
40 | 'middlewares' => [], |
||
41 | 'matchHost' => false, |
||
42 | ], |
||
43 | |||
44 | //Navigation widget configuration |
||
45 | 'navigation' => [], |
||
46 | ]; |
||
47 | |||
48 | /** |
||
49 | * Guard namespace (prefix for all permissions) associated with given Vault instance. |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | public function guardNamespace(): string |
||
57 | |||
58 | /** |
||
59 | * @param string $controller |
||
60 | * |
||
61 | * @return bool |
||
62 | */ |
||
63 | public function hasController(string $controller): bool |
||
67 | |||
68 | /** |
||
69 | * Controller class. |
||
70 | * |
||
71 | * @param string $controller |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | public function controllerClass(string $controller): string |
||
79 | |||
80 | /** |
||
81 | * Vault navigation structure including sections, permissions, titles and etc. |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | public function navigationSections(): array |
||
86 | { |
||
87 | return $this->config['navigation']; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @param string $name |
||
92 | * |
||
93 | * @return VaultRoute |
||
94 | */ |
||
95 | public function makeRoute(string $name): VaultRoute |
||
109 | } |