Merge lp:~jcsackett/launchpad/registry-setting-account-status into lp:launchpad

Proposed by j.c.sackett
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 12579
Proposed branch: lp:~jcsackett/launchpad/registry-setting-account-status
Merge into: lp:launchpad
Diff against target: 58 lines (+10/-3)
3 files modified
lib/canonical/launchpad/browser/launchpad.py (+1/-1)
lib/lp/app/browser/tests/test_launchpad.py (+8/-1)
lib/lp/registry/browser/tests/person-admin-views.txt (+1/-1)
To merge this branch: bzr merge lp:~jcsackett/launchpad/registry-setting-account-status
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+52626@code.launchpad.net

Commit message

[r=lifeless][bug=730011] Changes permissions on suspended accounts to launchpad.Moderate, so LOSAs aren't needed to unsuspend an account.

Description of the change

Summary
=======

Registry admins can suspend accounts, but are unable to view accounts that are suspended. This means that they are unable to address the needs of users who have legitimate reason/need to reactivate an account without contacting the LOSAs.

This branch gives people with "launchpad.Moderate" privs the ability to unsuspend an account.

Implementation
==============

The check for "launchpad.Admin" when traversing on a suspended user is changed to "launchpad.Moderate"

Tests
=====

bin/test -t test_suspended_person_visibility

Demo & QA
=========

Attempt to open a suspended person's page while not logged in; you should get the usual error.

Attempt to open the same page logged in as a member of registry experts; you should see the page.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/browser/launchpad.py'
2--- lib/canonical/launchpad/browser/launchpad.py 2011-02-10 19:34:32 +0000
3+++ lib/canonical/launchpad/browser/launchpad.py 2011-03-10 21:19:00 +0000
4@@ -639,7 +639,7 @@
5 raise NotFound(self.context, name)
6 # Only admins are permitted to see suspended users.
7 if person.account_status == AccountStatus.SUSPENDED:
8- if not check_permission('launchpad.Admin', person):
9+ if not check_permission('launchpad.Moderate', person):
10 raise GoneError(
11 'User is suspended: %s' % name)
12 return person
13
14=== modified file 'lib/lp/app/browser/tests/test_launchpad.py'
15--- lib/lp/app/browser/tests/test_launchpad.py 2010-12-16 17:31:55 +0000
16+++ lib/lp/app/browser/tests/test_launchpad.py 2011-03-10 21:19:00 +0000
17@@ -313,6 +313,10 @@
18 super(TestPersonTraversal, self).setUp()
19 self.any_user = self.factory.makePerson()
20 self.admin = getUtility(IPersonSet).getByName('name16')
21+ self.registry_expert = self.factory.makePerson()
22+ registry = getUtility(ILaunchpadCelebrities).registry_experts
23+ with person_logged_in(registry.teamowner):
24+ registry.addMember(self.registry_expert, registry.teamowner)
25
26 def test_person(self):
27 # Verify a user is returned.
28@@ -322,7 +326,7 @@
29 traversed = self.traverse(segment, segment)
30 self.assertEqual(person, traversed)
31
32- def test_suspended_person_visible_to_admin_only(self):
33+ def test_suspended_person_visibility(self):
34 # Verify a suspended user is only traversable by an admin.
35 name = 'suspended-person'
36 person = self.factory.makePerson(name=name)
37@@ -332,6 +336,9 @@
38 # Admins can see the suspended user.
39 traversed = self.traverse(segment, segment)
40 self.assertEqual(person, traversed)
41+ # Registry experts can see the suspended user.
42+ login_person(self.registry_expert)
43+ traversed = self.traverse(segment, segment)
44 # Regular users cannot see the suspended user.
45 login_person(self.any_user)
46 self.assertRaises(GoneError, self.traverse, segment, segment)
47
48=== modified file 'lib/lp/registry/browser/tests/person-admin-views.txt'
49--- lib/lp/registry/browser/tests/person-admin-views.txt 2010-10-18 22:24:59 +0000
50+++ lib/lp/registry/browser/tests/person-admin-views.txt 2011-03-10 21:19:00 +0000
51@@ -142,7 +142,7 @@
52 >>> print user.preferredemail
53 None
54
55-An admin can reactive a disabled user's account too. Unlike the act of
56+An admin can reactivate a disabled user's account too. Unlike the act of
57 suspension, reactivation does not change the user's password or email
58 addresses; the user must use the reset password feature to restore these.
59