@classmethod
def ensure_user(cls, email, password, is_internal=False, is_admin=False, is_staff=False, is_researcher=False, is_contributor=True, is_user_manager=False, is_exporter=False, is_active=True, in_beta=False, in_alpha=False, update=False, **kwargs):
    '\n        Create a new user.\n        '
    from app.extensions import db
    user = User.find(email=email)
    if (user is None):
        user = User(password=password, email=email, is_internal=is_internal, is_admin=is_admin, is_staff=is_staff, is_active=is_active, is_researcher=is_researcher, is_contributor=is_contributor, is_user_manager=is_user_manager, is_exporter=is_exporter, in_beta=in_beta, in_alpha=in_alpha, **kwargs)
        with db.session.begin():
            db.session.add(user)
        log.info(('New user created: %r' % (user,)))
    elif update:
        user.password = password
        user.is_internal = is_internal
        user.is_admin = is_admin
        user.is_staff = is_staff
        user.is_researcher = is_researcher
        user.is_contributor = is_contributor
        user.is_user_manager = is_user_manager
        user.is_exporter = is_exporter
        user.is_active = is_active
        user.in_beta = in_beta
        user.in_alpha = in_alpha
        with db.session.begin():
            db.session.merge(user)
        log.info(('Updated user: %r' % (user,)))
    db.session.refresh(user)
    return user
Create a new user.
@classmethod
def ensure_user(cls, email, password, is_internal=False, is_admin=False, is_staff=False, is_researcher=False, is_contributor=True, is_user_manager=False, is_exporter=False, is_active=True, in_beta=False, in_alpha=False, update=False, **kwargs):
    '\n        \n        '
    from app.extensions import db
    user = User.find(email=email)
    if (user is None):
        user = User(password=password, email=email, is_internal=is_internal, is_admin=is_admin, is_staff=is_staff, is_active=is_active, is_researcher=is_researcher, is_contributor=is_contributor, is_user_manager=is_user_manager, is_exporter=is_exporter, in_beta=in_beta, in_alpha=in_alpha, **kwargs)
        with db.session.begin():
            db.session.add(user)
        log.info(('New user created: %r' % (user,)))
    elif update:
        user.password = password
        user.is_internal = is_internal
        user.is_admin = is_admin
        user.is_staff = is_staff
        user.is_researcher = is_researcher
        user.is_contributor = is_contributor
        user.is_user_manager = is_user_manager
        user.is_exporter = is_exporter
        user.is_active = is_active
        user.in_beta = in_beta
        user.in_alpha = in_alpha
        with db.session.begin():
            db.session.merge(user)
        log.info(('Updated user: %r' % (user,)))
    db.session.refresh(user)
    return user