Sha256: ab65c9aa68e6fee38ba333f7a6dd5c9308ededb93231a27076fb72a0e1463527

Contents?: true

Size: 751 Bytes

Versions: 32

Compression:

Stored size: 751 Bytes

Contents

class ApplicationController < ActionController::API
  def current_user
    # DETERMINATOR: This would return a User object in most applications
    # http://guides.rubyonrails.org/action_controller_overview.html#accessing-the-session
    nil
  end

  def guid
    session[:guid] ||= SecureRandom.uuid
  end

  def determinator
    # DETERMINATOR: A memoized instance of the ActorControl helper class
    # which allows simple use throughout the app
    @_determinator ||= Determinator.instance.for_actor(
      id: current_user && current_user.id || nil,
      guid: guid,
      default_properties: {
        # Clearly this would return real information about whether the
        # user is an employee.
        employee: false
      }
    )
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
determinator-2.9.3 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.9.2 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.9.1 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.9.0 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.8.0 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.7.1 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.7.0 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.6.0 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.5.4 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.5.3 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.5.2 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.5.1 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.5.0 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.4.4 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.4.3 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.4.2 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.4.0 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.3.1 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.3.0 examples/determinator-rails/app/controllers/application_controller.rb
determinator-2.2.1 examples/determinator-rails/app/controllers/application_controller.rb