mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 10:19:45 +02:00
Merge pull request #107 from internetee/105842700-registrants_portal
105842700 registrants portal
This commit is contained in:
commit
71e3db611b
18 changed files with 126 additions and 242 deletions
|
@ -1,8 +1,26 @@
|
|||
class Registrant::ContactsController < RegistrantController
|
||||
|
||||
helper_method :domain_ids
|
||||
def show
|
||||
@contact = Contact.find(params[:id])
|
||||
@contact = Contact.where(id: contacts).find_by(id: params[:id])
|
||||
@current_user = current_user
|
||||
|
||||
authorize! :read, @contact
|
||||
@contact.valid?
|
||||
end
|
||||
|
||||
def contacts
|
||||
begin
|
||||
DomainContact.where(domain_id: domain_ids).pluck(:contact_id) | Domain.where(id: domain_ids).pluck(:registrant_id)
|
||||
rescue Soap::Arireg::NotAvailableError => error
|
||||
flash[:notice] = I18n.t(error.json[:message])
|
||||
Rails.logger.fatal("[EXCEPTION] #{error.to_s}")
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def domain_ids
|
||||
@domain_ids ||= begin
|
||||
ident_cc, ident = @current_user.registrant_ident.to_s.split '-'
|
||||
BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_domain_ids
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,15 +11,28 @@ class Registrant::DomainsController < RegistrantController
|
|||
end
|
||||
|
||||
def show
|
||||
@domain = Domain.find(params[:id])
|
||||
if !(domains.include?(@domain) || @domain.valid?)
|
||||
redirect_to registrant_domains_path
|
||||
end
|
||||
@domain = domains.find(params[:id])
|
||||
authorize! :read, @domain
|
||||
end
|
||||
|
||||
def set_domain
|
||||
@domain = Domain.find(params[:id])
|
||||
@domain = domains.find(params[:id])
|
||||
end
|
||||
|
||||
def domain_verification_url
|
||||
authorize! :view, :registrant_domains
|
||||
dom = domains.find(params[:id])
|
||||
if (dom.statuses.include?(DomainStatus::PENDING_UPDATE) || dom.statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)) &&
|
||||
dom.pending_json.present?
|
||||
|
||||
@domain = dom
|
||||
confirm_path = get_confirm_path(dom.statuses)
|
||||
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
|
||||
|
||||
else
|
||||
flash[:warning] = I18n.t('available_verification_url_not_found')
|
||||
redirect_to registrant_domain_path(dom.id)
|
||||
end
|
||||
end
|
||||
|
||||
def download_list
|
||||
|
@ -61,4 +74,13 @@ class Registrant::DomainsController < RegistrantController
|
|||
yield
|
||||
params[:q][:valid_to_lteq] = ca_cache
|
||||
end
|
||||
|
||||
def get_confirm_path(statuses)
|
||||
if statuses.include?(DomainStatus::PENDING_UPDATE)
|
||||
"#{ENV['registrant_url']}/registrant/domain_update_confirms"
|
||||
elsif statuses.include?(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||
"#{ENV['registrant_url']}/registrant/domain_delete_confirms"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
class Registrant::RegistrantsController < RegistrantController
|
||||
|
||||
def show
|
||||
@contact = Registrant.find(params[:id])
|
||||
authorize! :read, @contact
|
||||
@contact.valid?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue