Fix file manager permissions
This commit is contained in:
parent
a1c6aa6358
commit
80bef5bd93
|
@ -173,6 +173,22 @@ class ServerPolicy
|
||||||
return $user->permissions()->server($server)->permission('download-files')->exists();
|
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.
|
* Check if user has permission to change the default connection information.
|
||||||
*
|
*
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<div class="col-md-3 hidden-xs hidden-sm">
|
<div class="col-md-3 hidden-xs hidden-sm">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<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>
|
<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
|
@endcan
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
<td><i class="fa fa-file-text" style="margin-left: 2px;"></i></td>
|
<td><i class="fa fa-file-text" style="margin-left: 2px;"></i></td>
|
||||||
<td>
|
<td>
|
||||||
@if(in_array($file['extension'], $extensions))
|
@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>
|
<a href="/server/{{ $server->uuidShort }}/files/edit/@if($file['directory'] !== ''){{ $file['directory'] }}/@endif{{ $file['entry'] }}" class="edit_file">{{ $file['entry'] }}</a>
|
||||||
@else
|
@else
|
||||||
{{ $file['entry'] }}
|
{{ $file['entry'] }}
|
||||||
|
@ -69,12 +69,12 @@
|
||||||
<div class="col-md-3 hidden-xs hidden-sm">
|
<div class="col-md-3 hidden-xs hidden-sm">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 hidden-xs hidden-sm">
|
<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>
|
<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
|
@endcan
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<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>
|
<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
|
@endcan
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue