Sha256: 7a10d6703849681af7a8f134d28ae180dd80096c94610da86ecad555f99d3e13

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

# frozen_string_literal: true

module SwitchUser
  class BaseGuard
    # TODO: is this the best arguments for the initializer ?
    # TODO should @provider be set and current/original_user be added as # accessors ?
    def initialize(controller, provider)
      @controller    = controller
      @request       = controller.request
      @current_user  = provider.current_user
      @original_user = provider.original_user
    end

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

    def view_available?
      controller_available?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
switch_user-1.5.2 lib/switch_user/base_guard.rb
switch_user-1.5.1 lib/switch_user/base_guard.rb