Skip to content

Commit 0bcc699

Browse files
committed
feat: add acl constraints
1 parent 001ed93 commit 0bcc699

File tree

22 files changed

+941
-4405
lines changed

22 files changed

+941
-4405
lines changed

src/Controller/DataProviderController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
#[Route(
5252
path: '/api/_action/data-provider/get-environment',
5353
name: 'api.admin.data-provider.get-environment',
54-
defaults: ['_acl' => ['admin']],
54+
defaults: ['_acl' => ['swag_migration.viewer']],
5555
methods: [Request::METHOD_GET]
5656
)]
5757
public function getEnvironment(Context $context): JsonResponse
@@ -64,7 +64,7 @@ public function getEnvironment(Context $context): JsonResponse
6464
#[Route(
6565
path: '/api/_action/data-provider/get-data',
6666
name: 'api.admin.data-provider.get-data',
67-
defaults: ['_acl' => ['admin']],
67+
defaults: ['_acl' => ['swag_migration.viewer']],
6868
methods: [Request::METHOD_GET]
6969
)]
7070
public function getData(Request $request, Context $context): JsonResponse
@@ -86,7 +86,7 @@ public function getData(Request $request, Context $context): JsonResponse
8686
#[Route(
8787
path: '/api/_action/data-provider/get-total',
8888
name: 'api.admin.data-provider.get-total',
89-
defaults: ['_acl' => ['admin']],
89+
defaults: ['_acl' => ['swag_migration.viewer']],
9090
methods: [Request::METHOD_GET]
9191
)]
9292
public function getTotal(Request $request, Context $context): JsonResponse
@@ -104,7 +104,7 @@ public function getTotal(Request $request, Context $context): JsonResponse
104104
#[Route(
105105
path: '/api/_action/data-provider/get-table',
106106
name: 'api.admin.data-provider.get-table',
107-
defaults: ['_acl' => ['admin']],
107+
defaults: ['_acl' => ['swag_migration.viewer']],
108108
methods: [Request::METHOD_GET]
109109
)]
110110
public function getTable(Request $request, Context $context): JsonResponse
@@ -124,7 +124,7 @@ public function getTable(Request $request, Context $context): JsonResponse
124124
#[Route(
125125
path: '/api/_action/data-provider/generate-document',
126126
name: 'api.admin.data-provider.generate-document',
127-
defaults: ['_acl' => ['admin']],
127+
defaults: ['_acl' => ['swag_migration.editor']],
128128
methods: [Request::METHOD_GET]
129129
)]
130130
public function generateDocument(Request $request, Context $context): JsonResponse
@@ -151,7 +151,7 @@ public function generateDocument(Request $request, Context $context): JsonRespon
151151
#[Route(
152152
path: '/api/_action/data-provider/download-private-file/{file}',
153153
name: 'api.admin.data-provider.download-private-file',
154-
defaults: ['_acl' => ['admin']],
154+
defaults: ['_acl' => ['swag_migration.editor']],
155155
methods: [Request::METHOD_GET]
156156
)]
157157
public function downloadPrivateFile(Request $request, Context $context): StreamedResponse|RedirectResponse

src/Controller/HistoryController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(private readonly HistoryServiceInterface $historySer
2929
{
3030
}
3131

32-
#[Route(path: '/api/migration/get-grouped-logs-of-run', name: 'api.admin.migration.get-grouped-logs-of-run', methods: ['GET'], defaults: ['_acl' => ['admin']])]
32+
#[Route(path: '/api/migration/get-grouped-logs-of-run', name: 'api.admin.migration.get-grouped-logs-of-run', methods: ['GET'], defaults: ['_acl' => ['swag_migration.viewer']])]
3333
public function getGroupedLogsOfRun(Request $request, Context $context): JsonResponse
3434
{
3535
$runUuid = $request->query->getAlnum('runUuid');
@@ -54,7 +54,7 @@ public function getGroupedLogsOfRun(Request $request, Context $context): JsonRes
5454
]);
5555
}
5656

57-
#[Route(path: '/api/_action/migration/download-logs-of-run', name: 'api.admin.migration.download-logs-of-run', methods: ['POST'], defaults: ['auth_required' => false, '_acl' => ['admin']])]
57+
#[Route(path: '/api/_action/migration/download-logs-of-run', name: 'api.admin.migration.download-logs-of-run', methods: ['POST'], defaults: ['auth_required' => false, '_acl' => ['swag_migration.viewer']])]
5858
public function downloadLogsOfRun(Request $request, Context $context): StreamedResponse
5959
{
6060
$runUuid = $request->request->getAlnum('runUuid');
@@ -80,7 +80,7 @@ public function downloadLogsOfRun(Request $request, Context $context): StreamedR
8080
return $response;
8181
}
8282

