Add valuation permissions to groups
This commit is contained in:
@@ -5,8 +5,8 @@ module Abilities
|
||||
def initialize(user)
|
||||
valuator = user.valuator
|
||||
can [:read, :update, :valuate], SpendingProposal
|
||||
can [:read, :update, :comment_valuation], Budget::Investment, id: valuator.investment_ids
|
||||
can [:valuate], Budget::Investment, { id: valuator.investment_ids, valuation_finished: false }
|
||||
can [:read, :update, :comment_valuation], Budget::Investment, id: valuator.investment_ids + valuator.valuator_group.investment_ids
|
||||
can [:valuate], Budget::Investment, { id: valuator.investment_ids + valuator.valuator_group.investment_ids, valuation_finished: false }
|
||||
cannot [:update, :valuate, :comment_valuation], Budget::Investment, budget: { phase: 'finished' }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
class ValuatorGroup < ActiveRecord::Base
|
||||
has_many :valuators
|
||||
has_many :valuator_group_assignments, dependent: :destroy, class_name: 'Budget::ValuatorGroupAssignment'
|
||||
has_many :investments, through: :valuator_group_assignments, class_name: 'Budget::Investment'
|
||||
end
|
||||
Reference in New Issue
Block a user