Skip to content

Commit

Permalink
Allow Service Support users to change assignment
Browse files Browse the repository at this point in the history
We want service support users to be able to change any of the
assignments.
  • Loading branch information
mec committed Mar 21, 2024
1 parent 4a8713b commit 1b67339
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Allow service support users to be able to access all exports

### Changed

- Service Support users can now change any of the assignments for a project

## [Release-60][release-60]

### Changed
Expand Down
10 changes: 9 additions & 1 deletion app/policies/assignment_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ def initialize(user, _assignment)
end

def assign_team_leader?
return true if @user.is_service_support?

@user.manage_team?
end

Expand All @@ -14,6 +16,8 @@ def update_team_leader?
end

def assign_regional_delivery_officer?
return true if @user.is_service_support?

@user.manage_team?
end

Expand All @@ -22,6 +26,8 @@ def update_regional_delivery_officer?
end

def assign_assigned_to?
return true if @user.is_service_support?

@user.has_role?
end

Expand All @@ -30,10 +36,12 @@ def update_assigned_to?
end

def assign_team?
return true if @user.is_service_support?

@user.has_role?
end

def update_team?
@user.has_role?
assign_team?
end
end
15 changes: 15 additions & 0 deletions spec/policies/assignment_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
expect(subject).to permit(user)
end

it "grants access when the user is service support" do
user = build(:user, :service_support)
expect(subject).to permit(user)
end

it "denies access when the user is not a team lead" do
user = build(:user)
expect(subject).not_to permit(user)
Expand All @@ -21,6 +26,11 @@
expect(subject).to permit(user)
end

it "grants access when the user is service support" do
user = build(:user, :service_support)
expect(subject).to permit(user)
end

it "denies access when the user is not a team lead" do
user = build(:user)
expect(subject).not_to permit(user)
Expand All @@ -33,6 +43,11 @@
expect(subject).to permit(user)
end

it "grants access when the user is service support" do
user = build(:user, :service_support)
expect(subject).to permit(user)
end

it "denies access when the user is not a team lead" do
user = build(:user)
expect(subject).not_to permit(user)
Expand Down

0 comments on commit 1b67339

Please sign in to comment.