summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-11 13:08:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-11 13:08:52 +0000
commitbdd3ccf8e52c69d2b6e16e7230a1b8f9a6c69e60 (patch)
tree1571b147765d42bccab602cdd9a79499829de612 /test/functional
parent140ca9532c1c12b7ff710c076c6985dce18500e4 (diff)
downloadredmine-bdd3ccf8e52c69d2b6e16e7230a1b8f9a6c69e60.tar.gz
redmine-bdd3ccf8e52c69d2b6e16e7230a1b8f9a6c69e60.zip
Adds a role setting for controlling visibility of users: all or members of visible projects (#11724).
git-svn-id: http://svn.redmine.org/redmine/trunk@13584 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/users_controller_test.rb15
-rw-r--r--test/functional/watchers_controller_test.rb15
2 files changed, 24 insertions, 6 deletions
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 78b6689fc..d9a46bd60 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -106,12 +106,6 @@ class UsersControllerTest < ActionController::TestCase
assert_response 404
end
- def test_show_should_not_reveal_users_with_no_visible_activity_or_project
- @request.session[:user_id] = nil
- get :show, :id => 9
- assert_response 404
- end
-
def test_show_inactive_by_admin
@request.session[:user_id] = 1
get :show, :id => 5
@@ -119,6 +113,15 @@ class UsersControllerTest < ActionController::TestCase
assert_not_nil assigns(:user)
end
+ def test_show_user_who_is_not_visible_should_return_404
+ Role.anonymous.update! :users_visibility => 'members_of_visible_projects'
+ user = User.generate!
+
+ @request.session[:user_id] = nil
+ get :show, :id => user.id
+ assert_response 404
+ end
+
def test_show_displays_memberships_based_on_project_visibility
@request.session[:user_id] = 1
get :show, :id => 2
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb
index dc72a9b6b..628ad0550 100644
--- a/test/functional/watchers_controller_test.rb
+++ b/test/functional/watchers_controller_test.rb
@@ -227,6 +227,21 @@ class WatchersControllerTest < ActionController::TestCase
assert Issue.find(2).watched_by?(user)
end
+ def test_autocomplete_for_user_should_return_visible_users
+ Role.update_all :users_visibility => 'members_of_visible_projects'
+
+ hidden = User.generate!(:lastname => 'autocomplete')
+ visible = User.generate!(:lastname => 'autocomplete')
+ User.add_to_project(visible, Project.find(1))
+
+ @request.session[:user_id] = 2
+ xhr :get, :autocomplete_for_user, :q => 'autocomp', :project_id => 'ecookbook'
+ assert_response :success
+
+ assert_include visible, assigns(:users)
+ assert_not_include hidden, assigns(:users)
+ end
+
def test_append
@request.session[:user_id] = 2
assert_no_difference 'Watcher.count' do