diff --git a/app/Policies/V2/Nurseries/NurseryPolicy.php b/app/Policies/V2/Nurseries/NurseryPolicy.php index 674c96f6c..9683835e0 100644 --- a/app/Policies/V2/Nurseries/NurseryPolicy.php +++ b/app/Policies/V2/Nurseries/NurseryPolicy.php @@ -12,6 +12,10 @@ class NurseryPolicy extends Policy { public function read(?User $user, ?Nursery $nursey = null): bool { + if ($this->isAdmin($user)) { + return true; + } + if ($user->can('framework-' . $nursey->framework_key)) { return true; } diff --git a/app/Policies/V2/Nurseries/NurseryReportPolicy.php b/app/Policies/V2/Nurseries/NurseryReportPolicy.php index a82298225..494a7c52a 100644 --- a/app/Policies/V2/Nurseries/NurseryReportPolicy.php +++ b/app/Policies/V2/Nurseries/NurseryReportPolicy.php @@ -12,6 +12,10 @@ class NurseryReportPolicy extends Policy { public function read(?User $user, ?NurseryReport $report = null): bool { + if ($this->isAdmin($user)) { + return true; + } + if ($user->can('framework-' . $report->framework_key)) { return true; } diff --git a/app/Policies/V2/Projects/ProjectPolicy.php b/app/Policies/V2/Projects/ProjectPolicy.php index 6c81bdbcb..60f4b0a2d 100644 --- a/app/Policies/V2/Projects/ProjectPolicy.php +++ b/app/Policies/V2/Projects/ProjectPolicy.php @@ -12,6 +12,10 @@ class ProjectPolicy extends Policy { public function read(?User $user, ?Project $project = null): bool { + if ($this->isAdmin($user)) { + return true; + } + if ($user->can('framework-' . $project->framework_key)) { return true; } diff --git a/app/Policies/V2/Projects/ProjectReportPolicy.php b/app/Policies/V2/Projects/ProjectReportPolicy.php index f3ad40050..61d3ab5dc 100644 --- a/app/Policies/V2/Projects/ProjectReportPolicy.php +++ b/app/Policies/V2/Projects/ProjectReportPolicy.php @@ -12,6 +12,10 @@ class ProjectReportPolicy extends Policy { public function read(?User $user, ?ProjectReport $report = null): bool { + if ($this->isAdmin($user)) { + return true; + } + if ($user->can('framework-' . $report->framework_key)) { return true; } diff --git a/app/Policies/V2/Sites/SitePolicy.php b/app/Policies/V2/Sites/SitePolicy.php index a7720100d..0962a0bae 100644 --- a/app/Policies/V2/Sites/SitePolicy.php +++ b/app/Policies/V2/Sites/SitePolicy.php @@ -12,6 +12,10 @@ class SitePolicy extends Policy { public function read(?User $user, ?Site $site = null): bool { + if ($this->isAdmin($user)) { + return true; + } + if ($user->can('framework-' . $site->framework_key)) { return true; } diff --git a/app/Policies/V2/Sites/SiteReportPolicy.php b/app/Policies/V2/Sites/SiteReportPolicy.php index f6f2af4b7..1ac064e1c 100644 --- a/app/Policies/V2/Sites/SiteReportPolicy.php +++ b/app/Policies/V2/Sites/SiteReportPolicy.php @@ -12,6 +12,10 @@ class SiteReportPolicy extends Policy { public function read(?User $user, ?SiteReport $report = null): bool { + if ($this->isAdmin($user)) { + return true; + } + if ($user->can('framework-' . $report->framework_key)) { return true; } diff --git a/app/Policies/V2/Tasks/TaskPolicy.php b/app/Policies/V2/Tasks/TaskPolicy.php index 6029d8220..b002b1956 100644 --- a/app/Policies/V2/Tasks/TaskPolicy.php +++ b/app/Policies/V2/Tasks/TaskPolicy.php @@ -11,6 +11,10 @@ class TaskPolicy extends Policy { public function read(?User $user, ?Task $task = null): bool { + if ($this->isAdmin($user)) { + return true; + } + if ($user->can('framework-' . $task->project->framework_key)) { return true; } @@ -24,7 +28,7 @@ public function read(?User $user, ?Task $task = null): bool public function readAll(?User $user, ?Task $task = null): bool { - return $user->hasAnyPermission(['framework-terrafund', 'framework-ppc']); + return $user->hasAnyPermission(['framework-terrafund', 'framework-ppc']) || $this->isAdmin($user); } public function update(?User $user, ?Task $task = null): bool