-
Notifications
You must be signed in to change notification settings - Fork 6
/
init.rb
41 lines (36 loc) · 1.75 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
require 'redmine'
require_relative 'lib/redmine_sudo/hooks'
Rails.autoloaders.main.ignore("#{__dir__}/lib") if Rails::VERSION::MAJOR >= 6
# Plugin generic informations
Redmine::Plugin.register :redmine_sudo do
name 'Redmine Sudo plugin'
description 'This plugin gives sudo-like powers to Redmine administrators'
author 'Jean-Baptiste BARTH'
author_url 'mailto:[email protected]'
url 'https://github.com/jbbarth/redmine_sudo'
version '5.0.0'
requires_redmine :version_or_higher => '2.5.0'
requires_redmine_plugin :redmine_base_rspec, :version_or_higher => '0.0.3' if Rails.env.test?
requires_redmine_plugin :redmine_base_deface, :version_or_higher => '0.0.1'
Redmine::MenuManager.map :account_menu do |menu|
menu.push :sudo, :sudo_toggle_path,
html: { method: 'get',
id: "sudo_id" },
caption: Proc.new {
User.current.admin? ? Setting.plugin_redmine_sudo["become_user"] : Setting.plugin_redmine_sudo["become_admin"]
},
before: :my_account,
class: "sudo",
if: Proc.new { User.current.sudoer? }
end
settings :default => {
'become_admin' => '[sudo -v]',
'become_user' => '[sudo -k]',
'additional_css' => "#top-menu { background-color:#BA0C04; }\n
#header { background-color:#dd0037; }\n
#main-menu li a { background-color:#BA0C04; }\n
#main-menu li a.new-object { background-color:#BA0C04; }\n
#main-menu li a:hover { background-color:#8D0A02; }\n
@media all and (max-width: 899px) { #header{ background-color: #dd0037 !important; }" },
:partial => 'settings/redmine_sudo_settings'
end