← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:adminpeoplemerge-registry into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:adminpeoplemerge-registry into launchpad:master.

Commit message:
Allow registry experts to use +adminpeoplemerge

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/376154

This almost always needs to be used in response to support requests; at the moment we end up round-tripping through sysadmins, but this isn't the best use of sysadmin time and they pretty much just follow our instructions anyway.  It would make more sense for registry experts to be able to do it themselves, since they already have various other related privileges.

See the related commit e8b46de9f07c22d1f565cf3d6812d03232aa10e1, which did the same thing for +adminteammerge.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:adminpeoplemerge-registry into launchpad:master.
diff --git a/lib/lp/registry/browser/configure.zcml b/lib/lp/registry/browser/configure.zcml
index 44694a1..66bb0fd 100644
--- a/lib/lp/registry/browser/configure.zcml
+++ b/lib/lp/registry/browser/configure.zcml
@@ -1,4 +1,4 @@
-<!-- Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+<!-- Copyright 2009-2019 Canonical Ltd.  This software is licensed under the
      GNU Affero General Public License version 3 (see the file LICENSE).
 -->
 
@@ -1409,7 +1409,7 @@
         name="+adminpeoplemerge"
         for="lp.registry.interfaces.person.IPersonSet"
         class="lp.registry.browser.peoplemerge.AdminPeopleMergeView"
-        permission="launchpad.Admin"
+        permission="launchpad.Moderate"
         template="../templates/people-adminrequestmerge.pt"
         />
     <browser:page
diff --git a/lib/lp/registry/browser/menu.py b/lib/lp/registry/browser/menu.py
index 1446a83..6e9d706 100644
--- a/lib/lp/registry/browser/menu.py
+++ b/lib/lp/registry/browser/menu.py
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2019 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Shared menus."""
@@ -63,7 +63,7 @@ class TopLevelMenuMixin:
         text = 'Request a merge'
         return Link('/people/+requestmerge', text, icon='edit')
 
-    @enabled_with_permission('launchpad.Admin')
+    @enabled_with_permission('launchpad.Moderate')
     def admin_merge_people(self):
         text = 'Merge people'
         return Link('/people/+adminpeoplemerge', text, icon='edit')
diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py
index 1c86ace..a6df4b5 100644
--- a/lib/lp/registry/browser/person.py
+++ b/lib/lp/registry/browser/person.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2019 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Person-related view classes."""
@@ -653,12 +653,12 @@ class PersonSetContextMenu(ContextMenu, TopLevelMenuMixin):
         text = 'Merge accounts'
         return Link('+requestmerge', text, icon='edit')
 
-    @enabled_with_permission('launchpad.Admin')
+    @enabled_with_permission('launchpad.Moderate')
     def adminpeoplemerge(self):
         text = 'Admin merge people'
         return Link('+adminpeoplemerge', text, icon='edit')
 
-    @enabled_with_permission('launchpad.Admin')
+    @enabled_with_permission('launchpad.Moderate')
     def adminteammerge(self):
         text = 'Admin merge teams'
         return Link('+adminteammerge', text, icon='edit')
diff --git a/lib/lp/registry/browser/tests/peoplemerge-views.txt b/lib/lp/registry/browser/tests/peoplemerge-views.txt
index ae030b1..5d8dcb2 100644
--- a/lib/lp/registry/browser/tests/peoplemerge-views.txt
+++ b/lib/lp/registry/browser/tests/peoplemerge-views.txt
@@ -62,8 +62,7 @@ For regular users to merge Launchpad profiles, we require that they confirm
 ownership of the merged profile's email addresses, so it's not possible for
 them to merge a profile which has no email address.
 
-    >>> admin = person_set.getByName('name16')
-    >>> ignored = login_person(registry_expert)
+    >>> _ = login_person(factory.makePerson())
 
     # First we need to forge a person without a single email address.
     >>> from lp.registry.interfaces.person import PersonCreationRationale
@@ -80,9 +79,10 @@ them to merge a profile which has no email address.
     >>> print view.getFieldError('dupe_person')
     The duplicate is not a valid person or team.
 
-Admins, on the other hand, are allowed to merge people without a single email
-address.
+Admins and registry experts, on the other hand, are allowed to merge people
+without a single email address.
 
+    >>> _ = login_person(registry_expert)
     >>> form = {'field.dupe_person': person.name,
     ...         'field.target_person': 'name16',
     ...         'field.actions.merge': 'Merge'}