launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04448
[Merge] lp:~jml/launchpad/create-private-ppa-814567-2 into lp:launchpad
Jonathan Lange has proposed merging lp:~jml/launchpad/create-private-ppa-814567-2 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jml/launchpad/create-private-ppa-814567-2/+merge/70028
This branch corrects a key mistake from https://code.launchpad.net/~jml/launchpad/create-private-ppa-814567/+merge/69539: not actually making the PPAs private.
The updated pagetest actually guarantees that the PPA can be created and that it is set to private. Other than that, the changes are minimal: pass 'private' through, and set the attribute as needed. We don't need to worry about zope security blowing up, because validatePPA needs to pass before we can get there, and it does the same check.
--
https://code.launchpad.net/~jml/launchpad/create-private-ppa-814567-2/+merge/70028
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jml/launchpad/create-private-ppa-814567-2 into lp:launchpad.
=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py 2011-07-29 06:29:13 +0000
+++ lib/lp/registry/model/person.py 2011-08-01 15:41:49 +0000
@@ -2749,7 +2749,7 @@
return getUtility(IArchiveSet).new(
owner=self, purpose=ArchivePurpose.PPA,
distribution=ubuntu, name=name, displayname=displayname,
- description=description)
+ description=description, private=private)
def isBugContributor(self, user=None):
"""See `IPerson`."""
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2011-07-22 11:38:44 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2011-08-01 15:41:49 +0000
@@ -1658,7 +1658,8 @@
"""
def new(purpose, owner, name=None, displayname=None, distribution=None,
- description=None, enabled=True, require_virtualized=True):
+ description=None, enabled=True, require_virtualized=True,
+ private=False):
"""Create a new archive.
On named-ppa creation, the signing key for the default PPA for the
@@ -1680,6 +1681,7 @@
:param enabled: whether the archive shall be enabled post creation
:param require_virtualized: whether builds for the new archive shall
be carried out on virtual builders
+ :param private: whether or not to make the PPA private
:return: an `IArchive` object.
:raises AssertionError if name is already taken within distribution.
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2011-07-29 14:15:04 +0000
+++ lib/lp/soyuz/model/archive.py 2011-08-01 15:41:49 +0000
@@ -2082,7 +2082,7 @@
def new(self, purpose, owner, name=None, displayname=None,
distribution=None, description=None, enabled=True,
- require_virtualized=True):
+ require_virtualized=True, private=True):
"""See `IArchiveSet`."""
if distribution is None:
distribution = getUtility(ILaunchpadCelebrities).ubuntu
@@ -2156,6 +2156,8 @@
new_archive.buildd_secret = create_unique_token_for_table(
20, Archive.buildd_secret)
new_archive.private = True
+ else:
+ new_archive.private = private
return new_archive
=== modified file 'lib/lp/soyuz/stories/webservice/xx-person-createppa.txt'
--- lib/lp/soyuz/stories/webservice/xx-person-createppa.txt 2011-07-27 19:13:40 +0000
+++ lib/lp/soyuz/stories/webservice/xx-person-createppa.txt 2011-08-01 15:41:49 +0000
@@ -1,5 +1,8 @@
= Creating a PPA =
+ >>> from zope.component import getUtility
+ >>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
+ >>> from lp.testing import celebrity_logged_in
>>> from lp.testing.sampledata import ADMIN_EMAIL
>>> login(ADMIN_EMAIL)
>>> owner = factory.makePerson()
@@ -58,3 +61,36 @@
... ppa_owner['ppas_collection_link']).jsonBody())
http://api.launchpad.dev/beta/~.../+archive/ppa
+However, we can grant them commercial admin access:
+
+ >>> with celebrity_logged_in('admin'):
+ ... comm = getUtility(ILaunchpadCelebrities).commercial_admin
+ ... comm.addMember(owner, comm.teamowner)
+ (True, <DBItem TeamMembershipStatus.APPROVED, (2) Approved>)
+
+Once they have commercial access, they can create private PPAs:
+
+ >>> print ppa_owner_webservice.named_post(
+ ... ppa_owner['self_link'], 'createPPA', {}, name='secret',
+ ... displayname='My secret new PPA', description='Secretness!',
+ ... private=True,
+ ... )
+ HTTP/1.1 201 Created
+ Status: 201
+ ...
+ Location: http://api.launchpad.dev/.../+archive/secret
+ ...
+
+And the PPA appears in their list of PPAs:
+
+ >>> print_self_link_of_entries(webservice.get(
+ ... ppa_owner['ppas_collection_link']).jsonBody())
+ http://api.launchpad.dev/.../+archive/ppa
+ http://api.launchpad.dev/.../+archive/secret
+
+And the PPA is, of course, private:
+
+ >>> ppa = ppa_owner_webservice.named_get(
+ ... ppa_owner['self_link'], 'getPPAByName', name='secret').jsonBody()
+ >>> ppa['private']
+ True
=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py 2011-07-29 14:15:04 +0000
+++ lib/lp/soyuz/tests/test_archive.py 2011-08-01 15:41:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test Archive features."""