~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/model/archive.py

  • Committer: Julian Edwards
  • Date: 2011-07-28 20:46:18 UTC
  • mfrom: (13553 devel)
  • mto: This revision was merged to the branch mainline in revision 13555.
  • Revision ID: julian.edwards@canonical.com-20110728204618-tivj2wx2oa9s32bx
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1947
1947
        self.enabled_restricted_families = restricted
1948
1948
 
1949
1949
    @classmethod
1950
 
    def validatePPA(self, person, proposed_name):
 
1950
    def validatePPA(self, person, proposed_name, private=False):
1951
1951
        ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
 
1952
        if private:
 
1953
            # NOTE: This duplicates the policy in lp/soyuz/configure.zcml
 
1954
            # which says that one needs 'launchpad.Commercial' permission to
 
1955
            # set 'private', and the logic in `AdminByCommercialTeamOrAdmins`
 
1956
            # which determines who is granted launchpad.Commercial
 
1957
            # permissions.
 
1958
            commercial = getUtility(ILaunchpadCelebrities).commercial_admin
 
1959
            admin = getUtility(ILaunchpadCelebrities).admin
 
1960
            if not person.inTeam(commercial) and not person.inTeam(admin):
 
1961
                return '%s is not allowed to make private PPAs' % (person.name,)
1952
1962
        if person.isTeam() and (
1953
1963
            person.subscriptionpolicy in OPEN_TEAM_POLICY):
1954
1964
            return "Open teams cannot have PPAs."