This is my branch to enable distro drivers to manage their series. It introduces two marker interfaces IBaseDistribution and IDerivativeDistribution to allow us to set separate permission on instances of Distribution. lp:~sinzui/launchpad/distro-driver Diff size: 708 Launchpad bug: https://bugs.launchpad.net/bugs/distro-driver Test command: ./bin/test -vv \ -t "registry.*("milestone-views|distroseries-views|xx-distroseries-edit)' \ -t "registry.*doc/(distroseries|productseries)" Pre-implementation: flacoste Target release: 2.2.8 = Enable distro drivers to manage their series = Distro drivers for needs the same privileges as project drivers to do their job, but they cannot because some aspects of creating a distro series require lots of back end preparation. This problem only affects Ubuntu because it uses Soyuz and Translations, so the limitation should only affect Ubuntu. Assuming that Ubuntu is an exception then, distro drivers need the power to create a series and doing so make them the series release manager. The release manager can create and modify milestones. == Rules == Updated the permission rules of distroseries and milestones. * A distro.driver may create a series and he is automatically made the series.driver (AKA release manager) * Requires a new security permission * The series.driver may create milestones and modify milestones * requires an update to the existing permission The Ubuntu exception is difficult in the case of adding a series because security.py permissions are based on object type, not instances. and the permission exception is only in regards to creating a series. The solution suggest by Francis is to add marker interfaces based on the instance during the SQLObject __init() phase. This is the same solution used by Archive. ADDENDUM When a product driver creates a series, he should be the series driver too. A derivative distribution series must allow the driver to set the status. == QA == * Ask the owner of Baltix to create the series he needs. * Ask the owner of Baltix to update his two current milestones by assigning them to one of his series * Ask the owner of Baltix to create a milestone. == Lint == Checking for conflicts. and issues in doctests and templates. Running jslint, xmllint, pyflakes, and pylint. Using normal rules. Linting changed files: lib/canonical/launchpad/security.py lib/lp/registry/configure.zcml lib/lp/registry/browser/configure.zcml lib/lp/registry/browser/distroseries.py lib/lp/registry/browser/product.py lib/lp/registry/browser/tests/distroseries-views.txt lib/lp/registry/browser/tests/milestone-views.txt lib/lp/registry/doc/distroseries.txt lib/lp/registry/doc/productseries.txt lib/lp/registry/interfaces/distribution.py lib/lp/registry/model/distribution.py lib/lp/registry/model/product.py == Test == * lib/lp/registry/browser/tests/distroseries-views.txt * Added tests to verify that IDerivativeDistribution drivers can create series and edit the series that they are drivers of. IBaseDistribution drivers cannot. * lib/lp/registry/browser/tests/milestone-views.txt * Added tests to verify that IDerivativeDistribution series drivers can added an edit milestones. IBaseDistribution series drivers cannot. * lib/lp/registry/doc/distroseries.txt * Added tests to verify that IDerivativeDistribution drivers can create series and are automatically assigned to the driver role. IBaseDistribution drivers cannot. * lib/lp/registry/doc/productseries.txt * Updated a test to show that drivers that create series are also drivers the the new series. == Implementation == * lib/canonical/launchpad/security.py * Added DriveDistributionByDriversOrOwnersOrAdmins (launchpad.Driver) which is use just for creating distroseries. * Updated the existing rule for editing distroseries to allow a release manager to make changes. * lib/lp/registry/configure.zcml * Added IDistributionDriverRestricted permission rule to Distribution. * lib/lp/registry/browser/distroseries.py * Extracted the distroseries status rules from the admin view to a mixin. Moved createStatusField() and added updateDateReleased() * Replaced the unneeded initialize() with a label property in the edit and admin views. * Added a setupFields() method to the edit view that calls createStatusField() when the series belongs to a IDerivativeDistribution. * lib/lp/registry/browser/configure.zcml * Added an new permission rule on +addseries on IDerivativeDistribution do that a driver can create a series. * lib/lp/registry/interfaces/distribution.py * Separated the Distribution,.newSeries method from the edit permission, made it a part of IDistributionDriverRestricted. * Added IBaseDistribution and IDerivativeDistribution to distinguish distributions that use Soyuz and Translations from those that do not. * lib/lp/registry/model/distribution.py * Redefined the _init to add the IBaseDistribution or IDerivativeDistribution interfaces. * Refactored full_functionality() to use IBaseDistribution to determine truth. * Updated the newSeries() method to ensure that a driver is assigned when the series ia created by a driver. * lib/lp/registry/model/product.py * Updated the newSeries() method to ensure that a driver is assigned when the series is created by a driver.