Class: Hello::Business::Authentication::SudoModeAuthentication

Inherits:
Base
  • Object
show all
Defined in:
lib/hello/business/authentication/sudo_mode_authentication.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#alert_message, #error_message, #errors, #success_message, #t

Constructor Details

#initialize(access) ⇒ SudoModeAuthentication

Returns a new instance of SudoModeAuthentication.



7
8
9
# File 'lib/hello/business/authentication/sudo_mode_authentication.rb', line 7

def initialize(access)
  @access = access
end

Instance Attribute Details

#accessObject (readonly)

Returns the value of attribute access.



5
6
7
# File 'lib/hello/business/authentication/sudo_mode_authentication.rb', line 5

def access
  @access
end

Instance Method Details

#authenticate!(password) ⇒ Object



11
12
13
14
15
# File 'lib/hello/business/authentication/sudo_mode_authentication.rb', line 11

def authenticate!(password)
  if access.user.password_is?(password)
    access.update!(sudo_expires_at: sudo_expires_at)
  end
end