FIX: rate limit user posts export

This commit is contained in:
Arpit Jalan
2014-12-30 18:07:05 +05:30
parent f7955406cc
commit 78537aad39
6 changed files with 28 additions and 8 deletions

View File

@ -249,8 +249,10 @@ class Guardian
@can_see_emails
end
def can_export_admin_entity?(user)
user.staff?
def can_export_entity?(entity_type)
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
end
private