From 7e45f917c7cd563753ade5095e1aabdee748371a Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 17 Mar 2017 16:19:45 -0400 Subject: [PATCH] Fix subuser permissions in file manager --- .../Controllers/Server/ServerController.php | 2 +- app/Policies/ServerPolicy.php | 6 +- app/Repositories/SubuserRepository.php | 2 +- .../pterodactyl/server/users/view.blade.php | 146 +++++------------- 4 files changed, 43 insertions(+), 113 deletions(-) diff --git a/app/Http/Controllers/Server/ServerController.php b/app/Http/Controllers/Server/ServerController.php index c1514e334..751f36093 100644 --- a/app/Http/Controllers/Server/ServerController.php +++ b/app/Http/Controllers/Server/ServerController.php @@ -112,7 +112,7 @@ class ServerController extends Controller public function getAddFile(Request $request, $uuid) { $server = Models\Server::byUuid($uuid); - $this->authorize('add-files', $server); + $this->authorize('create-files', $server); $server->js(); diff --git a/app/Policies/ServerPolicy.php b/app/Policies/ServerPolicy.php index 767dec13c..7079aaa19 100644 --- a/app/Policies/ServerPolicy.php +++ b/app/Policies/ServerPolicy.php @@ -253,14 +253,14 @@ class ServerPolicy * @param \Pterodactyl\Models\Server $server * @return bool */ - public function addFiles(User $user, Server $server) + public function createFiles(User $user, Server $server) { - return $this->checkPermission($user, $server, 'add-files'); + return $this->checkPermission($user, $server, 'create-files'); } /** * Check if user has permission to upload files to a server. - * This permission relies on the user having the 'add-files' permission as well due to page authorization. + * This permission relies on the user having the 'create-files' permission as well due to page authorization. * * @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\Server $server diff --git a/app/Repositories/SubuserRepository.php b/app/Repositories/SubuserRepository.php index 2d9da4b29..a6e0123ce 100644 --- a/app/Repositories/SubuserRepository.php +++ b/app/Repositories/SubuserRepository.php @@ -62,7 +62,7 @@ class SubuserRepository 'list-files' => 's:files:get', 'edit-files' => 's:files:read', 'save-files' => 's:files:post', - 'create-files' => 's:files:post', + 'create-files' => 's:files:create', 'download-files' => null, 'upload-files' => 's:files:upload', 'delete-files' => 's:files:delete', diff --git a/resources/themes/pterodactyl/server/users/view.blade.php b/resources/themes/pterodactyl/server/users/view.blade.php index 925fbdf05..fdb4e0c0d 100644 --- a/resources/themes/pterodactyl/server/users/view.blade.php +++ b/resources/themes/pterodactyl/server/users/view.blade.php @@ -71,40 +71,30 @@

@lang('server.users.new.power_header')

-
- +
+ + +

@lang('server.users.new.start.description')

-
-