launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02188
[Merge] lp:~salgado/launchpad/target-driver-edit-blueprint into lp:launchpad
Guilherme Salgado has proposed merging lp:~salgado/launchpad/target-driver-edit-blueprint into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Allow the drivers of a blueprint's target to edit that blueprint.
That's something we need for Linaro and is consistent with allowing the goal's
drivers to edit, which is something we already do.
--
https://code.launchpad.net/~salgado/launchpad/target-driver-edit-blueprint/+merge/44046
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~salgado/launchpad/target-driver-edit-blueprint into lp:launchpad.
=== modified file 'lib/canonical/launchpad/security.py'
--- lib/canonical/launchpad/security.py 2010-12-15 22:05:43 +0000
+++ lib/canonical/launchpad/security.py 2010-12-17 13:34:19 +0000
@@ -520,6 +520,7 @@
return True
return (user.in_admin or
user.isOwner(self.obj.target) or
+ user.isOneOfDrivers(self.obj.target) or
user.isOneOf(
self.obj, ['owner', 'drafter', 'assignee', 'approver']))
=== modified file 'lib/lp/blueprints/tests/test_specification.py'
--- lib/lp/blueprints/tests/test_specification.py 2010-11-24 18:06:04 +0000
+++ lib/lp/blueprints/tests/test_specification.py 2010-12-17 13:34:19 +0000
@@ -9,16 +9,29 @@
from zope.security.interfaces import Unauthorized
from zope.security.proxy import removeSecurityProxy
+from canonical.launchpad.webapp.authorization import check_permission
from canonical.testing.layers import DatabaseFunctionalLayer
from lp.blueprints.errors import TargetAlreadyHasSpecification
from lp.blueprints.interfaces.specification import SpecificationGoalStatus
-from lp.testing import TestCaseWithFactory
+from lp.testing import (
+ login_person,
+ TestCaseWithFactory,
+ )
class SpecificationTests(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
+ def test_target_driver_has_edit_rights(self):
+ """Drivers of a blueprint's target can edit that blueprint."""
+ product = self.factory.makeProduct()
+ driver = self.factory.makePerson()
+ removeSecurityProxy(product).driver = driver
+ specification = self.factory.makeSpecification(product=product)
+ login_person(driver)
+ self.assertTrue(check_permission('launchpad.Edit', specification))
+
def test_auto_accept_of_goal_for_drivers(self):
"""Drivers of a series accept the goal when they propose."""
product = self.factory.makeProduct()
@@ -49,7 +62,7 @@
specification2 = self.factory.makeSpecification(
product=product2, name="foo")
self.assertRaises(
- TargetAlreadyHasSpecification,
+ TargetAlreadyHasSpecification,
removeSecurityProxy(specification1).retarget, product2)
def test_retarget_is_protected(self):