Module: MinimalistAuthentication::User::ClassMethods

Defined in:
lib/minimalist_authentication/user.rb

Instance Method Summary collapse

Instance Method Details

#find_enabled(id) ⇒ Object

Finds a user by their id and returns the user if they are enabled. Returns nil if the user is not found or not enabled.



40
41
42
# File 'lib/minimalist_authentication/user.rb', line 40

def find_enabled(id)
  find_by(id:)&.enabled if id.present?
end

#guestObject

Returns a frozen user with the email set to GUEST_USER_EMAIL.



52
53
54
# File 'lib/minimalist_authentication/user.rb', line 52

def guest
  new(email: GUEST_USER_EMAIL).freeze
end

#inactiveObject



44
45
46
47
48
49
# File 'lib/minimalist_authentication/user.rb', line 44

def inactive
  MinimalistAuthentication.deprecator.warn(<<-MSG.squish)
    Calling #inactive is deprecated. Use #active(false) instead.
  MSG
  active(false)
end