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

@ -16,7 +16,11 @@ class REST::GroupSerializer < ActiveModel::Serializer
end
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
else
nil