diff --git a/app/Policies/ServerPolicy.php b/app/Policies/ServerPolicy.php index 1922ce56e..0bb59caa5 100644 --- a/app/Policies/ServerPolicy.php +++ b/app/Policies/ServerPolicy.php @@ -221,4 +221,13 @@ class ServerPolicy return $user->permissions()->server($server)->permission('view-manage')->exists(); } + public function viewAllocation(User $user, Server $server) + { + if ($this->isOwner($user, $server)) { + return true; + } + + return $user->permissions()->server($server)->permission('view-allocation')->exists(); + } + } diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php index b5cfa3e6f..b71bd10c0 100644 --- a/resources/views/layouts/master.blade.php +++ b/resources/views/layouts/master.blade.php @@ -193,9 +193,9 @@
{{ trans('pagination.sidebar.server_controls') }} {{ trans('pagination.sidebar.overview') }} - @can('list-files', Auth::user()){{ trans('pagination.sidebar.files') }}@endcan - @can('view-subusers', Auth::user()){{ trans('pagination.sidebar.subusers') }}@endcan - @can('view-manage', Auth::user()){{ trans('pagination.sidebar.manage') }}@endcan + @can('list-files', $server){{ trans('pagination.sidebar.files') }}@endcan + @can('view-subusers', $server){{ trans('pagination.sidebar.subusers') }}@endcan + @can('view-manage', $server){{ trans('pagination.sidebar.manage') }}@endcan
@endif @show diff --git a/resources/views/server/index.blade.php b/resources/views/server/index.blade.php index 598a4c6c2..8ba699279 100644 --- a/resources/views/server/index.blade.php +++ b/resources/views/server/index.blade.php @@ -14,7 +14,7 @@
@@ -78,7 +78,7 @@
- @can('allocation', $server) + @can('view-allocation', $server)
@@ -384,7 +384,7 @@ $(window).load(function () { } } - @can('set-connection', $server) + @can('view-allocation', $server) // Send Request $('[data-action="set-connection"]').click(function (event) { event.preventDefault();