add agent, add ability to delete user/pool, change order of power buttons

This commit is contained in:
Jordan Rodgers 2017-12-18 20:19:57 -05:00
parent 125fd58b27
commit 8161d97f21
7 changed files with 85 additions and 10 deletions

20
app.py
View file

@ -27,6 +27,7 @@ cache = SimpleCache()
def list_vms(user=None):
rtp_view = False
rtp = 'rtp' in session['userinfo']['groups']
active = 'active' in session['userinfo']['groups']
proxmox = connect_proxmox()
if user and not rtp:
return '', 403
@ -45,7 +46,12 @@ def list_vms(user=None):
user = session['userinfo']['preferred_username']
vms = get_vms_for_user(proxmox, user)
return render_template(
'list_vms.html', username=user, rtp=rtp, rtp_view=rtp_view, vms=vms)
'list_vms.html',
username=user,
rtp=rtp,
active=active,
rtp_view=rtp_view,
vms=vms)
@app.route("/isos")
@ -304,6 +310,18 @@ def reset_limits(user):
return '', 403
@app.route('/user/<string:user>/delete', methods=['POST'])
@auth.oidc_auth
def delete_user(user):
if 'rtp' in session['userinfo']['groups']:
proxmox = connect_proxmox()
delete_user_pool(proxmox, user)
cache.delete('vms')
return '', 200
else:
return '', 403
@app.route('/vm/<string:vmid>/rrd/<path:path>')
@auth.oidc_auth
def send_rrd(vmid, path):