def dtu_user_import(filename): """ 将文件中的DTU用户列表导入到系统中 :param filename: :return: """ StrCheck.check_not_null(filename) user_core.dtu_user_import(filename)
def manufacturer_import(filename): """ 将文件中的厂商列表导入到系统中 :param filename: :return: """ StrCheck.check_not_null(filename) user_core.manufacturer_import(filename)
def admin_import(filename): """ 将文件中的管理员列表导入到系统中 :param filename: :return: """ StrCheck.check_not_null(filename) user_core.admin_import(filename)
def manufacturer_export(man_ids, filename): """ 将厂商列表导出到文件中 :param filename: :return: """ StrCheck.check_not_null(filename) user_core.manufacturer_export(man_ids, filename)
def oprlog_export(oprlog_ids, filename): """ 将警报日志导出到文件中 :param oprlog_ids: :param filename: :return: """ StrCheck.check_not_null(filename) core.oprlog_export(oprlog_ids, filename)
def alarmlog_export(alarmlog_ids, filename): """ 将警报日志导出到文件中 :param alarmlog_ids: :param filename: :return: """ StrCheck.check_not_null(filename) core.alarmlog_export(alarmlog_ids, filename)
def systemlog_export(systemlog_ids, filename): """ 将系统日志导出到文件中 :param systemlog_ids: :param filename: :return: """ StrCheck.check_not_null(filename) core.systemlog_export(systemlog_ids, filename)
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)
def admin_export(admin_ids, filename): """ 将管理员导出到文件中 :param admin_ids: :param filename: :return: """ StrCheck.check_not_null(filename) user_core.admin_export(admin_ids, filename)
def get_auth_by_role(role): """ 获取该角色的所有权限 :param role: :return: """ StrCheck.check_not_null(role) authorities = core.get_auth_by_role(role) return authorities
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
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