From 22d7ea1192b3d36534c12fce8d20f934835cfd6e Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 5 May 2016 19:12:37 +0530 Subject: [PATCH] FIX: user can't export entity unless they are logged in --- lib/guardian.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/guardian.rb b/lib/guardian.rb index 1a6c9d13750..2e68f246305 100644 --- a/lib/guardian.rb +++ b/lib/guardian.rb @@ -271,6 +271,7 @@ class Guardian end def can_export_entity?(entity_type) + return false unless @user return true if is_staff? return false if entity_type == "admin" UserExport.where(user_id: @user.id, created_at: (Time.zone.now.beginning_of_day..Time.zone.now.end_of_day)).count == 0