Don't allow valuation if cannot edit dossier
We were adding the condition to show the form in the view. However, that doesn't prevent users from sending a POST/PUT request to the controller action. We could add the condition to the controller as well, but since the `valuate` permission is only used in one place, it's easier to restrict that permission to valuators who can edit the dossier.
This commit is contained in:
@@ -22,20 +22,16 @@ describe Abilities::Valuator do
|
||||
|
||||
it { should be_able_to(:valuate, assigned_investment) }
|
||||
it { should be_able_to(:valuate, group_assigned_investment) }
|
||||
it { should be_able_to(:comment_valuation, assigned_investment) }
|
||||
|
||||
it { should_not be_able_to(:valuate, non_assigned_investment) }
|
||||
it { should_not be_able_to(:valuate, finished_assigned_investment) }
|
||||
|
||||
it { should be_able_to(:edit_dossier, assigned_investment) }
|
||||
it { should be_able_to(:comment_valuation, assigned_investment) }
|
||||
|
||||
it { should_not be_able_to(:edit_dossier, finished_assigned_investment) }
|
||||
it { should_not be_able_to(:comment_valuation, finished_assigned_investment) }
|
||||
|
||||
context "cannot edit dossier" do
|
||||
before { valuator.can_edit_dossier = false }
|
||||
|
||||
it { should_not be_able_to(:edit_dossier, assigned_investment) }
|
||||
it { should_not be_able_to(:valuate, assigned_investment) }
|
||||
end
|
||||
|
||||
context "cannot comment" do
|
||||
|
||||
Reference in New Issue
Block a user