Ejemplo n.º 1
0
def dtu_user_import(filename):
    """
    将文件中的DTU用户列表导入到系统中
    :param filename:
    :return:
    """
    StrCheck.check_not_null(filename)
    user_core.dtu_user_import(filename)
Ejemplo n.º 2
0
def manufacturer_import(filename):
    """
    将文件中的厂商列表导入到系统中
    :param filename:
    :return:
    """
    StrCheck.check_not_null(filename)
    user_core.manufacturer_import(filename)
Ejemplo n.º 3
0
def admin_import(filename):
    """
    将文件中的管理员列表导入到系统中
    :param filename:
    :return:
    """
    StrCheck.check_not_null(filename)
    user_core.admin_import(filename)
Ejemplo n.º 4
0
def manufacturer_export(man_ids, filename):
    """
    将厂商列表导出到文件中
    :param filename:
    :return:
    """
    StrCheck.check_not_null(filename)
    user_core.manufacturer_export(man_ids, filename)
Ejemplo n.º 5
0
def oprlog_export(oprlog_ids, filename):
    """
    将警报日志导出到文件中
    :param oprlog_ids:
    :param filename:
    :return:
    """
    StrCheck.check_not_null(filename)
    core.oprlog_export(oprlog_ids, filename)
Ejemplo n.º 6
0
def alarmlog_export(alarmlog_ids, filename):
    """
    将警报日志导出到文件中
    :param alarmlog_ids:
    :param filename:
    :return:
    """
    StrCheck.check_not_null(filename)
    core.alarmlog_export(alarmlog_ids, filename)
Ejemplo n.º 7
0
def systemlog_export(systemlog_ids, filename):
    """
    将系统日志导出到文件中
    :param systemlog_ids:
    :param filename:
    :return:
    """
    StrCheck.check_not_null(filename)
    core.systemlog_export(systemlog_ids, filename)
Ejemplo n.º 8
0
def dtu_user_export(dtu_user_ids, filename):
    """
    将DTU用户导出到文件中
    :param dtu_user_ids:
    :param filename:
    :return:
    """
    StrCheck.check_not_null(filename)
    user_core.dtu_user_export(dtu_user_ids, filename)
Ejemplo n.º 9
0
def admin_export(admin_ids, filename):
    """
    将管理员导出到文件中
    :param admin_ids:
    :param filename:
    :return:
    """
    StrCheck.check_not_null(filename)
    user_core.admin_export(admin_ids, filename)
Ejemplo n.º 10
0
def get_auth_by_role(role):
    """
    获取该角色的所有权限
    :param role:
    :return:
    """
    StrCheck.check_not_null(role)

    authorities = core.get_auth_by_role(role)
    return authorities
Ejemplo n.º 11
0
def structure_nav_bars_by_role(role):
    """
    根据角色构造出对应的一二级导航栏
    :param role:
    :return:
    """
    StrCheck.check_not_null(role)

    nav_bars = core.find_nav_bars_by_role(role)
    nav_bars = core.structure_nav_bars(nav_bars)

    return nav_bars
Ejemplo n.º 12
0
def validate_and_get_user(account, password):
    """
    用户校验,校验失败返回None,校验成功返回用户对象
    :return:
    """
    StrCheck.check_is_str(account)
    StrCheck.check_is_str(password)

    user = core.find_user_by_account(account)

    if user is None:
        logger.warning('账号:{},不存在!'.format(account))
        return None

    # 检查用户是否被停用
    if core.check_user_is_forbidden(user):
        raise ForbiddenException("该账号已被禁用,请联系管理员!")

    # 如果密码验证通过
    if core.password_validate(password, user.password):
        return user
    else:
        return None