Class: SwitchUser::BaseGuard

Inherits:
Object
  • Object
show all
Defined in:
lib/switch_user/base_guard.rb

Direct Known Subclasses

LambdaGuard

Instance Method Summary collapse

Constructor Details

#initialize(controller, provider) ⇒ BaseGuard

TODO: is this the best arguments for the initializer ? TODO should @provider be set and current/original_user be added as # accessors ?



7
8
9
10
11
12
# File 'lib/switch_user/base_guard.rb', line 7

def initialize(controller, provider)
  @controller = controller
  @request = controller.request
  @current_user = provider.current_user
  @original_user = provider.original_user
end

Instance Method Details

#controller_available?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/switch_user/base_guard.rb', line 14

def controller_available?
  raise NotImplementedError, 'you must implement controller_available?'
end

#view_available?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/switch_user/base_guard.rb', line 18

def view_available?
  controller_available?
end