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