From 80bef5bd93c3872dc5ccb60405759e4135959dbc Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 8 Jan 2016 22:42:33 -0500 Subject: [PATCH] Fix file manager permissions --- app/Policies/ServerPolicy.php | 16 ++++++++++++++++ resources/views/server/files/list.blade.php | 8 ++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/Policies/ServerPolicy.php b/app/Policies/ServerPolicy.php index 977b5accf..92ced414e 100644 --- a/app/Policies/ServerPolicy.php +++ b/app/Policies/ServerPolicy.php @@ -173,6 +173,22 @@ class ServerPolicy return $user->permissions()->server($server)->permission('download-files')->exists(); } + /** + * Check if user has permission to delete files from a server. + * + * @param Pterodactyl\Models\User $user + * @param Pterodactyl\Models\Server $server + * @return boolean + */ + public function deleteFiles(User $user, Server $server) + { + if ($this->isOwner($user, $server)) { + return true; + } + + return $user->permissions()->server($server)->permission('delete-files')->exists(); + } + /** * Check if user has permission to change the default connection information. * diff --git a/resources/views/server/files/list.blade.php b/resources/views/server/files/list.blade.php index 2001024ca..5877e65ff 100644 --- a/resources/views/server/files/list.blade.php +++ b/resources/views/server/files/list.blade.php @@ -40,7 +40,7 @@
- @can('delete-file', $server) + @can('delete-files', $server) @endcan
@@ -53,7 +53,7 @@ @if(in_array($file['extension'], $extensions)) - @can('edit-file', $server) + @can('edit-files', $server) {{ $file['entry'] }} @else {{ $file['entry'] }} @@ -69,12 +69,12 @@
- @can('delete-file', $server) + @can('delete-files', $server) @endcan