From 6446d98e894815b0483aa0988706ad73e617901e Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Mon, 9 Mar 2009 16:43:25 -0300 Subject: [PATCH] ActionItem956: displaying profiles to admins --- app/models/profile.rb | 2 +- test/unit/profile_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/profile.rb b/app/models/profile.rb index ff5f2e8..6fb9fc6 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -470,7 +470,7 @@ class Profile < ActiveRecord::Base false else # other possibilities would come here - (user == self) || (user.memberships.include?(self)) + (user == self) || (user.is_admin?(self.environment)) || (user.memberships.include?(self)) end end end diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 5250f90..051b590 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -525,6 +525,13 @@ class ProfileTest < Test::Unit::TestCase assert c.display_info_to?(p) end + should 'display profile for administrators' do + p = create_user('testuser').person + p.update_attribute('public_profile', false) + admin = Person[create_admin_user(p.environment)] + assert p.display_info_to?(admin) + end + should 'be able to add extra data for index' do klass = Class.new(Profile) klass.any_instance.expects(:random_method) -- libgit2 0.21.2