about summary refs log tree commit diff
path: root/app/policies/backup_policy.rb
blob: 0ef89a8d0c8fb9280f8eb14498399853f26d1293 (plain) (blame)
1
2
3
4
5
6
7
8
9
# frozen_string_literal: true

class BackupPolicy < ApplicationPolicy
  MIN_AGE = 1.week

  def create?
    user_signed_in? && current_user.backups.where('created_at >= ?', MIN_AGE.ago).count.zero?
  end
end