A decorator to check if user has any of the roles specified

    @require_user_roles('superadmin', 'admin')
    def fn():
        pass

def require_user_roles(*roles):
    """
    A decorator to check if user has any of the roles specified

    @require_user_roles('superadmin', 'admin')
    def fn():
        pass
    """
    def wrapper(f):
        @functools.wraps(f)
        def wrapped(*args, **kwargs):
            if ext.user_authenticated():
                if not ext.flask_login.current_user.has_any_roles(*roles):
                    return abort(403)
            else:
                return abort(401)
            return f(*args, **kwargs)
        return wrapped
    return wrapper