From 2933921d048082f6b116546eeeec480f82f37333 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Mon, 14 Sep 2020 17:18:16 -0500 Subject: [PATCH] Fixed issue with group_serializer current_user exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed: - issue with group_serializer current_user exists --- app/serializers/rest/group_serializer.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/serializers/rest/group_serializer.rb b/app/serializers/rest/group_serializer.rb index 0993ec88..f56596d0 100644 --- a/app/serializers/rest/group_serializer.rb +++ b/app/serializers/rest/group_serializer.rb @@ -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