From bbc883086fab583a684c2d9038e66ee314783b1a Mon Sep 17 00:00:00 2001 From: Wun Chiou Date: Wed, 13 Nov 2024 21:57:44 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixes=20Profile=20Policy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes PROFILES-6M --- app/Policies/ProfilePolicy.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Policies/ProfilePolicy.php b/app/Policies/ProfilePolicy.php index ad4b42d8..ac7587f3 100644 --- a/app/Policies/ProfilePolicy.php +++ b/app/Policies/ProfilePolicy.php @@ -84,11 +84,11 @@ public function view(?User $user, Profile $profile) return $profile->public; } - return $profile->public || - $user->hasRole(['site_admin', 'profiles_editor']) || - $user->owns($profile, true) || - $this->checkSchoolEditor($user, $profile) || - $this->checkDepartmentEditor($user, $profile); + return $profile->public || ($user && ( + $user->owns($profile, true) || + $this->checkSchoolEditor($user, $profile) || + $this->checkDepartmentEditor($user, $profile) + )); } /**