# Path: mass_flask_config/app.py
# BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECRET_FILE = os.path.join(BASE_DIR, 'secret.txt')
# def setup_session_auth(user_loader):
# def setup_key_based_auth(key_loader):
# def unauthorized_callback():
# 
# Path: mass_flask_core/models/tlp_level.py
# class TLPLevelField(IntField):
#     TLP_LEVEL_WHITE = 0  # Access without login
#     TLP_LEVEL_GREEN = 1  # Access with login
#     TLP_LEVEL_AMBER = 2  # Access only for especially authorized users of same group
#     TLP_LEVEL_RED = 3    # Access only for explicitly mentioned users/groups
# 
#     def __init__(self, *args, **kwargs):
#         kwargs['choices'] = [
#             TLPLevelField.TLP_LEVEL_WHITE,
#             TLPLevelField.TLP_LEVEL_GREEN,
#             TLPLevelField.TLP_LEVEL_AMBER,
#             TLPLevelField.TLP_LEVEL_RED
#         ]
#         super(TLPLevelField, self).__init__(*args, **kwargs)


from flask_modular_auth import AbstractAuthEntity
from mongoengine import StringField, BooleanField, IntField
from werkzeug.security import generate_password_hash, check_password_hash
from bson import ObjectId
from mass_flask_config.app import db, setup_session_auth, auth_manager
from .tlp_level import TLPLevelField
        if self.is_admin:
            roles.append('admin')
        return roles

    def is_authenticated(self):
        return False

    @property
    def is_anonymous(self):
        return self.user_level == UserLevel.USER_LEVEL_ANONYMOUS

    @property
    def is_user(self):
        return self.user_level >= UserLevel.USER_LEVEL_USER

    @property
    def is_privileged(self):
        return self.user_level >= UserLevel.USER_LEVEL_PRIVILEGED

    @property
    def is_manager(self):
        return self.user_level >= UserLevel.USER_LEVEL_MANAGER

    @property
    def is_admin(self):
        return self.user_level >= UserLevel.USER_LEVEL_ADMIN

    @property
    def max_tlp_level(self):
        if self.is_admin:

# Path: mass_flask_config/app.py
# BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECRET_FILE = os.path.join(BASE_DIR, 'secret.txt')
# def setup_session_auth(user_loader):
# def setup_key_based_auth(key_loader):
# def unauthorized_callback():
# 
# Path: mass_flask_core/models/tlp_level.py
# class TLPLevelField(IntField):
#     TLP_LEVEL_WHITE = 0  # Access without login
#     TLP_LEVEL_GREEN = 1  # Access with login
#     TLP_LEVEL_AMBER = 2  # Access only for especially authorized users of same group
#     TLP_LEVEL_RED = 3    # Access only for explicitly mentioned users/groups
# 
#     def __init__(self, *args, **kwargs):
#         kwargs['choices'] = [
#             TLPLevelField.TLP_LEVEL_WHITE,
#             TLPLevelField.TLP_LEVEL_GREEN,
#             TLPLevelField.TLP_LEVEL_AMBER,
#             TLPLevelField.TLP_LEVEL_RED
#         ]
#         super(TLPLevelField, self).__init__(*args, **kwargs)


# Path: mass_flask_core/models/user.py
from flask_modular_auth import AbstractAuthEntity
from mongoengine import StringField, BooleanField, IntField
from werkzeug.security import generate_password_hash, check_password_hash
from bson import ObjectId
from mass_flask_config.app import db, setup_session_auth, auth_manager
from .tlp_level import TLPLevelField

        if self.is_admin:
            roles.append('admin')
        return roles

    def is_authenticated(self):
        return False

    @property
    def is_anonymous(self):
        return self.user_level == UserLevel.USER_LEVEL_ANONYMOUS

    @property
    def is_user(self):
        return self.user_level >= UserLevel.USER_LEVEL_USER

    @property
    def is_privileged(self):
        return self.user_level >= UserLevel.USER_LEVEL_PRIVILEGED

    @property
    def is_manager(self):
        return self.user_level >= UserLevel.USER_LEVEL_MANAGER

    @property
    def is_admin(self):
        return self.user_level >= UserLevel.USER_LEVEL_ADMIN

    @property
    def max_tlp_level(self):
        if self.is_admin:

            return TLPLevelField.TLP_LEVEL_RED