-
Notifications
You must be signed in to change notification settings - Fork 5
/
init.rb
110 lines (88 loc) · 3.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# This file is a part of Access tickets plugin,
# access management plugin for Redmine
#
# Copyright (C) 2016 Ilya Maltsev
# email: [email protected]
#
# access_tickets is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# access_tickets is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with access_tickets. If not, see <http://www.gnu.org/licenses/>.
require 'access_tickets/hooks'
ACCESS_TICKETS_VERSION_TYPE = "2.0.1"
Redmine::Plugin.register :access_tickets do
name 'Access tickets'
author 'Maltsev Ilya'
description 'Access management plugin for Redmine'
version ACCESS_TICKETS_VERSION_TYPE
url 'https://github.com/iymaltsev/access_tickets/'
author_url 'mailto:[email protected]'
settings :partial => '/isettings/at_settings', :default => {}
Redmine::MenuManager.map :top_menu do |menu|
menu.push(:access_tickets,
{:controller => 'itickets', :action => 'show_at_project'},
{
:html => {:class => 'icon icon-roles'},
:caption => :at_access_tickets,
:if => Proc.new{ISetting.plugin_settings_ermi != 0 && ISetting.check_config()}
})
menu.push(:access_templates,
{:controller => 'iaccesses', :action => 'access_templates'},
{
:html => {:class => 'icon icon-settings'},
:caption => :at_access_templates,
:if => Proc.new{ISetting.plugin_settings_ermi != 0 && ISetting.check_config() && (ITicket.check_security_officer(User.current) || IGrouplider.is_group_lider(User.current.id))}
})
#if Setting.plugin_access_tickets[:at_erm_integration] == "1"
menu.push(:at_my_access_parent,
{:controller => 'iaccesses', :action => 'accesses_list'},
{
:parent => :access_tickets,
:caption => :at_access_list,
:if => Proc.new{ISetting.plugin_settings_ermi != 0}
})
menu.push(:at_resources_list_parent,
{:controller => 'iresources', :action => 'resources_list'},
{
:parent => :access_tickets,
:caption => :at_resources_list,
:if => Proc.new{ISetting.plugin_settings_ermi != 0}
})
#else
menu.push(:access_tickets_no_parent,
{:controller => 'itickets', :action => 'show_at_project'},
{
:html => {:class => 'icon icon-roles'},
:caption => :at_access_tickets,
:if => Proc.new{ISetting.plugin_settings_ermi != 1 && ISetting.check_config()}
})
menu.push(:access_templates_no_parent,
{:controller => 'iaccesses', :action => 'access_templates'},
{
:html => {:class => 'icon icon-settings'},
:caption => :at_access_templates,
:if => Proc.new{ISetting.plugin_settings_ermi != 1 && ISetting.check_config() && (ITicket.check_security_officer(User.current) || IGrouplider.is_group_lider(User.current.id))}
})
menu.push(:at_my_access,
{:controller => 'iaccesses', :action => 'accesses_list'},
{
:caption => :at_access_list,
:if => Proc.new{ISetting.plugin_settings_ermi != 1}
})
menu.push(:at_resources_list,
{:controller => 'iresources', :action => 'resources_list'},
{
:caption => :at_resources_list,
:if => Proc.new{ISetting.plugin_settings_ermi != 1}
})
#end
end
end