Fixed issue with group_serializer current_user exists

• Fixed:
- issue with group_serializer current_user exists
This commit is contained in:
mgabdev 2020-09-14 17:18:16 -05:00
parent 1955ee6602
commit 2933921d04
1 changed files with 5 additions and 1 deletions

View File

@ -16,7 +16,11 @@ class REST::GroupSerializer < ActiveModel::Serializer
end end
def password def password
if defined?(current_user) && object.group_accounts.where(account_id: current_user.account.id, role: :admin).exists? if !defined?(current_user) || current_user.nil?
return nil
end
if object.group_accounts.where(account_id: current_user.account.id, role: :admin).exists?
object.password object.password
else else
nil nil