83-
#[Route(path: '/api/_action/migration/clear-data-of-run', name: 'api.admin.migration.clear-data-of-run', methods: ['POST'], defaults: ['_acl' => ['admin']])]
83+
#[Route(path: '/api/_action/migration/clear-data-of-run', name: 'api.admin.migration.clear-data-of-run', methods: ['POST'], defaults: ['_acl' => ['swag_migration.deleter']])]
8484
public function clearDataOfRun(Request $request, Context $context): Response
8585
{
8686
$runUuid = $request->request->getAlnum('runUuid');
@@ -98,7 +98,7 @@ public function clearDataOfRun(Request $request, Context $context): Response
9898
return new Response();
9999
}
100100

101-
#[Route(path: '/api/_action/migration/is-media-processing', name: 'api.admin.migration.is-media-processing', methods: ['GET'], defaults: ['_acl' => ['admin']])]
101+
#[Route(path: '/api/_action/migration/is-media-processing', name: 'api.admin.migration.is-media-processing', methods: ['GET'], defaults: ['_acl' => ['swag_migration_history:read']])]
102102
public function isMediaProcessing(): JsonResponse
103103
{
104104
$result = $this->historyService->isMediaProcessing();

src/Controller/PremappingController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828
) {
2929
}
3030

31-
#[Route(path: '/api/_action/migration/generate-premapping', name: 'api.admin.migration.generate-premapping', methods: ['POST'], defaults: ['_acl' => ['admin']])]
31+
#[Route(path: '/api/_action/migration/generate-premapping', name: 'api.admin.migration.generate-premapping', methods: ['POST'], defaults: ['_acl' => ['swag_migration.editor']])]
3232
public function generatePremapping(Request $request, Context $context): JsonResponse
3333
{
3434
$dataSelectionIds = $request->request->all('dataSelectionIds');
@@ -41,7 +41,7 @@ public function generatePremapping(Request $request, Context $context): JsonResp
4141
return new JsonResponse($this->premappingService->generatePremapping($context, $migrationContext, $dataSelectionIds));
4242
}
4343

