mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 18:59:38 +02:00
Story#105842700 - registrant cannot see other contact domains (legacy from FRED)
This commit is contained in:
parent
1bf7315a91
commit
51a0449799
3 changed files with 16 additions and 6 deletions
|
@ -1,19 +1,26 @@
|
|||
class Registrant::ContactsController < RegistrantController
|
||||
|
||||
helper_method :domain_ids
|
||||
def show
|
||||
@contact = Contact.where(id: contacts).find_by(id: params[:id])
|
||||
@contact = Contact.where(id: contacts).find_by(id: params[:id])
|
||||
@current_user = current_user
|
||||
|
||||
authorize! :read, @contact
|
||||
end
|
||||
|
||||
def contacts
|
||||
ident_cc, ident = @current_user.registrant_ident.to_s.split '-'
|
||||
begin
|
||||
DomainContact.where(domain_id: BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_domain_ids).pluck(:contact_id)
|
||||
DomainContact.where(domain_id: domain_ids).pluck(:contact_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
|
Loading…
Add table
Add a link
Reference in a new issue