diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index 0d885485e..9344d8e25 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -432,11 +432,49 @@ App::get('/console/storage/bucket') ->inject('layout') ->action(function (string $id, Response $response, View $layout) { + $bucketPermissions = new View(__DIR__ . '/../../views/console/comps/permissions-matrix.phtml'); + $bucketPermissions + ->setParam('method', 'databases.getBucket') + ->setParam('events', 'load,databases.updateBucket') + ->setParam('data', 'project-bucket') + ->setParam('form', 'bucketPermissions') + ->setParam('params', [ + 'bucket-id' => '{{router.params.id}}', + ]); + + $fileCreatePermissions = new View(__DIR__ . '/../../views/console/comps/permissions-matrix.phtml'); + $fileCreatePermissions + ->setParam('data', 'project-document') + ->setParam('form', 'fileCreatePermissions') + ->setParam('permissions', \array_filter( + Database::PERMISSIONS, + fn ($perm) => $perm != Database::PERMISSION_CREATE + )) + ->setParam('params', [ + 'bucket-id' => '{{router.params.id}}', + ]); + + $fileUpdatePermissions = new View(__DIR__ . '/../../views/console/comps/permissions-matrix.phtml'); + $fileUpdatePermissions + ->setParam('method', 'storage.getFile') + ->setParam('data', 'project-document') + ->setParam('form', 'fileUpdatePermissions') + ->setParam('permissions', \array_filter( + Database::PERMISSIONS, + fn ($perm) => $perm != Database::PERMISSION_CREATE + )) + ->setParam('params', [ + 'bucket-id' => '{{router.params.id}}', + ]); + $page = new View(__DIR__ . '/../../views/console/storage/bucket.phtml'); $page ->setParam('home', App::getEnv('_APP_HOME', 0)) ->setParam('fileLimit', App::getEnv('_APP_STORAGE_LIMIT', 0)) ->setParam('fileLimitHuman', Storage::human(App::getEnv('_APP_STORAGE_LIMIT', 0))) + ->setParam('bucketPermissions', $bucketPermissions) + ->setParam('fileCreatePermissions', $fileCreatePermissions) + ->setParam('fileUpdatePermissions', $fileUpdatePermissions) ; $layout diff --git a/app/views/console/storage/bucket.phtml b/app/views/console/storage/bucket.phtml index 232e69c93..ed5c80a6b 100644 --- a/app/views/console/storage/bucket.phtml +++ b/app/views/console/storage/bucket.phtml @@ -2,6 +2,9 @@ $home = $this->getParam('home', ''); $fileLimit = $this->getParam('fileLimit', 0); $fileLimitHuman = $this->getParam('fileLimitHuman', 0); +$bucketPermissions = $this->getParam('bucketPermissions', null); +$fileCreatePermissions = $this->getParam('fileCreatePermissions', null); +$fileUpdatePermissions = $this->getParam('fileUpdatePermissions', null); ?>
getParam('fileLimitHuman', 0);
+ +
+
+
+
- - -
Add 'any' for wildcard access
+
+ + - - -
Add 'any' for wildcard access
+

Permissions

+ + setParam('method', 'storage.getFile')->render(); + ?> +
getParam('fileLimitHuman', 0); data-analytics-category="console" data-analytics-label="Create Storage File" x-data - @submit.prevent="$store.uploader.uploadFile($event.target)" - > + @submit.prevent="$store.uploader.uploadFile($event.target)"> @@ -285,18 +294,19 @@ $fileLimitHuman = $this->getParam('fileLimitHuman', 0); name="fileId" id="fileId" /> - +
(Max file size allowed: )
- - -
Add 'any' for wildcard access
+
+ + - - -
Add 'any' for wildcard access
+

Permissions

+ + render() ?> +