Ejemplo n.º 1
0
        def decorated_function(*args, **kwargs):
            """The decorated version of ``f`` (see :method:``__call__``).

            :param args: Arguments for ``f``.
            :params kwargs: Keyword arguments for ``f``.
            """
            lookup_current_user()
            try:
                if not g.user.can(self.privilege):
                    return abort(401)
            except AttributeError:
                return abort(401)

            return f(*args, **kwargs)
Ejemplo n.º 2
0
    def decorated_function(*args, **kwargs):
        """The decorated version of ``f`` (see :method:``login_required``).

        :param args: Arguments for ``f``.
        :params kwargs: Keyword arguments for ``f``.
        """

        lookup_current_user()
        try:
            if g.user is None or 'gplus_id' not in session:
                return redirect(url_for('auth.login', next=request.url))
        except AttributeError:
            return redirect(url_for('auth.login', next=request.url))

        return f(*args, **kwargs)