suggested changes that includes:

moving actions for custom domain in its own controller
use separate service class for custom domains
updated help text for custom domains
increased test coverage for custom domains
This commit is contained in:
shlok007 2017-08-19 13:57:09 +05:30
parent d2b5ec1770
commit bc17f210a6
14 changed files with 208 additions and 73 deletions

View file

@ -110,7 +110,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, :custom_domin], Conference, id: conf_ids
can [:read, :update, :destroy], 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,28 +92,6 @@ 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