44-
#[Route(path: '/api/_action/migration/write-premapping', name: 'api.admin.migration.write-premapping', methods: ['POST'], defaults: ['_acl' => ['admin']])]
44+
#[Route(path: '/api/_action/migration/write-premapping', name: 'api.admin.migration.write-premapping', methods: ['POST'], defaults: ['_acl' => ['swag_migration.editor']])]
4545
public function writePremapping(Request $request, Context $context): Response
4646
{
4747
$premapping = $request->request->all('premapping');

src/Controller/StatusController.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(
5050
#[Route(
5151
path: '/api/_action/migration/get-profile-information',
5252
name: 'api.admin.migration.get-profile-information',
53-
defaults: ['_acl' => ['admin']],
53+
defaults: ['_acl' => ['swag_migration.viewer']],
5454
methods: [Request::METHOD_GET]
5555
)]
5656
public function getProfileInformation(Request $request): Response
@@ -117,7 +117,7 @@ public function getProfileInformation(Request $request): Response
117117
#[Route(
118118
path: '/api/_action/migration/get-profiles',
119119
name: 'api.admin.migration.get-profiles',
120-
defaults: ['_acl' => ['admin']],
120+
defaults: ['_acl' => ['swag_migration.viewer']],
121121
methods: [Request::METHOD_GET]
122122
)]
123123
public function getProfiles(): JsonResponse
@@ -140,7 +140,7 @@ public function getProfiles(): JsonResponse
140140
#[Route(
141141
path: '/api/_action/migration/get-gateways',
142142
name: 'api.admin.migration.get-gateways',
143-
defaults: ['_acl' => ['admin']],
143+
defaults: ['_acl' => ['swag_migration.viewer']],
144144
methods: [Request::METHOD_GET]
145145
)]
146146
public function getGateways(Request $request): JsonResponse
@@ -168,7 +168,7 @@ public function getGateways(Request $request): JsonResponse
168168
#[Route(
169169
path: '/api/_action/migration/update-connection-credentials',
170170
name: 'api.admin.migration.update-connection-credentials',
171-
defaults: ['_acl' => ['admin']],
171+
defaults: ['_acl' => ['swag_migration.editor']],
172172
methods: [Request::METHOD_POST]
173173
)]
174174
public function updateConnectionCredentials(Request $request, Context $context): Response
@@ -195,7 +195,7 @@ public function updateConnectionCredentials(Request $request, Context $context):
195195
#[Route(
196196
path: '/api/_action/migration/data-selection',
197197
name: 'api.admin.migration.data-selection',
198-
defaults: ['_acl' => ['admin']],
198+
defaults: ['_acl' => ['swag_migration.viewer']],
199199
methods: [Request::METHOD_GET]
200200
)]
201201
public function getDataSelection(Request $request, Context $context): JsonResponse
@@ -222,7 +222,7 @@ public function getDataSelection(Request $request, Context $context): JsonRespon
222222
#[Route(
223223
path: '/api/_action/migration/check-connection',
224224
name: 'api.admin.migration.check-connection',
225-
defaults: ['_acl' => ['admin']],
225+
defaults: ['_acl' => ['swag_migration.viewer']],
226226
methods: [Request::METHOD_POST]
227227
)]
228228
public function checkConnection(Request $request, Context $context): JsonResponse
@@ -248,7 +248,7 @@ public function checkConnection(Request $request, Context $context): JsonRespons
248248
#[Route(
249249
path: '/api/_action/migration/start-migration',
250250
name: 'api.admin.migration.start-migration',
251-
defaults: ['_acl' => ['admin']],
251+
defaults: ['_acl' => ['swag_migration.creator']],
252252
methods: [Request::METHOD_POST]
253253
)]
254254
public function startMigration(Request $request, Context $context): Response
@@ -281,7 +281,7 @@ public function startMigration(Request $request, Context $context): Response
281281
#[Route(
282282
path: '/api/_action/migration/get-state',
283283
name: 'api.admin.migration.get-state',
284-
defaults: ['_acl' => ['admin']],
284+
defaults: ['_acl' => ['swag_migration.viewer']],
285285
methods: [Request::METHOD_GET]
286286
)]
287287
public function getState(Context $context): JsonResponse
@@ -292,7 +292,7 @@ public function getState(Context $context): JsonResponse
292292
#[Route(
293293
path: '/api/_action/migration/approve-finished',
294294
name: 'api.admin.migration.approveFinished',
295-
defaults: ['_acl' => ['admin']],
295+
defaults: ['_acl' => ['swag_migration.editor']],
296296
methods: [Request::METHOD_POST]
297297
)]
298298
public function approveFinishedMigration(Context $context): Response
@@ -313,7 +313,7 @@ public function approveFinishedMigration(Context $context): Response
313313
#[Route(
314314
path: '/api/_action/migration/abort-migration',
315315
name: 'api.admin.migration.abort-migration',
316-
defaults: ['_acl' => ['admin']],
316+
defaults: ['_acl' => ['swag_migration.editor']],
317317
methods: [Request::METHOD_POST]
318318
)]
319319
public function abortMigration(Context $context): Response
@@ -330,7 +330,7 @@ public function abortMigration(Context $context): Response
330330
#[Route(
331331
path: '/api/_action/migration/reset-checksums',
332332
name: 'api.admin.migration.reset-checksums',
333-
defaults: ['_acl' => ['admin']],
333+
defaults: ['_acl' => ['swag_migration.deleter']],
334334
methods: [Request::METHOD_POST]
335335
)]
336336
public function resetChecksums(Request $request, Context $context): Response
@@ -355,7 +355,7 @@ public function resetChecksums(Request $request, Context $context): Response
355355
#[Route(
356356
path: '/api/_action/migration/cleanup-migration-data',
357357
name: 'api.admin.migration.cleanup-migration-data',
358-
defaults: ['_acl' => ['admin']],
358+
defaults: ['_acl' => ['swag_migration.deleter']],
359359
methods: [Request::METHOD_POST]
360360
)]
361361
public function cleanupMigrationData(Context $context): Response
@@ -368,7 +368,7 @@ public function cleanupMigrationData(Context $context): Response
368368
#[Route(
369369
path: '/api/_action/migration/get-reset-status',
370370
name: 'api.admin.migration.get-reset-status',
371-
defaults: ['_acl' => ['admin']],
371+
defaults: ['_acl' => ['swag_migration.viewer']],
372372
methods: [Request::METHOD_GET]
373373
)]
374374
public function getResetStatus(Context $context): JsonResponse

0 commit comments

Comments
 (0)