Do not show contact if given domain does not belong to the current user

This commit is contained in:
Artur Beljajev 2018-08-16 14:49:12 +03:00
parent 5a466206bf
commit c89cce6287
7 changed files with 39 additions and 7 deletions

View file

@ -29,6 +29,17 @@ class Registrant::ContactsController < RegistrantController
end
def domain
Domain.find(params[:domain_id])
current_user_domains.find(params[:domain_id])
end
end
def current_user_domains
ident_cc, ident = @current_user.registrant_ident.split '-'
begin
BusinessRegistryCache.fetch_associated_domains ident, ident_cc
rescue Soap::Arireg::NotAvailableError => error
flash[:notice] = I18n.t(error.json[:message])
Rails.logger.fatal("[EXCEPTION] #{error.to_s}")
current_user.domains
end
end
end