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