def validate(*args: list, **kwargs: dict): if not session.get("is_member"): # not a member, we need to throw it out:) return login.unauthorized() return func(*args, **kwargs)
def decorated_view(*args, **kwargs): if not current_user.is_authenticated: return login.unauthorized() if ( (not current_user.has_role(role)) and (role != "ANY")) and not current_user.has_role('admin'): return login.unauthorized() return fn(*args, **kwargs)
def decorated_function(*args, **kwargs): if current_app.config[ 'LOGIN_REQUIRED'] and not current_user.is_authenticated: return lm.unauthorized() return f(*args, **kwargs)
def decorated_function(*args, **kwargs): if current_user.is_anonymous or not current_user.is_admin: return lm.unauthorized() return f(*args, **kwargs)
def decorated_view(*args, **kwargs): if not current_user.is_authenticated: return login.unauthorized() if (current_user.role not in role) and (role != "ANY"): return login.unauthorized() return fn(*args, **kwargs)
def decorated_view(*args, **kwargs): if not current_user.is_authenticated: return login.unauthorized() if current_user.category not in role: return role_unauthorized() return fn(*args, **kwargs)
def decorator(*args, **kwargs): if not current_user.is_authenticated: return login.unauthorized() # or, if you're not using Flask-Login # return redirect(url_for('login_page')) return f(*args, **kwargs)