diff --git a/app/Concerns/HasPermissions.php b/app/Concerns/HasPermissions.php index f8295740..3653d678 100644 --- a/app/Concerns/HasPermissions.php +++ b/app/Concerns/HasPermissions.php @@ -75,7 +75,7 @@ public function hasAccessToNomenclature(): bool return (bool) $this->permissions?->admin_permissions->contains(AdminPermission::CAN_CHANGE_NOMENCLATURE); } - public function hasAccessToCommunity(): bool + public function canChangeOrganizationProfile(): bool { if ($this->isAdmin()) { return true; diff --git a/app/Filament/Organizations/Resources/CommunityProfileResource.php b/app/Filament/Organizations/Resources/CommunityProfileResource.php index e4dbc4e8..d73fbf28 100644 --- a/app/Filament/Organizations/Resources/CommunityProfileResource.php +++ b/app/Filament/Organizations/Resources/CommunityProfileResource.php @@ -31,6 +31,11 @@ class CommunityProfileResource extends Resource protected static ?int $navigationSort = 21; + public static function canAccess(): bool + { + return auth()->user()->canChangeOrganizationProfile(); + } + public static function getNavigationGroup(): ?string { return __('navigation.community._group'); diff --git a/app/Policies/CommunityProfilePolicy.php b/app/Policies/CommunityProfilePolicy.php index 2feedd6e..9398483d 100644 --- a/app/Policies/CommunityProfilePolicy.php +++ b/app/Policies/CommunityProfilePolicy.php @@ -14,7 +14,7 @@ class CommunityProfilePolicy */ public function viewAny(User $user): bool { - return $user->hasAccessToCommunity(); + return true; } /** @@ -22,7 +22,7 @@ public function viewAny(User $user): bool */ public function view(User $user, CommunityProfile $communityProfile): bool { - return $user->hasAccessToCommunity(); + return true; } /** @@ -30,7 +30,7 @@ public function view(User $user, CommunityProfile $communityProfile): bool */ public function create(User $user): bool { - return $user->hasAccessToCommunity(); + return true; } /** @@ -38,7 +38,7 @@ public function create(User $user): bool */ public function update(User $user, CommunityProfile $communityProfile): bool { - return $user->hasAccessToCommunity(); + return true; } /** @@ -46,7 +46,7 @@ public function update(User $user, CommunityProfile $communityProfile): bool */ public function delete(User $user, CommunityProfile $communityProfile): bool { - return $user->hasAccessToCommunity(); + return true; } /**