Commit 6446d98e894815b0483aa0988706ad73e617901e

Authored by Antonio Terceiro
1 parent 937b283e

ActionItem956: displaying profiles to admins

app/models/profile.rb
... ... @@ -470,7 +470,7 @@ class Profile < ActiveRecord::Base
470 470 false
471 471 else
472 472 # other possibilities would come here
473   - (user == self) || (user.memberships.include?(self))
  473 + (user == self) || (user.is_admin?(self.environment)) || (user.memberships.include?(self))
474 474 end
475 475 end
476 476 end
... ...
test/unit/profile_test.rb
... ... @@ -525,6 +525,13 @@ class ProfileTest < Test::Unit::TestCase
525 525 assert c.display_info_to?(p)
526 526 end
527 527  
  528 + should 'display profile for administrators' do
  529 + p = create_user('testuser').person
  530 + p.update_attribute('public_profile', false)
  531 + admin = Person[create_admin_user(p.environment)]
  532 + assert p.display_info_to?(admin)
  533 + end
  534 +
528 535 should 'be able to add extra data for index' do
529 536 klass = Class.new(Profile)
530 537 klass.any_instance.expects(:random_method)
... ...