121
122
Unauthorized: (..., 'buildd_secret', 'launchpad.Commercial')
123
Commercial Member, a commercial admin but not an admin, can set 'buildd_secret'.
124
Commercial Member, a commercial admin but not an admin, can set
125
127
>>> login("commercial-member@canonical.com")
126
128
>>> cprov_private_ppa.buildd_secret = 'not so secret at all'
883
891
Now we will emulate a duplicated reference to the same 'orig.tar.gz',
884
892
upstream tarball, as if it was part of two different SourcePackageRelease.
886
>>> from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
894
>>> from canonical.launchpad.interfaces.librarian import (
895
... ILibraryFileAliasSet,
887
897
>>> huge_firefox_orig_file = getUtility(ILibraryFileAliasSet)[3]
888
898
>>> cprov_cdrkit_src = cprov_archive.getPublishedSources(
889
899
... name='cdrkit')[0]
1628
1644
>>> jblack_ppas.count()
1631
Another similar method, getPPAOwnedByPersonUser(), will return the named PPA
1632
owned by the person, or if the person is not supplied will default to the
1647
Another similar method, getPPAOwnedByPerson(), will return the named PPA
1648
owned by the person, or if a name is not supplied will default to the
1633
1649
first PPA that the person created.
1635
>>> print archive_set.getPPAOwnedByPerson(cprov).displayname
1636
PPA for Celso Providelo
1638
>>> print archive_set.getPPAOwnedByPerson(cprov, name="ppa").displayname
1639
PPA for Celso Providelo
1651
>>> ppa_owner = factory.makePerson(
1652
... name="ppa-owner", displayname="PPA Owner")
1653
>>> login_person(ppa_owner)
1655
If no PPAs match the search criteria, and a name is not given, then
1658
>>> print archive_set.getPPAOwnedByPerson(ppa_owner)
1661
>>> zoobuntu = factory.makeDistribution(name='zoobuntu')
1662
>>> ppa1 = factory.makeArchive(
1663
... owner=ppa_owner, name="first-ppa", distribution=zoobuntu)
1664
>>> ppa2 = factory.makeArchive(
1665
... owner=ppa_owner, name="second-ppa", distribution=zoobuntu)
1667
>>> print archive_set.getPPAOwnedByPerson(ppa_owner).displayname
1668
PPA named first-ppa for PPA Owner
1670
>>> print archive_set.getPPAOwnedByPerson(
1671
... ppa_owner, name="second-ppa").displayname
1672
PPA named second-ppa for PPA Owner
1641
1674
If the named PPA does not exist, a NoSuchPPA exception is raised.
1643
>>> print archive_set.getPPAOwnedByPerson(cprov, name="goat").displayname
1676
>>> print archive_set.getPPAOwnedByPerson(
1677
... ppa_owner, name="goat").displayname
1644
1678
Traceback (most recent call last):
1646
1680
NoSuchPPA: No such ppa: 'goat'.
1682
A list of statuses may be optionally used, which cause the search to
1683
only select PPAs with one of those statuses. The first PPA will not
1684
be selected and the second is returned.
1686
>>> ppa1.status = ArchiveStatus.DELETED
1687
>>> ppa2.status = ArchiveStatus.ACTIVE
1688
>>> print archive_set.getPPAOwnedByPerson(
1689
... ppa_owner, statuses=[ArchiveStatus.ACTIVE]).displayname
1690
PPA named second-ppa for PPA Owner
1692
The parameter has_packages can be specified to filter based on whether
1693
the PPA has published packages.
1695
>>> spph = factory.makeSourcePackagePublishingHistory(
1696
... archive=ppa2, status=PackagePublishingStatus.PUBLISHED)
1697
>>> print archive_set.getPPAOwnedByPerson(
1698
... ppa_owner, has_packages=True).displayname
1699
PPA named second-ppa for PPA Owner
1648
1701
The method getPrivatePPAs() will return a result set of all PPAs that are
2025
2079
team-archive t1 True True
2026
2080
ultimate-copy copy-owner1 False True
2028
A separate argument allows forcing the inclusion of all disabled archives
2029
the user has access to, so it doesn't include the archive
2082
A separate argument allows forcing the inclusion of all disabled archives
2083
the user has access to, so it doesn't include the archive
2030
2084
of juergen that is disabled.
2032
2086
>>> ubuntu_copy_archives = archive_set.getArchivesForDistribution(
2056
2111
... pub.archive.displayname)
2057
2112
mozilla-firefox - 0.9 in Primary Archive for Ubuntu Linux
2059
== Archive Permission Checking ==
2114
Archive Permission Checking
2115
---------------------------
2061
IArchive has two public methods, checkArchivePermission() and canAdministerQueue()
2062
that check a user's permission to upload and/or administer a
2063
distroseries upload queue respectively. See archivepermission.txt
2117
IArchive has two public methods, checkArchivePermission() and
2118
canAdministerQueue() that check a user's permission to upload and/or
2119
administer a distroseries upload queue respectively. See
2120
archivepermission.txt for more details.
2066
2122
>>> ubuntu_team = getUtility(IPersonSet).getByName('ubuntu-team')
2067
2123
>>> carlos = getUtility(IPersonSet).getByName('carlos')
2072
2128
>>> ubuntu.main_archive.canAdministerQueue(carlos, main_component)
2075
>>> ubuntu.main_archive.checkArchivePermission(ubuntu_team, main_component)
2131
>>> ubuntu.main_archive.checkArchivePermission(
2132
... ubuntu_team, main_component)
2078
2135
>>> ubuntu.main_archive.canAdministerQueue(ubuntu_team, main_component)
2081
checkArchivePermission() can also check someone's permission to upload a specific
2082
source package. Carlos, who does not have permission to upload to any
2083
Ubuntu components, has permission to upload "mozilla-firefox".
2138
checkArchivePermission() can also check someone's permission to upload
2139
a specific source package. Carlos, who does not have permission to
2140
upload to any Ubuntu components, has permission to upload
2085
>>> from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
2143
>>> from lp.registry.interfaces.sourcepackagename import (
2144
... ISourcePackageNameSet,
2086
2146
>>> mozilla = getUtility(
2087
2147
... ISourcePackageNameSet).queryByName("mozilla-firefox")
2088
2148
>>> ubuntu.main_archive.checkArchivePermission(carlos, mozilla)
2093
2153
>>> ubuntu.main_archive.checkArchivePermission(cprov, mozilla)
2096
checkArchivePermission() also works in the same way for PPAs. By default, it allows
2097
anyone in the PPA owning team to upload.
2156
checkArchivePermission() also works in the same way for PPAs. By
2157
default, it allows anyone in the PPA owning team to upload.
2099
2159
>>> cprov_archive.checkArchivePermission(cprov)