diff --git a/app/controllers/api/v1/groups_controller.rb b/app/controllers/api/v1/groups_controller.rb index d35b02ff..e10f0e6e 100644 --- a/app/controllers/api/v1/groups_controller.rb +++ b/app/controllers/api/v1/groups_controller.rb @@ -61,7 +61,7 @@ class Api::V1::GroupsController < Api::BaseController end def show - render json: @group, serializer: REST::GroupSerializer + render json: @group, serializer: REST::GroupSerializer, individual_group: true end def create diff --git a/app/serializers/rest/group_serializer.rb b/app/serializers/rest/group_serializer.rb index 3c00908f..4f078cfd 100644 --- a/app/serializers/rest/group_serializer.rb +++ b/app/serializers/rest/group_serializer.rb @@ -20,8 +20,12 @@ class REST::GroupSerializer < ActiveModel::Serializer return nil end - if object.group_accounts.where(account_id: current_user.account.id, role: :admin).exists? - object.password + if instance_options[:individual_group] + if object.group_accounts.where(account_id: current_user.account.id, role: :admin).exists? + object.password + else + nil + end else nil end