コード例 #1
0
ファイル: auth.py プロジェクト: relarizky/flask-pre-order
    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)
コード例 #2
0
ファイル: utils.py プロジェクト: boerniee/project-mate
 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)
コード例 #3
0
 def decorated_function(*args, **kwargs):
     if current_app.config[
             'LOGIN_REQUIRED'] and not current_user.is_authenticated:
         return lm.unauthorized()
     return f(*args, **kwargs)
コード例 #4
0
 def decorated_function(*args, **kwargs):
     if current_user.is_anonymous or not current_user.is_admin:
         return lm.unauthorized()
     return f(*args, **kwargs)
コード例 #5
0
 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)
コード例 #6
0
 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)
コード例 #7
0
 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)