Merged r3935 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@3985 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-08-19 04:33:11 +00:00
parent 5345a2dd89
commit ab5ce45b43
2 changed files with 12 additions and 4 deletions

View File

@ -53,10 +53,8 @@ class UsersController < ApplicationController
@user = User.find(params[:id])
@custom_values = @user.custom_values
# show only public projects and private projects that the logged in user is also a member of
@memberships = @user.memberships.select do |membership|
membership.project.is_public? || (User.current.member_of?(membership.project))
end
# show projects based on current user visibility
@memberships = @user.memberships.all(:conditions => Project.visible_by(User.current))
events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10)
@events_by_day = events.group_by(&:event_date)

View File

@ -96,6 +96,16 @@ class UsersControllerTest < ActionController::TestCase
assert_response 200
assert_not_nil assigns(:user)
end
def test_show_displays_memberships_based_on_project_visibility
@request.session[:user_id] = 1
get :show, :id => 2
assert_response :success
memberships = assigns(:memberships)
assert_not_nil memberships
project_ids = memberships.map(&:project_id)
assert project_ids.include?(2) #private project admin can see
end
def test_edit
ActionMailer::Base.deliveries.clear