Add minimal admin interface

master
informatic 2018-05-04 13:20:46 +02:00
parent 0c7ffc9a2a
commit c3f185cea6
2 changed files with 21 additions and 1 deletions

9
at.py
View File

@ -15,7 +15,7 @@ from time import sleep, time, mktime
from collections import namedtuple
from urllib import urlencode
from spaceauth import SpaceAuth, login_required, current_user
from spaceauth import SpaceAuth, login_required, current_user, cap_required
app = Flask('at')
app.config.from_pyfile('at.cfg')
@ -356,6 +356,13 @@ def device(id, action):
return redirect(url_for('account'))
@app.route('/admin')
@cap_required('staff')
def admin():
data = now_at()
return render_template('admin.html', data=data)
@app.before_first_request
def setup():
updater = DhcpdUpdater(app.config['LEASE_FILE'], app.config['TIMEOUT'],

13
templates/admin.html Normal file
View File

@ -0,0 +1,13 @@
{% extends "basic.html" %}
{% block content %}
<table class="devices">
<tr>
<th>MAC</th>
<th>Device type</th>
</tr>
{% for key, l in data.items() %}
{% for item in l %}
<tr><td>{{ item }}</td><td>{{ key }}</td></tr>
{% endfor %}
{% endfor %}
{% endblock %}