← Back to team overview

launchpad-reviewers team mailing list archive

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

 

j.c.sackett has proposed merging lp:~jcsackett/launchpad/registry-setting-account-status into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #730011 ~registry should be able to unsuspend accounts
  https://bugs.launchpad.net/bugs/730011

For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/registry-setting-account-status/+merge/52626

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.
-- 
https://code.launchpad.net/~jcsackett/launchpad/registry-setting-account-status/+merge/52626
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/registry-setting-account-status into lp:launchpad.
=== modified file 'lib/canonical/launchpad/browser/launchpad.py'
--- lib/canonical/launchpad/browser/launchpad.py	2011-02-10 19:34:32 +0000
+++ lib/canonical/launchpad/browser/launchpad.py	2011-03-08 23:18:08 +0000
@@ -639,7 +639,7 @@
                     raise NotFound(self.context, name)
                 # Only admins are permitted to see suspended users.
                 if person.account_status == AccountStatus.SUSPENDED:
-                    if not check_permission('launchpad.Admin', person):
+                    if not check_permission('launchpad.Moderate', person):
                         raise GoneError(
                             'User is suspended: %s' % name)
                 return person

=== modified file 'lib/lp/app/browser/tests/test_launchpad.py'
--- lib/lp/app/browser/tests/test_launchpad.py	2010-12-16 17:31:55 +0000
+++ lib/lp/app/browser/tests/test_launchpad.py	2011-03-08 23:18:08 +0000
@@ -313,6 +313,10 @@
         super(TestPersonTraversal, self).setUp()
         self.any_user = self.factory.makePerson()
         self.admin = getUtility(IPersonSet).getByName('name16')
+        self.registry_expert = self.factory.makePerson()
+        registry = getUtility(ILaunchpadCelebrities).registry_experts
+        with person_logged_in(registry.teamowner):
+            registry.addMember(self.registry_expert, registry.teamowner)
 
     def test_person(self):
         # Verify a user is returned.
@@ -322,7 +326,7 @@
         traversed = self.traverse(segment, segment)
         self.assertEqual(person, traversed)
 
-    def test_suspended_person_visible_to_admin_only(self):
+    def test_suspended_person_visibility(self):
         # Verify a suspended user is only traversable by an admin.
         name = 'suspended-person'
         person = self.factory.makePerson(name=name)
@@ -332,6 +336,9 @@
         # Admins can see the suspended user.
         traversed = self.traverse(segment, segment)
         self.assertEqual(person, traversed)
+        # Registry experts can see the suspended user.
+        login_person(self.registry_expert)
+        traversed = self.traverse(segment, segment)
         # Regular users cannot see the suspended user.
         login_person(self.any_user)
         self.assertRaises(GoneError, self.traverse, segment, segment)

=== modified file 'lib/lp/registry/browser/tests/person-admin-views.txt'
--- lib/lp/registry/browser/tests/person-admin-views.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/registry/browser/tests/person-admin-views.txt	2011-03-08 23:18:08 +0000
@@ -142,7 +142,7 @@
     >>> print user.preferredemail
     None
 
-An admin can reactive a disabled user's account too. Unlike the act of
+An admin can reactivate a disabled user's account too. Unlike the act of
 suspension, reactivation does not change the user's password or email
 addresses; the user must use the reset password feature to restore these.