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