launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23294
[Merge] lp:~twom/launchpad/rescan-button-needs-less-permissions into lp:launchpad
Tom Wardill has proposed merging lp:~twom/launchpad/rescan-button-needs-less-permissions into lp:launchpad.
Commit message:
Make the permissions for the Branch rescan more permissive.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~twom/launchpad/rescan-button-needs-less-permissions/+merge/362874
Currently only the branch owner can rescan, this will allow product owners and commercial owners to also cause a rescan.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~twom/launchpad/rescan-button-needs-less-permissions into lp:launchpad.
=== modified file 'lib/lp/code/browser/configure.zcml'
--- lib/lp/code/browser/configure.zcml 2019-01-31 13:48:34 +0000
+++ lib/lp/code/browser/configure.zcml 2019-02-07 16:29:23 +0000
@@ -446,7 +446,7 @@
name="+rescan"
for="lp.code.interfaces.branch.IBranch"
class="lp.code.browser.branch.BranchRescanView"
- permission="launchpad.Edit"
+ permission="launchpad.Moderate"
template="../templates/branch-rescan.pt"/>
<browser:page
name="+edit-import"
=== modified file 'lib/lp/code/browser/tests/test_branch.py'
--- lib/lp/code/browser/tests/test_branch.py 2019-01-30 17:24:15 +0000
+++ lib/lp/code/browser/tests/test_branch.py 2019-02-07 16:29:23 +0000
@@ -649,6 +649,41 @@
self.assertThat(recorder, HasQueryCount(Equals(30)))
+class TestBranchRescanView(BrowserTestCase):
+
+ layer = DatabaseFunctionalLayer
+
+ def _getBrowser(self, user=None):
+ if user is None:
+ browser = setupBrowser()
+ logout()
+ return browser
+ else:
+ login_person(user)
+ return setupBrowserForUser(user=user)
+
+ def test_owner_can_see_rescan(self):
+ branch = self.factory.makeAnyBranch()
+ job = BranchScanJob.create(branch)
+ job.job._status = JobStatus.FAILED
+ branch_url = canonical_url(branch, view_name='+rescan', rootsite='code')
+ browser = self._getBrowser(branch.owner)
+ browser.open(branch_url)
+ self.assertTrue('schedule a rescan' in browser.contents)
+
+ def test_other_user_can_see_rescan(self):
+ other_user = self.factory.makePerson()
+ product = self.factory.makeProduct(owner=other_user)
+ branch = self.factory.makeAnyBranch(product=product)
+ job = BranchScanJob.create(branch)
+ job.job._status = JobStatus.FAILED
+ branch_url = canonical_url(branch, view_name='+rescan', rootsite='code')
+ browser = self._getBrowser(other_user)
+ browser.open(branch_url)
+ self.assertTrue('schedule a rescan' in browser.contents)
+
+
+
class TestBranchViewPrivateArtifacts(BrowserTestCase):
""" Tests that branches with private team artifacts can be viewed.
Follow ups