Skip to content

Commit

Permalink
[TM-1171] fix role policy check
Browse files Browse the repository at this point in the history
  • Loading branch information
pachonjcl committed Aug 21, 2024
1 parent b51280c commit 05591af
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Policies/V2/Nurseries/NurseryPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function approve(?User $user, ?Nursery $nursery = null): bool

public function export(?User $user, ?Form $form = null, ?Project $project = null): bool
{
if ($user->primaryRole?->name == 'project-manager') {
if ($user->hasRole('project-manager')) {
return $user->my_frameworks_slug->contains($form->framework_key);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Policies/V2/Nurseries/NurseryReportPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected function isManagingProject(User $user, Project $project): bool

public function export(?User $user, ?Form $form = null, ?Project $project = null): bool
{
if ($user->primaryRole?->name == 'project-manager') {
if ($user->hasRole('project-manager')) {
return $user->my_frameworks_slug->contains($form->framework_key);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Policies/V2/Projects/ProjectPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected function isManaging(?User $user, ?Project $project = null): bool

public function export(?User $user, ?Form $form = null, ?Project $project = null): bool
{
if ($user->primaryRole?->name == 'project-manager') {
if ($user->hasRole('project-manager')) {
return $user->my_frameworks_slug->contains($form->framework_key);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Policies/V2/Projects/ProjectReportPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function isManagingProject(User $user, Project $project): bool

public function export(?User $user, ?Form $form = null, ?Project $project = null): bool
{
if ($user->primaryRole?->name == 'project-manager') {
if ($user->hasRole('project-manager')) {
return $user->my_frameworks_slug->contains($form->framework_key);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Policies/V2/Sites/SitePolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function uploadPolygons(?User $user, ?Site $site): bool

public function export(?User $user, ?Form $form = null, ?Project $project = null): bool
{
if ($user->primaryRole?->name == 'project-manager') {
if ($user->hasRole('project-manager')) {
return $user->my_frameworks_slug->contains($form->framework_key);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Policies/V2/Sites/SiteReportPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function isManagingProject(User $user, Project $project): bool

public function export(?User $user, ?Form $form = null, ?Project $project = null): bool
{
if ($user->primaryRole?->name == 'project-manager') {
if ($user->hasRole('project-manager')) {
return $user->my_frameworks_slug->contains($form->framework_key);
}

Expand Down

0 comments on commit 05591af

Please sign in to comment.