def get_users(): start, count = paginate() users = OpenVPNUser.get_all(start, count) total = OpenVPNUser.get_total_nums() total_page = math.ceil(total / count) page = get_page_from_query() return json_res(count=count, page=page, total=total, total_page=total_page, items=users)
def delete_openvpnuser(): form = CreateUserForm().validate_for_api() result = OpenVPNUser.delete_user(form) if result is True: command = ["/usr/local/bin/vpnuser", "del", form.username.data] command = ' '.join(str(d) for d in command) remote_server.onetime_shell(command) return Success(msg='注销成功')
def get_user(vid): user = OpenVPNUser.get_detail(vid) return jsonify(user)
def get_totalusers(): totalusers = OpenVPNUser.get_total_nums() return jsonify(totalusers)