Sha256: 75f4ef52f6d4288ce147a7798267477ea729ee7550c7dd94c11cc0013d9d9eb0
Contents?: true
Size: 624 Bytes
Versions: 10
Compression:
Stored size: 624 Bytes
Contents
# frozen_string_literal: true require 'ditty/policies/application_policy' module Ditty class IdentityPolicy < ApplicationPolicy def login? true end def forgot_password? true end def reset_password? record.new? || (record.reset_requested && record.reset_requested > (Time.now - (24 * 60 * 60))) end def permitted_attributes %i[username password password_confirmation] end class Scope < ApplicationPolicy::Scope def resolve if user.super_admin? scope else scope.where(id: -1) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems