Example #1
0
    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)
Example #2
0
 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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)