Add minimal admin interface
parent
0c7ffc9a2a
commit
c3f185cea6
9
at.py
9
at.py
|
@ -15,7 +15,7 @@ from time import sleep, time, mktime
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from urllib import urlencode
|
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 = Flask('at')
|
||||||
app.config.from_pyfile('at.cfg')
|
app.config.from_pyfile('at.cfg')
|
||||||
|
@ -356,6 +356,13 @@ def device(id, action):
|
||||||
return redirect(url_for('account'))
|
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
|
@app.before_first_request
|
||||||
def setup():
|
def setup():
|
||||||
updater = DhcpdUpdater(app.config['LEASE_FILE'], app.config['TIMEOUT'],
|
updater = DhcpdUpdater(app.config['LEASE_FILE'], app.config['TIMEOUT'],
|
||||||
|
|
|
@ -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 %}
|
Loading…
Reference in New Issue