Merge a09b04a865 into cf29150a2a
This commit is contained in:
commit
b946b9f261
2 changed files with 16 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
return
|
||||
# ichain does not allow us to create users during registration
|
||||
elsif (ENV['OSEM_ICHAIN_ENABLED'] == 'true') && !current_user
|
||||
redirect_to root_path, alert: 'You need to sign in or sign up before continuing.'
|
||||
redirect_to new_user_ichain_session_path, alert: 'You need to sign in or sign up before continuing.'
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -45,14 +45,20 @@ class Ability
|
|||
# can view Commercials of confirmed Events
|
||||
can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id)
|
||||
can [:show, :create], User
|
||||
unless ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||
if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||
can [:new, :create], Registration do |registration|
|
||||
conference = registration.conference
|
||||
can_register?(conference, registration)
|
||||
end
|
||||
|
||||
else
|
||||
can :show, Registration do |registration|
|
||||
registration.new_record?
|
||||
end
|
||||
|
||||
can [:new, :create], Registration do |registration|
|
||||
conference = registration.conference
|
||||
conference.registration_open? && registration.new_record? && !conference.registration_limit_exceeded?
|
||||
can_register?(conference, registration)
|
||||
end
|
||||
|
||||
can :show, Event do |event|
|
||||
|
|
@ -62,6 +68,7 @@ class Ability
|
|||
can [:new, :create], Event do |event|
|
||||
event.program.cfp_open? && event.new_record?
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -262,3 +269,9 @@ class Ability
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def can_register? conference, registration
|
||||
conference.registration_open? &&
|
||||
registration.new_record? &&
|
||||
!conference.registration_limit_exceeded?
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue