This commit is contained in:
Shlok Srivastava 2017-08-10 06:09:24 +00:00 • committed by GitHub
commit 304339f9fc
15 changed files with 240 additions and 7 deletions

View file

@ -109,7 +109,7 @@ class AdminAbility
track_ids = Track.joins(:program).where('programs.conference_id IN (?)', conf_ids).pluck(:id)
can :manage, Resource, conference_id: conf_ids
can [:read, :update, :destroy], Conference, id: conf_ids
can [:read, :update, :destroy, :custom_domin], Conference, id: conf_ids
can :manage, Splashpage, conference_id: conf_ids
can :manage, Contact, conference_id: conf_ids
can :manage, EmailSettings, conference_id: conf_ids

View file

@ -92,6 +92,28 @@ class Conference < ActiveRecord::Base
user.present? && registrations.where(user_id: user.id).count > 0
end
##
# Checks if domain correctly points to the hosted version
# This feature is enabled only if ENV['OSEM_HOSTNAME'] is present
#
# ====Returns
# * +true+ -> If the custom domain has a CNAME record for the hosted version
# * +false+ -> If the custom domain does not have a CNAME record for the hosted version
def check_custom_domain
require 'resolv'
unless ENV['OSEM_HOSTNAME'].nil?
cname_record = Resolv::DNS.new.getresources(custom_domain, Resolv::DNS::Resource::IN::CNAME)
if cname_record.present?
return ENV['OSEM_HOSTNAME'] == Resolv::DNS.new.getresources(custom_domain, Resolv::DNS::Resource::IN::CNAME).first.name.to_s
else
return false
end
end
'--feature disabled--'
end
##
# Delete all EventSchedules that are not in the hours range
# After the conference has been successfully updated