forked from KingBain/redmine_http_auth
-
Notifications
You must be signed in to change notification settings - Fork 15
/
init.rb
50 lines (47 loc) · 1.69 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Redmine::Plugin.register :redmine_env_auth do
name "Request Environment Authentication"
author "Intera GmbH"
url "http://github.com/intera/redmine_env_auth" if respond_to?(:url)
description "A plugin for authentication based on variables in the request environment."
version "1.3"
Redmine::MenuManager.map :account_menu do |menu|
# hide the logout link if an automatic login is active
menu.delete :logout
menu.push :logout, {:controller => 'env_auth', :action => 'logout'}, :caption => :label_logout, :if => Proc.new {
if !User.current.logged?
false
elsif Setting.plugin_redmine_env_auth["enabled"] != "true"
true
elsif Setting.plugin_redmine_env_auth["show_logout_link"] == "true"
true
else
false
end
}, :after => :my_account
end
settings :partial => "settings/redmine_env_auth_settings",
:default => {
"allow_other_login" => "admins",
"allow_other_login_users" => "",
"enabled" => "false",
"env_variable_name" => "REMOTE_USER",
"ldap_checked_auto_registration" => "false",
"redmine_user_property" => "login",
"remove_suffix" => "",
"env_checked_auto_registration" => "false",
"env_variable_firstname" => "GIVENNAME",
"env_variable_lastname" => "LASTNAME",
"env_variable_email" => "EMAIL",
"env_variable_admins" => "",
"env_variable_new_user_initial_locked" => "false",
"show_logout_link" => "false",
"external_logout_target" => ""
}
end
if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled?
RedmineEnvAuth::EnvAuthPatch.install
else
Rails.configuration.to_prepare do
RedmineEnvAuth::EnvAuthPatch.install
end
end