From bdd3ccf8e52c69d2b6e16e7230a1b8f9a6c69e60 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 11 Nov 2014 13:08:52 +0000 Subject: 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 --- test/functional/users_controller_test.rb | 15 +++++++++------ test/functional/watchers_controller_test.rb | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'test/functional') 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 -- cgit v1.2.3