From f4f8e9fa94f7089c3d1c03bd724ade5afc798a47 Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 16 Oct 2024 08:44:46 +1100 Subject: [PATCH] Fix some user permissions, when viewing netmails and other systems --- app/Policies/NetmailPolicy.php | 11 +++----- .../views/system/widget/system.blade.php | 26 ++++++++++--------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/app/Policies/NetmailPolicy.php b/app/Policies/NetmailPolicy.php index d4dae03..2745f58 100644 --- a/app/Policies/NetmailPolicy.php +++ b/app/Policies/NetmailPolicy.php @@ -19,17 +19,14 @@ class NetmailPolicy */ public function view(User $user, Netmail $o): bool { - $zones = $user->zc()->pluck('zone') - //->merge($user->rc()->pluck('zone')) - //->merge($user->nc()->pluck('zone')) - //->merge($user->hub()->pluck('zone')) - ->merge($user->points()->pluck('zone')); + $addresses = $user->addresses()->pluck('id'); // Site Admins can always view return ( $user->isAdmin() - || ($zones->contains($o->fftn->zone)) - || ($zones->contains($o->tftn->zone)) + || $user->isZC() + || ($addresses->contains($o->fftn_id)) + || ($addresses->contains($o->tftn_id)) ); } } \ No newline at end of file diff --git a/resources/views/system/widget/system.blade.php b/resources/views/system/widget/system.blade.php index 9834c79..599914b 100644 --- a/resources/views/system/widget/system.blade.php +++ b/resources/views/system/widget/system.blade.php @@ -159,7 +159,7 @@ use App\Models\{Mailer,User};
- id.'.active',$x?->pivot->active))checked @endif> + id.'.active',$x?->pivot->active))checked @endif @cannot($action,$o)disabled @endcannot>
@error('mailer_details.'.$mo->id.'.port') @@ -177,7 +177,7 @@ use App\Models\{Mailer,User};
- @foreach (Packet::PACKET_TYPES as $type => $class) @endforeach @@ -217,7 +217,7 @@ use App\Models\{Mailer,User};
- @@ -303,15 +303,15 @@ use App\Models\{Mailer,User};
-
- -
- -
-
- - @can('admin',$o) +
+ +
+ +
+
+ +
pollmode))d-none @endif" id="heartbeat_option">
@@ -438,7 +438,9 @@ use App\Models\{Mailer,User}; @else NOTE: You'll be able to update these details after registration is completed. - + {{-- + + --}} @endcan @else