Fixed issue with group fetching, serializer for loading password

• Fixed:
- issue with group fetching, serializer for loading password for admin only
This commit is contained in:
mgabdev 2020-09-17 18:21:58 -05:00
parent 7c952a1e06
commit 8f57514bc8
2 changed files with 7 additions and 3 deletions

@ -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

@ -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