Sha256: 648859a50d718204a5958cd9b0f5399418eb8f8da841dadd3538221e209c0cec

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

module RocketJobMissionControl
  class ApplicationController < ActionController::Base
    protect_from_forgery with: :exception

    around_action :with_time_zone

    private

    def with_time_zone(&block)
      if time_zone = session['time_zone'] || 'UTC'
        Time.use_zone(time_zone, &block)
      end
    end

    def current_policy
      @current_policy ||= begin
        args =
          if Config.authorization_callback
            instance_exec(&Config.authorization_callback)
          else
            {roles: %i[admin]}
          end
        AccessPolicy.new(Authorization.new(args))
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rocketjob_mission_control-4.0.0 app/controllers/rocket_job_mission_control/application_controller.rb
rocketjob_mission_control-3.2.0 app/controllers/rocket_job_mission_control/application_controller.rb