Skip to content

Commit

Permalink
Filter sensitive user data out of user list response
Browse files Browse the repository at this point in the history
  • Loading branch information
xjunior committed Dec 19, 2024
1 parent b5a7f72 commit 82b2039
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion audiences/app/controllers/audiences/contexts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def users
limit: params[:limit],
offset: params[:offset])

render json: search
render json: search, only: %w[id externalId displayName photos]
end

private
Expand Down
2 changes: 1 addition & 1 deletion audiences/app/models/audiences/external_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def self.wrap(resources)
end

def as_json(*)
data.as_json
data.as_json(*)
end
end
end
2 changes: 1 addition & 1 deletion audiences/app/models/audiences/users_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(query:, limit: nil, offset: 0, scope: ExternalUser)

def as_json(*)
{
users: users,
users: users.as_json(*),
count: count,
}
end
Expand Down
2 changes: 1 addition & 1 deletion audiences/spec/controllers/contexts_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
criterion.users.create!([
{ user_id: 1, data: { "externalId" => 1, "displayName" => "John" } },
{ user_id: 2, data: { "externalId" => 2, "displayName" => "Jose" } },
{ user_id: 3, data: { "externalId" => 3, "displayName" => "Nelson" } },
{ user_id: 3, data: { "externalId" => 3, "displayName" => "Nelson", "confidential" => "data" } },
])

get :users, params: { key: example_context.signed_key, criterion_id: criterion.id }
Expand Down

0 comments on commit 82b2039

Please sign in to comment.