summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/helpers/versions_helper.rb6
-rw-r--r--test/helpers/version_helper_test.rb10
2 files changed, 12 insertions, 4 deletions
diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb
index 219ced3d3..36b1b511d 100644
--- a/app/helpers/versions_helper.rb
+++ b/app/helpers/versions_helper.rb
@@ -31,11 +31,11 @@ module VersionsHelper
options = {:fixed_version_id => version, :set_filter => 1}.merge(options)
project =
case version.sharing
- when 'hierarchy', 'tree'
- if version.project && version.project.root.visible?
+ when 'tree'
+ if version.project && version.project.root.visible? && User.current.allowed_to?(:view_issues, version.project.root)
version.project.root
else
- version.project
+ nil
end
when 'system'
nil
diff --git a/test/helpers/version_helper_test.rb b/test/helpers/version_helper_test.rb
index a0a16d341..0eb895e47 100644
--- a/test/helpers/version_helper_test.rb
+++ b/test/helpers/version_helper_test.rb
@@ -42,7 +42,7 @@ class VersionsHelperTest < Redmine::HelperTest
def test_version_filtered_issues_path_sharing_hierarchy
version = Version.new(:name => 'test', :sharing => 'hierarchy')
version.project = Project.find(5)
- assert_match '/projects/ecookbook/issues?', version_filtered_issues_path(version)
+ assert_match '/projects/private-child/issues?', version_filtered_issues_path(version)
end
def test_version_filtered_issues_path_sharing_tree
@@ -51,6 +51,14 @@ class VersionsHelperTest < Redmine::HelperTest
assert_match '/projects/ecookbook/issues?', version_filtered_issues_path(version)
end
+ def test_version_filtered_issues_path_sharing_tree_without_permission_to_root_project
+ EnabledModule.where("name = 'issue_tracking' AND project_id = 1").delete_all
+ version = Version.new(:name => 'test', :sharing => 'tree')
+ version.project = Project.find(5)
+ assert_no_match '/projects/ecookbook/issues?', version_filtered_issues_path(version)
+ assert_match '/issues?', version_filtered_issues_path(version)
+ end
+
def test_version_filtered_issues_path_sharing_system
version = Version.new(:name => 'test', :sharing => 'system')
version.project = Project.find(5)