Fix authorization of new and create in ConferenceRegistrationsController

Before authorization we need to set conference relation.
Change in proposal spec cause conference has to have valid registration
period for successful redirect to registration after confirm proposal.
This commit is contained in:
Aditya Prakash 2016-03-17 14:54:35 +05:30
parent 10ef898a0d
commit eae6d90e9f
4 changed files with 27 additions and 5 deletions

View file

@ -46,9 +46,14 @@ class Ability
can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id)
can :show, User
unless CONFIG['authentication']['ichain']['enabled']
can [:show, :create], Registration do |registration|
can :show, Registration do |registration|
registration.new_record?
end
can [:new, :create], Registration do |registration|
registration.conference.registration_open? && registration.new_record?
end
can :show, Event do |event|
event.new_record?
end
@ -68,6 +73,10 @@ class Ability
can :manage, Registration, user_id: user.id
can [:new, :create], Registration do |registration|
registration.conference.registration_open?
end
can :index, Ticket
can :manage, TicketPurchase, user_id: user.id