forked from binzh/redmine_rubycas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.rb
43 lines (37 loc) · 1.58 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
require 'redmine_rubycas'
require 'account_controller_patch'
require 'setting_model_patch'
Redmine::Plugin.register :redmine_rubycas do
name 'Redmine CAS Plugin'
author 'Brandon Aaron, BinZH'
description 'This is a plugin for Redmine that integrates the RubyCAS client. Forked from brandonaaron/redmine_rubycas. Works on rails4.'
version '0.0.7'
url 'https://github.com/binzh/redmine_rubycas.git'
requires_redmine :version_or_higher => '2.2.2'
menu(:account_menu, :login_without_cas, { :controller => "account", :action => "login_without_cas" },
:caption => :login_without_cas, :after => :login,
:if => Proc.new { RedmineRubyCas.enabled? && RedmineRubyCas.setting("maintain_standard_login") == "true" && !User.current.logged? })
settings(:partial => 'settings/redmine_rubycas_settings', :default => {
# plugin settings
:enabled => false,
:maintain_standard_login => true,
:auto_create_users => false,
:auto_update_users => false,
:auto_user_attributes_map => 'firstname=firstName&lastname=lastName&mail=mail',
:logout_of_cas_on_logout => true,
# cas client config settings
:base_url => "https://cas.yourcasserver.com",
:login_url => nil,
:logout_url => nil,
:validate_url => nil,
:username_session_key => 'cas_user',
:extra_attributes_session_key => 'cas_extra_attributes'
})
end
ActionDispatch::Callbacks.to_prepare do
require_dependency 'account_controller'
require_dependency 'setting'
AccountController.send(:include, AccountControllerPatch)
Setting.send(:include, SettingModelPatch)
RedmineRubyCas.configure!
end