adds admin permissions for investments
This commit is contained in:
@@ -4,7 +4,6 @@ module Abilities
|
|||||||
|
|
||||||
def initialize(user)
|
def initialize(user)
|
||||||
self.merge Abilities::Moderation.new(user)
|
self.merge Abilities::Moderation.new(user)
|
||||||
self.merge Abilities::Valuator.new(user)
|
|
||||||
|
|
||||||
can :restore, Comment
|
can :restore, Comment
|
||||||
cannot :restore, Comment, hidden_at: nil
|
cannot :restore, Comment, hidden_at: nil
|
||||||
@@ -41,7 +40,12 @@ module Abilities
|
|||||||
|
|
||||||
can :manage, Annotation
|
can :manage, Annotation
|
||||||
|
|
||||||
can [:read, :update, :destroy, :summary], SpendingProposal
|
can [:read, :update, :valuate, :destroy, :summary], SpendingProposal
|
||||||
|
|
||||||
|
can [:create, :update], Budget
|
||||||
|
can [:hide, :update], Budget::Investment
|
||||||
|
can :valuate, Budget::Investment, budget: { valuating: true }
|
||||||
|
can :create, Budget::ValuatorAssignment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -56,4 +56,16 @@ describe "Abilities::Administrator" do
|
|||||||
it { should be_able_to(:update, SpendingProposal) }
|
it { should be_able_to(:update, SpendingProposal) }
|
||||||
it { should be_able_to(:valuate, SpendingProposal) }
|
it { should be_able_to(:valuate, SpendingProposal) }
|
||||||
it { should be_able_to(:destroy, SpendingProposal) }
|
it { should be_able_to(:destroy, SpendingProposal) }
|
||||||
|
|
||||||
|
it { should be_able_to(:create, Budget) }
|
||||||
|
it { should be_able_to(:update, Budget) }
|
||||||
|
|
||||||
|
it { should be_able_to(:create, Budget::ValuatorAssignment) }
|
||||||
|
|
||||||
|
it { should be_able_to(:update, Budget::Investment) }
|
||||||
|
it { should be_able_to(:hide, Budget::Investment) }
|
||||||
|
|
||||||
|
it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, valuating: true))) }
|
||||||
|
it { should_not be_able_to(:valuate, create(:budget_investment, budget: create(:budget, valuating: false))) }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user