Browse Source

动态路由

master
牛批的一批 5 years ago
parent
commit
fc3ba617af
  1. 76
      server/jumpserver.py

76
server/jumpserver.py

@ -258,54 +258,34 @@ def userlist():
return do_userlist(request)
@app.route('/jump/user/add', methods=['GET', 'POST'])
def add_user():
return do_add_user(request)
@app.route('/jump/user/del', methods=['GET', 'POST'])
def del_user():
return do_del_user(request)
@app.route('/jump/user/modify', methods=['GET', 'POST'])
def modify_user():
return do_modify_user(request)
@app.route('/jump/user/hosts', methods=['GET', 'POST'])
def userhostlist():
return do_userhostlist(request)
@app.route('/jump/host/add', methods=['GET', 'POST'])
def add_host():
return do_add_host(request)
@app.route('/jump/host/del', methods=['GET', 'POST'])
def del_host():
return do_del_host(request)
@app.route('/jump/host/adduser', methods=['GET', 'POST'])
def host_adduser():
return do_host_adduser(request)
@app.route('/jump/host/deluser', methods=['GET', 'POST'])
def host_deluser():
return do_host_deluser(request)
@app.route('/jump/host/modifyuser', methods=['GET', 'POST'])
def host_modifyuser():
return do_host_modifyuser(request)
@app.route('/jump/host/users', methods=['GET', 'POST'])
def hostuserlist():
return do_hostuserlist(request)
# user动态路由
@app.route('/jump/user/<op>', methods=['GET', 'POST'])
def user_op(op):
if op == "add":
return do_add_user(request)
elif op == "del":
return do_del_user(request)
elif op == "modify":
return do_modify_user(request)
elif op == "hosts":
return do_userhostlist(request)
# host动态路由
@app.route('/jump/host/<op>', methods=['GET', 'POST'])
def host_op(op):
if op == "add":
return do_add_host(request)
elif op == "del":
return do_del_host(request)
elif op == "adduser":
return do_host_adduser(request)
elif op == "deluser":
return do_host_deluser(request)
elif op == "modifyuser":
return do_host_modifyuser(request)
elif op == "users":
return do_hostuserlist(request)
@app.route('/jump/hostuser', methods=['GET', 'POST'])

Loading…
Cancel
Save