Skip to content

Commit

Permalink
Allow service support to change the significant date
Browse files Browse the repository at this point in the history
Whilst earlier implementation allowed them to do this, we refactored that
so this work allows them to once again change the conversion or transfer
date on a project.
  • Loading branch information
mec committed Mar 25, 2024
1 parent 1b67339 commit 39b0d32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/policies/project_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def update?

def change_significant_date?
return false if @record.significant_date_provisional?
return true if @user.is_service_support?

project_assigned_to_user?
end
Expand Down
4 changes: 4 additions & 0 deletions spec/policies/project_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
expect(subject).to permit(application_user, build(:conversion_project, assigned_to: application_user, conversion_date_provisional: false))
end

it "grants access if the user is service support" do
expect(subject).to permit(build(:user, :service_support), build(:conversion_project, assigned_to: application_user, conversion_date_provisional: false))
end

it "denies access if the project is assigned to another user" do
expect(subject).not_to permit(application_user, build(:conversion_project, assigned_to: build(:user), conversion_date_provisional: false))
end
Expand Down

0 comments on commit 39b0d32

Please sign in to comment.