예제 #1
0
        def wrapper(request, addon, *args, **kw):
            from mkt.submit.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):
                if not skip_submit_check:
                    try:
                        # If it didn't go through the app submission
                        # checklist. Don't die. This will be useful for
                        # creating apps with an API later.
                        step = addon.appsubmissionchecklist.get_next()
                    except ObjectDoesNotExist:
                        step = None
                    # 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()
예제 #2
0
 def wrapper(request, *args, **kw):
     from mkt.submit.views import _resume
     from mkt.submit.models import AppSubmissionChecklist
     addon = kw.get('addon', False)
     if addon:
         try:
             step = addon.appsubmissionchecklist.get_next()
         except AppSubmissionChecklist.DoesNotExist:
             step = None
         if step and step != outer_step:
             return _resume(addon, step)
     return f(request, *args, **kw)
예제 #3
0
파일: decorators.py 프로젝트: vdt/zamboni
        def wrapper(request, addon, *args, **kw):
            from mkt.submit.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 and acl.check_reviewer(request):
                return fun()

            if staff and (acl.action_allowed(request, 'Apps', 'Configure')
                          or acl.action_allowed(request, 'Apps',
                                                'ViewConfiguration')):
                return fun()

            if support:
                # Let developers and support people do their thangs.
                if (acl.check_addon_ownership(request, addon, support=True) or
                        acl.check_addon_ownership(request, addon, dev=True)):
                    return fun()
            else:
                # 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):
                    if not skip_submit_check:
                        try:
                            # If it didn't go through the app submission
                            # checklist. Don't die. This will be useful for
                            # creating apps with an API later.
                            step = addon.appsubmissionchecklist.get_next()
                        except ObjectDoesNotExist:
                            step = None
                        # 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()
예제 #4
0
        def wrapper(request, webapp, *args, **kw):
            from mkt.submit.views import _resume

            def fun():
                return f(request, webapp_id=webapp.id, webapp=webapp,
                         *args, **kw)

            if allow_editors and acl.check_reviewer(request):
                return fun()

            if staff and (acl.action_allowed(request, 'Apps', 'Configure') or
                          acl.action_allowed(request, 'Apps',
                                             'ViewConfiguration')):
                return fun()

            if support:
                # Let developers and support people do their thangs.
                if (acl.check_webapp_ownership(request, webapp,
                                               support=True) or
                    acl.check_webapp_ownership(request, webapp,
                                               dev=True)):
                    return fun()
            else:
                # Require an owner or dev for POST requests.
                if request.method == 'POST':

                    if acl.check_webapp_ownership(request, webapp,
                                                  dev=not owner_for_post):
                        return fun()

                # Ignore disabled so they can view their add-on.
                elif acl.check_webapp_ownership(request, webapp, viewer=True,
                                                ignore_disabled=True):
                    if not skip_submit_check:
                        try:
                            # If it didn't go through the app submission
                            # checklist. Don't die. This will be useful for
                            # creating apps with an API later.
                            step = webapp.appsubmissionchecklist.get_next()
                        except ObjectDoesNotExist:
                            step = None
                        # Redirect to the submit flow if they're not done.
                        if not getattr(f, 'submitting', False) and step:
                            return _resume(webapp, step)
                    return fun()

            raise PermissionDenied