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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 6135c32597bfe4f6b38e79e84276dde626a8e755
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:adminpeoplemerge-registry
Merge into: launchpad:master
Diff against target: 90 lines (+11/-11)
4 files modified
lib/lp/registry/browser/configure.zcml (+2/-2)
lib/lp/registry/browser/menu.py (+2/-2)
lib/lp/registry/browser/person.py (+3/-3)
lib/lp/registry/browser/tests/peoplemerge-views.txt (+4/-4)
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+376154@code.launchpad.net

Commit message

Allow registry experts to use +adminpeoplemerge

Description of the change

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.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/registry/browser/configure.zcml b/lib/lp/registry/browser/configure.zcml
2index 44694a1..66bb0fd 100644
3--- a/lib/lp/registry/browser/configure.zcml
4+++ b/lib/lp/registry/browser/configure.zcml
5@@ -1,4 +1,4 @@
6-<!-- Copyright 2009-2015 Canonical Ltd. This software is licensed under the
7+<!-- Copyright 2009-2019 Canonical Ltd. This software is licensed under the
8 GNU Affero General Public License version 3 (see the file LICENSE).
9 -->
10
11@@ -1409,7 +1409,7 @@
12 name="+adminpeoplemerge"
13 for="lp.registry.interfaces.person.IPersonSet"
14 class="lp.registry.browser.peoplemerge.AdminPeopleMergeView"
15- permission="launchpad.Admin"
16+ permission="launchpad.Moderate"
17 template="../templates/people-adminrequestmerge.pt"
18 />
19 <browser:page
20diff --git a/lib/lp/registry/browser/menu.py b/lib/lp/registry/browser/menu.py
21index 1446a83..6e9d706 100644
22--- a/lib/lp/registry/browser/menu.py
23+++ b/lib/lp/registry/browser/menu.py
24@@ -1,4 +1,4 @@
25-# Copyright 2009 Canonical Ltd. This software is licensed under the
26+# Copyright 2009-2019 Canonical Ltd. This software is licensed under the
27 # GNU Affero General Public License version 3 (see the file LICENSE).
28
29 """Shared menus."""
30@@ -63,7 +63,7 @@ class TopLevelMenuMixin:
31 text = 'Request a merge'
32 return Link('/people/+requestmerge', text, icon='edit')
33
34- @enabled_with_permission('launchpad.Admin')
35+ @enabled_with_permission('launchpad.Moderate')
36 def admin_merge_people(self):
37 text = 'Merge people'
38 return Link('/people/+adminpeoplemerge', text, icon='edit')
39diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py
40index 1c86ace..a6df4b5 100644
41--- a/lib/lp/registry/browser/person.py
42+++ b/lib/lp/registry/browser/person.py
43@@ -1,4 +1,4 @@
44-# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
45+# Copyright 2009-2019 Canonical Ltd. This software is licensed under the
46 # GNU Affero General Public License version 3 (see the file LICENSE).
47
48 """Person-related view classes."""
49@@ -653,12 +653,12 @@ class PersonSetContextMenu(ContextMenu, TopLevelMenuMixin):
50 text = 'Merge accounts'
51 return Link('+requestmerge', text, icon='edit')
52
53- @enabled_with_permission('launchpad.Admin')
54+ @enabled_with_permission('launchpad.Moderate')
55 def adminpeoplemerge(self):
56 text = 'Admin merge people'
57 return Link('+adminpeoplemerge', text, icon='edit')
58
59- @enabled_with_permission('launchpad.Admin')
60+ @enabled_with_permission('launchpad.Moderate')
61 def adminteammerge(self):
62 text = 'Admin merge teams'
63 return Link('+adminteammerge', text, icon='edit')
64diff --git a/lib/lp/registry/browser/tests/peoplemerge-views.txt b/lib/lp/registry/browser/tests/peoplemerge-views.txt
65index ae030b1..5d8dcb2 100644
66--- a/lib/lp/registry/browser/tests/peoplemerge-views.txt
67+++ b/lib/lp/registry/browser/tests/peoplemerge-views.txt
68@@ -62,8 +62,7 @@ For regular users to merge Launchpad profiles, we require that they confirm
69 ownership of the merged profile's email addresses, so it's not possible for
70 them to merge a profile which has no email address.
71
72- >>> admin = person_set.getByName('name16')
73- >>> ignored = login_person(registry_expert)
74+ >>> _ = login_person(factory.makePerson())
75
76 # First we need to forge a person without a single email address.
77 >>> from lp.registry.interfaces.person import PersonCreationRationale
78@@ -80,9 +79,10 @@ them to merge a profile which has no email address.
79 >>> print view.getFieldError('dupe_person')
80 The duplicate is not a valid person or team.
81
82-Admins, on the other hand, are allowed to merge people without a single email
83-address.
84+Admins and registry experts, on the other hand, are allowed to merge people
85+without a single email address.
86
87+ >>> _ = login_person(registry_expert)
88 >>> form = {'field.dupe_person': person.name,
89 ... 'field.target_person': 'name16',
90 ... 'field.actions.merge': 'Merge'}

Subscribers

People subscribed via source and target branches

to status/vote changes: