Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TM-1171] fix role policy check #423

Draft
wants to merge 1 commit into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading