Do not return address in REPP API unless turned on in admin

#251
This commit is contained in:
Artur Beljajev 2016-12-02 18:40:47 +02:00
parent 92b81f98fe
commit 1e3dc63401
2 changed files with 14 additions and 5 deletions

View file

@ -16,6 +16,13 @@ module Repp
if params[:details] == 'true'
contacts = current_user.registrar.contacts.limit(limit).offset(offset)
unless Contact.address_processing
attributes = Contact.attribute_names - Contact.address_attribute_names
contacts = contacts.select(attributes)
end
contacts
else
contacts = current_user.registrar.contacts.limit(limit).offset(offset).pluck(:code)
end