1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-25 10:32:31 +01:00

Fix file manager permissions

This commit is contained in:
Dane Everitt 2016-01-08 22:42:33 -05:00
parent a1c6aa6358
commit 80bef5bd93
2 changed files with 20 additions and 4 deletions

View File

@ -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.
*

View File

@ -40,7 +40,7 @@
<div class="col-md-3 hidden-xs hidden-sm">
</div>
<div class="col-md-3">
@can('delete-file', $server)
@can('delete-files', $server)
<a href="@if($folder['directory'] !== ''){{ $folder['directory'] }}/@endif{{ $folder['entry'] }}" class="delete_file"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span></a>
@endcan
</div>
@ -53,7 +53,7 @@
<td><i class="fa fa-file-text" style="margin-left: 2px;"></i></td>
<td>
@if(in_array($file['extension'], $extensions))
@can('edit-file', $server)
@can('edit-files', $server)
<a href="/server/{{ $server->uuidShort }}/files/edit/@if($file['directory'] !== ''){{ $file['directory'] }}/@endif{{ $file['entry'] }}" class="edit_file">{{ $file['entry'] }}</a>
@else
{{ $file['entry'] }}
@ -69,12 +69,12 @@
<div class="col-md-3 hidden-xs hidden-sm">
</div>
<div class="col-md-3 hidden-xs hidden-sm">
@can('download-file', $server)
@can('download-files', $server)
<a href="/server/{{ $server->uuidShort }}/files/download/@if($file['directory'] !== ''){{ $file['directory'] }}/@endif{{ $file['entry'] }}"><span class="badge"><i class="fa fa-download"></i></span></a>
@endcan
</div>
<div class="col-md-3">
@can('delete-file', $server)
@can('delete-files', $server)
<a href="@if($file['directory'] !== ''){{ $file['directory'] }}/@endif{{ $file['entry'] }}" class="delete_file"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span>
@endcan
</div>