Skip to content

Commit 510eb1f

Browse files
refactoring
1 parent 5b09bed commit 510eb1f

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

src/Controller/AbstractAppController.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -112,58 +112,58 @@ public function renderAbstract(Request $request, string $view, array $parameters
112112
if (true === $parameters['firewall']) {
113113
if (true === $this->isGranted('MENU_CONFIGURATION', 'global')) {
114114
$entries = [
115-
['granted' => 'INDEX_TEMPLATES_LEGACY_LIST', 'subject' => 'index_template_legacy', 'path' => 'index_templates_legacy'],
116-
['granted' => 'INDEX_TEMPLATES_LIST', 'subject' => 'index_template', 'path' => 'index_templates', 'feature' => 'composable_template'],
117-
['granted' => 'COMPONENT_TEMPLATES_LIST', 'subject' => 'component_template', 'path' => 'component_templates', 'feature' => 'composable_template'],
118-
['granted' => 'ILM_POLICIES_LIST', 'subject' => 'ilm_policy', 'path' => 'ilm', 'feature' => 'ilm'],
119-
['granted' => 'SLM_POLICIES_LIST', 'subject' => 'slm_policy', 'path' => 'slm', 'feature' => 'slm'],
120-
['granted' => 'REPOSITORIES_LIST', 'subject' => 'repository', 'path' => 'repositories'],
121-
['granted' => 'ENRICH_POLICIES_LIST', 'subject' => 'enrich_policy', 'path' => 'enrich', 'feature' => 'enrich'],
122-
['granted' => 'ELASTICSEARCH_USERS', 'subject' => 'global', 'path' => 'elasticsearch_users', 'feature' => 'security'],
123-
['granted' => 'ELASTICSEARCH_ROLES', 'subject' => 'global', 'path' => 'elasticsearch_roles', 'feature' => 'security'],
124-
['granted' => 'DATA_STREAMS_LIST', 'subject' => 'data_stream', 'path' => 'data_streams', 'feature' => 'data_streams'],
115+
['attribute' => 'INDEX_TEMPLATES_LEGACY_LIST', 'subject' => 'index_template_legacy', 'path' => 'index_templates_legacy'],
116+
['attribute' => 'INDEX_TEMPLATES_LIST', 'subject' => 'index_template', 'path' => 'index_templates', 'feature' => 'composable_template'],
117+
['attribute' => 'COMPONENT_TEMPLATES_LIST', 'subject' => 'component_template', 'path' => 'component_templates', 'feature' => 'composable_template'],
118+
['attribute' => 'ILM_POLICIES_LIST', 'subject' => 'ilm_policy', 'path' => 'ilm', 'feature' => 'ilm'],
119+
['attribute' => 'SLM_POLICIES_LIST', 'subject' => 'slm_policy', 'path' => 'slm', 'feature' => 'slm'],
120+
['attribute' => 'REPOSITORIES_LIST', 'subject' => 'repository', 'path' => 'repositories'],
121+
['attribute' => 'ENRICH_POLICIES_LIST', 'subject' => 'enrich_policy', 'path' => 'enrich', 'feature' => 'enrich'],
122+
['attribute' => 'ELASTICSEARCH_USERS', 'subject' => 'global', 'path' => 'elasticsearch_users', 'feature' => 'security'],
123+
['attribute' => 'ELASTICSEARCH_ROLES', 'subject' => 'global', 'path' => 'elasticsearch_roles', 'feature' => 'security'],
124+
['attribute' => 'DATA_STREAMS_LIST', 'subject' => 'data_stream', 'path' => 'data_streams', 'feature' => 'data_streams'],
125125
];
126126

127127
$menus['configuration'] = $this->populateMenu($entries);
128128
}
129129

130130
if (true === $this->isGranted('MENU_TOOLS', 'global')) {
131131
$entries = [
132-
['granted' => 'SNAPSHOTS_LIST', 'subject' => 'snapshot', 'path' => 'snapshots'],
133-
['granted' => 'PIPELINES_LIST', 'subject' => 'pipeline', 'path' => 'pipelines', 'feature' => 'pipelines'],
134-
['granted' => 'TASKS', 'subject' => 'global', 'path' => 'tasks', 'feature' => 'tasks'],
135-
['granted' => 'REMOTE_CLUSTERS', 'subject' => 'global', 'path' => 'remote_clusters', 'feature' => 'remote_clusters'],
136-
['granted' => 'CAT', 'subject' => 'global', 'path' => 'cat'],
137-
['granted' => 'SQL', 'subject' => 'global', 'path' => 'sql', 'feature' => 'sql'],
138-
['granted' => 'CONSOLE', 'subject' => 'global', 'path' => 'console'],
139-
['granted' => 'DEPRECATIONS', 'subject' => 'global', 'path' => 'deprecations', 'feature' => 'deprecations'],
140-
['granted' => 'LICENSE', 'subject' => 'global', 'path' => 'license', 'feature' => 'license'],
141-
['granted' => 'INDEX_GRAVEYARD', 'subject' => 'global', 'path' => 'index_graveyard', 'feature' => 'tombstones'],
142-
['granted' => 'DANGLING_INDICES', 'subject' => 'global', 'path' => 'dangling_indices', 'feature' => 'dangling_indices'],
132+
['attribute' => 'SNAPSHOTS_LIST', 'subject' => 'snapshot', 'path' => 'snapshots'],
133+
['attribute' => 'PIPELINES_LIST', 'subject' => 'pipeline', 'path' => 'pipelines', 'feature' => 'pipelines'],
134+
['attribute' => 'TASKS', 'subject' => 'global', 'path' => 'tasks', 'feature' => 'tasks'],
135+
['attribute' => 'REMOTE_CLUSTERS', 'subject' => 'global', 'path' => 'remote_clusters', 'feature' => 'remote_clusters'],
136+
['attribute' => 'CAT', 'subject' => 'global', 'path' => 'cat'],
137+
['attribute' => 'SQL', 'subject' => 'global', 'path' => 'sql', 'feature' => 'sql'],
138+
['attribute' => 'CONSOLE', 'subject' => 'global', 'path' => 'console'],
139+
['attribute' => 'DEPRECATIONS', 'subject' => 'global', 'path' => 'deprecations', 'feature' => 'deprecations'],
140+
['attribute' => 'LICENSE', 'subject' => 'global', 'path' => 'license', 'feature' => 'license'],
141+
['attribute' => 'INDEX_GRAVEYARD', 'subject' => 'global', 'path' => 'index_graveyard', 'feature' => 'tombstones'],
142+
['attribute' => 'DANGLING_INDICES', 'subject' => 'global', 'path' => 'dangling_indices', 'feature' => 'dangling_indices'],
143143
];
144144

145145
$menus['tools'] = $this->populateMenu($entries);
146146
}
147147

148148
if (true === $this->isGranted('MENU_STATS', 'global')) {
149149
$entries = [
150-
['granted' => 'NODES_STATS', 'subject' => 'node', 'path' => 'nodes_stats'],
151-
['granted' => 'INDICES_STATS', 'subject' => 'index', 'path' => 'indices_stats'],
152-
['granted' => 'SHARDS_STATS', 'subject' => 'global', 'path' => 'shards_stats'],
153-
['granted' => 'SLM_POLICIES_STATS', 'subject' => 'slm_policy', 'path' => 'slm_stats', 'feature' => 'slm'],
154-
['granted' => 'SNAPSHOTS_STATS', 'subject' => 'snapshot', 'path' => 'snapshots_stats'],
150+
['attribute' => 'NODES_STATS', 'subject' => 'node', 'path' => 'nodes_stats'],
151+
['attribute' => 'INDICES_STATS', 'subject' => 'index', 'path' => 'indices_stats'],
152+
['attribute' => 'SHARDS_STATS', 'subject' => 'global', 'path' => 'shards_stats'],
153+
['attribute' => 'SLM_POLICIES_STATS', 'subject' => 'slm_policy', 'path' => 'slm_stats', 'feature' => 'slm'],
154+
['attribute' => 'SNAPSHOTS_STATS', 'subject' => 'snapshot', 'path' => 'snapshots_stats'],
155155
];
156156

157157
$menus['stats'] = $this->populateMenu($entries);
158158
}
159159

160160
if (true === $this->isGranted('MENU_APPLICATION', 'global')) {
161161
$entries = [
162-
['granted' => 'APP_USERS', 'subject' => 'global', 'path' => 'app_users'],
163-
['granted' => 'APP_ROLES', 'subject' => 'global', 'path' => 'app_roles'],
164-
['granted' => 'APP_UNINSTALL', 'subject' => 'global', 'path' => 'app_uninstall'],
165-
['granted' => 'APP_UPGRADE', 'subject' => 'global', 'path' => 'app_upgrade'],
166-
['granted' => 'APP_NOTIFICATIONS', 'subject' => 'global', 'path' => 'app_notifications'],
162+
['attribute' => 'APP_USERS', 'subject' => 'global', 'path' => 'app_users'],
163+
['attribute' => 'APP_ROLES', 'subject' => 'global', 'path' => 'app_roles'],
164+
['attribute' => 'APP_UNINSTALL', 'subject' => 'global', 'path' => 'app_uninstall'],
165+
['attribute' => 'APP_UPGRADE', 'subject' => 'global', 'path' => 'app_upgrade'],
166+
['attribute' => 'APP_NOTIFICATIONS', 'subject' => 'global', 'path' => 'app_notifications'],
167167
];
168168

169169
$menus['application'] = $this->populateMenu($entries);
@@ -180,7 +180,7 @@ private function populateMenu($entries)
180180
{
181181
$menu = [];
182182
foreach ($entries as $entry) {
183-
if (true === $this->isGranted($entry['granted'], $entry['subject'])) {
183+
if (true === $this->isGranted($entry['attribute'], $entry['subject'])) {
184184
$menu[] = [
185185
'path' => $entry['path'],
186186
'name' => $this->translator->trans(str_replace('_stats', '', $entry['path'])),

0 commit comments

Comments
 (0)