launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05925
[Merge] lp:~stevenk/launchpad/no-configure-codehosting-for-you into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/no-configure-codehosting-for-you into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #892025 in Launchpad itself: "Forbidden following link to configure code hosting"
https://bugs.launchpad.net/launchpad/+bug/892025
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/no-configure-codehosting-for-you/+merge/85605
Hide the 'Configure code hosting' link if the user browsing the view is not a driver for the project.
--
https://code.launchpad.net/~stevenk/launchpad/no-configure-codehosting-for-you/+merge/85605
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/no-configure-codehosting-for-you into lp:launchpad.
=== modified file 'lib/lp/code/browser/branchlisting.py'
--- lib/lp/code/browser/branchlisting.py 2011-12-08 22:32:41 +0000
+++ lib/lp/code/browser/branchlisting.py 2011-12-14 05:29:26 +0000
@@ -89,6 +89,7 @@
ISpecificationBranchSet,
)
from lp.bugs.interfaces.bugbranch import IBugBranchSet
+from lp.bugs.model.bugtask import BugTask
from lp.code.browser.branch import BranchMirrorMixin
from lp.code.browser.branchmergeproposallisting import (
ActiveReviewsView,
@@ -1416,6 +1417,9 @@
@property
def configure_codehosting(self):
"""Get the menu link for configuring code hosting."""
+ if not BugTask.userHasDriverPrivilegesContext(
+ self.context, self.user):
+ return False
series_menu = MenuAPI(self.context.development_focus).overview
set_branch = series_menu['set_branch']
set_branch.text = 'Configure code hosting'
=== modified file 'lib/lp/code/browser/tests/test_branchlisting.py'
--- lib/lp/code/browser/tests/test_branchlisting.py 2011-12-13 13:53:12 +0000
+++ lib/lp/code/browser/tests/test_branchlisting.py 2011-12-14 05:29:26 +0000
@@ -604,6 +604,27 @@
self.assertEqual('launchpad.dev', URI(link.url).host)
+class TestProductConfigureCodehosting(TestCaseWithFactory):
+
+ layer = LaunchpadFunctionalLayer
+
+ def test_configure_codehosting_hidden(self):
+ # If the user does not have driver permissions, they are not shown
+ # the configure codehosting link.
+ product = self.factory.makeProduct()
+ browser = self.getUserBrowser(
+ canonical_url(product, rootsite='code'))
+ self.assertFalse('Configure code hosting' in browser.contents)
+
+ def test_configure_codehosting_shown(self):
+ # If the user has driver permissions, they are shown the configure
+ # codehosting link.
+ product = self.factory.makeProduct()
+ browser = self.getUserBrowser(
+ canonical_url(product, rootsite='code'), user=product.owner)
+ self.assertTrue('Configure code hosting' in browser.contents)
+
+
class TestPersonBranchesPage(BrowserTestCase):
"""Tests for the person branches page.