summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-30 09:10:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-30 09:10:06 +0000
commit78384d147a48a2d690c35f030232e232800dd919 (patch)
tree716f4a95300f4e16cdf9f2f432d0b22cd943b4db
parent9e39ad4719949ddf0b7156198e4220290a069683 (diff)
downloadredmine-78384d147a48a2d690c35f030232e232800dd919.tar.gz
redmine-78384d147a48a2d690c35f030232e232800dd919.zip
Menu should not include "New issue" for users with copy issues permission only.
git-svn-id: http://svn.redmine.org/redmine/trunk@14290 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine.rb3
-rw-r--r--test/functional/projects_controller_test.rb10
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/redmine.rb b/lib/redmine.rb
index 9b7817378..a264585ef 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -231,7 +231,8 @@ Redmine::MenuManager.map :project_menu do |menu|
menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural
menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new,
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) },
- :if => Proc.new { |p| p.trackers.any? }
+ :if => Proc.new { |p| p.trackers.any? },
+ :permission => :add_issues
menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar
menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index 70c32c5f0..2efb98ccd 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -671,4 +671,14 @@ class ProjectsControllerTest < ActionController::TestCase
get :show, :id => 1
assert_select '#main-menu a.new-issue', 0
end
+
+ def test_project_menu_should_not_include_new_issue_link_for_users_with_copy_issues_permission_only
+ role = Role.find(1)
+ role.remove_permission! :add_issues
+ role.add_permission! :copy_issues
+
+ @request.session[:user_id] = 2
+ get :show, :id => 1
+ assert_select '#main-menu a.new-issue', 0
+ end
end