Sha256: bd107b5cbe6c3b69eb7b235e96260f21149a3ef9e4d892971db91cbd13d08b0e

Contents?: true

Size: 724 Bytes

Versions: 4

Compression:

Stored size: 724 Bytes

Contents

# -*- coding: utf-8 -*-
require 'dynflow'

module ForemanTasks
  # Class for configuring and preparing the Dynflow runtime environment.
  class Dynflow < ::Dynflow::Rails
    require 'foreman_tasks/dynflow/console_authorizer'

    def web_console
      ::Dynflow::Web.setup do
        before do
          if !Setting[:dynflow_enable_console] ||
             (Setting[:dynflow_console_require_auth] && !ConsoleAuthorizer.new(env).allow?)
            halt 403, 'Access forbidden'
          end
        end

        set(:custom_navigation) do
          { _('Back to tasks') => "/#{ForemanTasks::TasksController.controller_path}" }
        end
        set(:world) { Rails.application.dynflow.world }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman-tasks-0.10.4 lib/foreman_tasks/dynflow.rb
foreman-tasks-0.10.3 lib/foreman_tasks/dynflow.rb
foreman-tasks-0.10.2 lib/foreman_tasks/dynflow.rb
foreman-tasks-0.10.1 lib/foreman_tasks/dynflow.rb