Exemplo n.º 1
0
def handle_google_assistant_request():
    body = request.json
    action = body['result']['action']

    if action == 'get_permissions':
        return jsonify(get_permissions())

    if action == 'greet_user':
        result = get_greetings(body.get('originalRequest', {}))
        return jsonify(result)

    if action == 'create_issue':
        return jsonify(create_issue(body['result']['contexts']))

    if action == 'rename_issue':
        return jsonify(rename_issue())

    if action == 'redescribe_issue':
        return jsonify(redescribe_issue())

    if action == 'reprioritize_issue':
        return jsonify(reprioritize_issue())

    if action == 'redate_issue':
        return jsonify(redate_issue())
Exemplo n.º 2
0
def register_place_hook():
    """Hook to take the place from the view arguments and set it in context globals.

    The place set in context globals is used by some legacy code.
    """
    if request.view_args and 'place' in request.view_args:
        g.place = request.view_args['place']

        # initialize the permissions
        user = h.get_current_user()
        if user:
            g.permissions = h.get_permissions(user, g.place)
Exemplo n.º 3
0
def register_place_hook():
    """Hook to take the place from the view arguments and set it in context globals.

    The place set in context globals is used by some legacy code.
    """
    if request.view_args and 'place' in request.view_args:
        g.place = request.view_args['place']

        # initialize the permissions
        user = h.get_current_user()
        if user:
            g.permissions = h.get_permissions(user, g.place)
Exemplo n.º 4
0
        def wrapped(*a, **kw):
            user = h.get_current_user()
            if not user:
                return render_template("permission_denied.html")

            # Find the current place from the view args
            # or use the top-level place
            place = request.view_args.get("place") or Place.get_toplevel_place()

            perms = h.get_permissions(user, place)
            # Put permissions in context globals, so that it can be added
            # to the template from helpers.py
            g.permissions = perms
            if permission and not h.has_permission(permission):
                return render_template("permission_denied.html")

            return f(*a, **kw)
Exemplo n.º 5
0
    def f(key, *a, **kw):
        place = Place.find(key)
        if not place:
            abort(404)
        g.place = place
        user = h.get_current_user()
        if not user:
            return render_template("permission_denied.html")

        perms = h.get_permissions(user, place)
        # Put permissions in context globals, so that it can be added
        # to the template from helpers.py
        g.permissions = perms
        if permission and permission not in perms:
            return render_template("permission_denied.html")

        return func(place, *a, **kw)
Exemplo n.º 6
0
    def f(key, *a, **kw):
        place = Place.find(key)
        if not place:
            abort(404)
        g.place = place
        user = h.get_current_user()
        if not user:
            return render_template("permission_denied.html")

        perms = h.get_permissions(user, place)
        # Put permissions in context globals, so that it can be added
        # to the template from helpers.py
        g.permissions = perms
        if permission and permission not in perms:
            return render_template("permission_denied.html")
        
        return func(place, *a, **kw)
Exemplo n.º 7
0
        def wrapped(*a, **kw):
            user = h.get_current_user()
            if not user:
                return render_template("permission_denied.html")

            # Find the current place from the view args
            # or use the top-level place
            place = request.view_args.get(
                "place") or Place.get_toplevel_place()

            perms = h.get_permissions(user, place)
            # Put permissions in context globals, so that it can be added
            # to the template from helpers.py
            g.permissions = perms
            if permission and not h.has_permission(permission):
                return render_template("permission_denied.html")

            return f(*a, **kw)