This repository has been archived by the owner on May 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinit.rb
executable file
·67 lines (57 loc) · 2.27 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
# frozen_string_literal: true
ActiveSupport::Reloader.to_prepare do
paths = '/lib/redmine_redcaser/{patches/*_patch,hooks/*_hook}.rb'
Dir.glob(File.dirname(__FILE__) + paths).each do |file|
require_dependency file
end
end
Redmine::Plugin.register :redmine_redcaser do
name 'Redmine Redcaser'
description 'Test cases management plugin for Redmine'
author 'Zitec'
version '0.0.1'
requires_redmine version_or_higher: '3.0.0'
settings partial: 'redmine_redcaser/plugin_settings'
permission :view_test_cases, {
redcaser: [:index, :attachment_urls],
'redcaser/environments' => [:show],
'redcaser/testsuites' => [:index],
'redcaser/testcases' => [:show],
'redcaser/executionjournals' => [:index],
'redcaser/executionsuites' => [:index, :show],
}
permission :edit_test_cases, {
redcaser: [:index, :attachment_urls],
'redcaser/environments' => [:index, :show, :new, :edit, :update, :destroy, :create],
'redcaser/testsuites' => [:index, :new, :edit, :update, :destroy, :create],
'redcaser/testcases' => [:show, :update, :destroy],
'redcaser/testcasestatuses' => [:create, :update],
'redcaser/querytestcases' => [:show],
'redcaser/executionjournals' => [:index],
'redcaser/executionsuites' => [:index, :new, :edit, :update, :destroy, :create, :show],
}
permission :execute_test_cases, {
redcaser: [:index, :attachment_urls],
'redcaser/environments' => [:show],
'redcaser/testsuites' => [:index],
'redcaser/testcases' => [:index, :show, :update],
'redcaser/executionjournals' => [:index],
'redcaser/executionsuites' => [:index]
}
menu :project_menu,
:redcaser,
{
controller: 'redcaser',
action: 'index'
},
{
if: proc { |project|
can_view = User.current.allowed_to?(:view_test_cases, project)
can_edit = User.current.allowed_to?(:edit_test_cases, project)
tracker_exists = project.trackers.where(id: RedcaserSettings.tracker_id).exists?
(can_view || can_edit) && tracker_exists
},
caption: proc { RedcaserSettings.tracker_name.pluralize },
after: :new_issue
}
end