Story#105842700 - Set security

This commit is contained in:
Vladimir Krylov 2016-01-27 13:21:45 +02:00
parent 438f77a981
commit be8aa474f8
3 changed files with 21 additions and 9 deletions

View file

@ -1,8 +1,18 @@
class Registrant::ContactsController < RegistrantController
def show
@contact = Contact.find(params[:id])
@contact = contacts.find(params[:id])
authorize! :read, @contact
@contact.valid?
end
def contacts
ident_cc, ident = @current_user.registrant_ident.to_s.split '-'
begin
BusinessRegistryCache.fetch_by_ident_and_cc(ident, ident_cc).associated_contacts
rescue Soap::Arireg::NotAvailableError => error
flash[:notice] = I18n.t(error.json[:message])
Rails.logger.fatal("[EXCEPTION] #{error.to_s}")
Contact.none
end
end
end