Esempio n. 1
0
 def wrapper(request, addon, *args, **kw):
     from devhub.views import _resume
     if webapp:
         kw['webapp'] = addon.is_webapp()
     fun = lambda: f(
         request, addon_id=addon.id, addon=addon, *args, **kw)
     if allow_editors:
         if acl.check_reviewer(request):
             return fun()
     # Require an owner or dev for POST requests.
     if request.method == 'POST':
         if acl.check_addon_ownership(request,
                                      addon,
                                      dev=not owner_for_post):
             return fun()
     # Ignore disabled so they can view their add-on.
     elif acl.check_addon_ownership(request,
                                    addon,
                                    viewer=True,
                                    ignore_disabled=True):
         step = SubmitStep.objects.filter(addon=addon)
         # Redirect to the submit flow if they're not done.
         if not getattr(f, 'submitting', False) and step:
             return _resume(addon, step)
         return fun()
     raise PermissionDenied
Esempio n. 2
0
 def wrapper(request, addon, *args, **kw):
     from devhub.views import _resume
     if theme:
         kw['theme'] = addon.is_persona()
     elif addon.is_persona():
         # Don't allow theme views if theme not passed in.
         raise http.Http404
     fun = lambda: f(request, addon_id=addon.id, addon=addon,
                     *args, **kw)
     if allow_editors:
         if acl.check_reviewer(request):
             return fun()
     # Require an owner or dev for POST requests.
     if request.method == 'POST':
         if acl.check_addon_ownership(request, addon,
                                      dev=not owner_for_post):
             return fun()
     # Ignore disabled so they can view their add-on.
     elif acl.check_addon_ownership(request, addon, viewer=True,
                                    ignore_disabled=True):
         step = SubmitStep.objects.filter(addon=addon)
         # Redirect to the submit flow if they're not done.
         if not getattr(f, 'submitting', False) and step:
             return _resume(addon, step)
         return fun()
     raise PermissionDenied
Esempio n. 3
0
        def wrapper(request, addon, *args, **kw):
            from devhub.views import _resume

            if webapp:
                kw["webapp"] = addon.is_webapp()
            fun = lambda: f(request, addon_id=addon.id, addon=addon, *args, **kw)
            if allow_editors:
                if acl.check_reviewer(request):
                    return fun()
            # Require an owner or dev for POST requests.
            if request.method == "POST":
                if acl.check_addon_ownership(request, addon, dev=not owner_for_post):
                    return fun()
            # Ignore disabled so they can view their add-on.
            elif acl.check_addon_ownership(request, addon, viewer=True, ignore_disabled=True):
                step = SubmitStep.objects.filter(addon=addon)
                # Redirect to the submit flow if they're not done.
                if not getattr(f, "submitting", False) and step:
                    return _resume(addon, step)
                return fun()
            raise PermissionDenied
Esempio n. 4
0
 def wrapper(request, addon, *args, **kw):
     from devhub.views import _resume
     fun = lambda: f(request, addon_id=addon.id, addon=addon, *args,
                     **kw)
     if allow_editors:
         if acl.action_allowed(request, 'Editors', '%'):
             return fun()
     # Require an owner or dev for POST requests.
     if request.method == 'POST':
         if acl.check_addon_ownership(request, addon,
                                      dev=not owner_for_post):
             return fun()
     # Ignore disabled so they can view their add-on.
     elif acl.check_addon_ownership(request, addon, viewer=True,
                                    ignore_disabled=True):
         step = SubmitStep.objects.filter(addon=addon)
         # Redirect to the submit flow if they're not done.
         if not getattr(f, 'submitting', False) and step:
             return _resume(addon, step)
         return fun()
     return http.HttpResponseForbidden()
Esempio n. 5
0
 def wrapper(request, addon, *args, **kw):
     from devhub.views import _resume
     fun = lambda: f(
         request, addon_id=addon.id, addon=addon, *args, **kw)
     if allow_editors:
         if acl.action_allowed(request, 'Editors', '%'):
             return fun()
     # Require an owner or dev for POST requests.
     if request.method == 'POST':
         if acl.check_addon_ownership(request,
                                      addon,
                                      dev=not owner_for_post):
             return fun()
     # Ignore disabled so they can view their add-on.
     elif acl.check_addon_ownership(request,
                                    addon,
                                    viewer=True,
                                    ignore_disabled=True):
         step = SubmitStep.objects.filter(addon=addon)
         # Redirect to the submit flow if they're not done.
         if not getattr(f, 'submitting', False) and step:
             return _resume(addon, step)
         return fun()
     return http.HttpResponseForbidden()