require 'redmine'
require 'dispatcher'
require 'http_auth_patch'
 
Redmine::Plugin.register :http_auth do
  name 'HTTP Authentication plugin'
  author 'Adam Lantos'
  url 'http://github.com/AdamLantos/redmine_http_auth' if respond_to?(:url)
  description 'A plugin for doing HTTP authentication'
  version '0.3.0-dev'
  menu :account_menu, :login_httpauth, { :controller => 'httpauth-login' }, :before => :login, :caption => :login_httpauth_title

  settings :partial => 'settings/http_auth_settings',
    :default => {
      'enable' => 'true',
      'server_env_var' => 'REMOTE_USER',
      'lookup_mode' => 'login'
    }
end

Dispatcher.to_prepare do
  #include our code
  ApplicationController.send(:include, HTTPAuthPatch)
end


require 'redmine'
require 'dispatcher'
require 'http_auth_patch'
 
Redmine::Plugin.register :http_auth do
  name 'HTTP Authentication plugin'
  author 'Adam Lantos'
  url 'http://github.com/AdamLantos/redmine_http_auth' if respond_to?(:url)
  description 'A plugin for doing HTTP authentication'
  version '0.3.0-dev'
  menu :account_menu, :login_httpauth, { :controller => 'httpauth-login' }, 
    :before => :login, :caption => :login_httpauth_title,
    :if => Proc.new { User.current.anonymous? && Setting.plugin_http_auth['enable'] == 'true' }

  settings :partial => 'settings/http_auth_settings',
    :default => {
      'enable' => 'true',
      'server_env_var' => 'REMOTE_USER',
      'lookup_mode' => 'login'
    }
end

Dispatcher.to_prepare do
  #include our code
  ApplicationController.send(:include, HTTPAuthPatch)
end


Hide login link from the menu if user is logged in or the plugin is disabled.
Hide login link from the menu if user is logged in or the plugin is disabled.
