コード例 #1
0
ファイル: decorators.py プロジェクト: bebef1987/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:
                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
ファイル: decorators.py プロジェクト: shahbaz17/zamboni
        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