diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index dc8ce2112..ef1c33ba3 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -163,7 +163,7 @@ def create @client.send_welcome_email(responsible_id: current_user.uid) options = {} options[:is_collection] = false - options[:params] = { current_ability: current_ability } + options[:params] = { current_ability: current_ability, detail: true } render json: ClientSerializer.new(@client, options).serialized_json, status: :created @@ -177,7 +177,7 @@ def create def update options = {} options[:is_collection] = false - options[:params] = { current_ability: current_ability } + options[:params] = { current_ability: current_ability, detail: true } if params.dig(:data, :attributes, :mode) == "transfer" # only update provider_id diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index c3d1078b4..284e67091 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -121,7 +121,7 @@ def create options = {} options[:include] = @include options[:is_collection] = false - options[:params] = { current_ability: current_ability } + options[:params] = { current_ability: current_ability, detail: true } render json: ContactSerializer.new(@contact, options).serialized_json, status: :created @@ -137,7 +137,7 @@ def update options = {} options[:include] = @include options[:is_collection] = false - options[:params] = { current_ability: current_ability } + options[:params] = { current_ability: current_ability, detail: true } render json: ContactSerializer.new(@contact, options).serialized_json, status: :ok diff --git a/app/controllers/providers_controller.rb b/app/controllers/providers_controller.rb index 73bfe0b9b..246f42c5f 100644 --- a/app/controllers/providers_controller.rb +++ b/app/controllers/providers_controller.rb @@ -256,7 +256,7 @@ def create options = {} options[:include] = @include options[:is_collection] = false - options[:params] = { current_ability: current_ability } + options[:params] = { current_ability: current_ability, detail: true } render json: ProviderSerializer.new(@provider, options).serialized_json, status: :ok @@ -272,7 +272,7 @@ def update options = {} options[:include] = @include options[:is_collection] = false - options[:params] = { current_ability: current_ability } + options[:params] = { current_ability: current_ability, detail: true } render json: ProviderSerializer.new(@provider, options).serialized_json, status: :ok diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 95d02e8a3..7a29f5aa4 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -205,7 +205,7 @@ def create @client.send_welcome_email(responsible_id: current_user.uid) options = {} options[:is_collection] = false - options[:params] = { current_ability: current_ability } + options[:params] = { current_ability: current_ability, detail: true } render json: RepositorySerializer.new(@client, options).serialized_json, status: :created @@ -219,7 +219,7 @@ def create def update options = {} options[:is_collection] = false - options[:params] = { current_ability: current_ability } + options[:params] = { current_ability: current_ability, detail: true } if params.dig(:data, :attributes, :mode) == "transfer" # only update provider_id diff --git a/app/serializers/contact_serializer.rb b/app/serializers/contact_serializer.rb index 39e8eaf57..2fd1f13f9 100644 --- a/app/serializers/contact_serializer.rb +++ b/app/serializers/contact_serializer.rb @@ -29,7 +29,7 @@ class ContactSerializer attribute :from_salesforce, if: Proc.new { |object, params| - params[:current_ability] && + params[:detail] && params[:current_ability] && params[:current_ability].can?(:read_salesforce_id, object) == true }, diff --git a/app/serializers/provider_serializer.rb b/app/serializers/provider_serializer.rb index e6dc6a1f3..4c7391c64 100644 --- a/app/serializers/provider_serializer.rb +++ b/app/serializers/provider_serializer.rb @@ -297,7 +297,7 @@ class ProviderSerializer attribute :from_salesforce, if: Proc.new { |object, params| - params[:current_ability] && + params[:detail] && params[:current_ability] && params[:current_ability].can?(:read_salesforce_id, object) == true }, diff --git a/app/serializers/repository_serializer.rb b/app/serializers/repository_serializer.rb index 2f4679642..eacaff13e 100644 --- a/app/serializers/repository_serializer.rb +++ b/app/serializers/repository_serializer.rb @@ -114,7 +114,7 @@ class RepositorySerializer attribute :from_salesforce, if: Proc.new { |object, params| - params[:current_ability] && + params[:detail] && params[:current_ability] && params[:current_ability].can?(:read_salesforce_id, object) == true },