← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~lgp171188/launchpad:split-global-security.py-registry into launchpad:master

 


Diff comments:

> diff --git a/lib/lp/security.py b/lib/lp/security.py
> index 2ab931d..f8da487 100644
> --- a/lib/lp/security.py
> +++ b/lib/lp/security.py
> @@ -3279,9 +2063,24 @@ class ViewSourcePackage(AnonymousAuthorization):
>      usedfor = ISourcePackage
>  
>  
> -class EditSourcePackage(EditDistributionSourcePackage):
> +class EditSourcePackage(AuthorizationBase):

Swapped the inheritance direction here - `EditDistributionSourcePackage` (in `lp.registry.security`) now inherits from `EditSourcePackage`. This avoids the circular import between `lp.security` and `lp.registry.security`.

> +    permission = 'launchpad.Edit'
>      usedfor = ISourcePackage
>  
> +    def _checkUpload(self, user, archive, distroseries):
> +        # We use verifyUpload() instead of checkUpload() because we don't
> +        # have a pocket.  It returns the reason the user can't upload or
> +        # None if they are allowed.
> +        if distroseries is None:
> +            return False
> +        sourcepackage = distroseries.getSourcePackage(
> +            self.obj.sourcepackagename)
> +        reason = archive.verifyUpload(
> +            user.person, sourcepackagename=self.obj.sourcepackagename,
> +            component=sourcepackage.latest_published_component,
> +            distroseries=distroseries)
> +        return reason is None
> +
>      def checkAuthenticated(self, user):
>          """Anyone who can upload a package can edit it."""
>          if user.in_admin:


-- 
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/425938
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:split-global-security.py-registry into launchpad:master.



References