summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Dobrowolski <admin@tastycode.pl>2018-05-04 13:20:46 +0200
committerPiotr Dobrowolski <admin@tastycode.pl>2018-05-04 13:20:46 +0200
commitc3f185cea6b9d0baf822c0d40cce9991d4c0a354 (patch)
tree8cde52233485990c726cfe93a20beddf59402614
parent0c7ffc9a2ab1d6123e2188c815ba9272f56f5983 (diff)
downloadcheckinator-c3f185cea6b9d0baf822c0d40cce9991d4c0a354.tar.gz
checkinator-c3f185cea6b9d0baf822c0d40cce9991d4c0a354.tar.bz2
checkinator-c3f185cea6b9d0baf822c0d40cce9991d4c0a354.zip
Add minimal admin interface
-rw-r--r--at.py9
-rw-r--r--templates/admin.html13
2 files changed, 21 insertions, 1 deletions
diff --git a/at.py b/at.py
index 05d78a0..6839c60 100644
--- a/at.py
+++ b/at.py
@@ -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'],
diff --git a/templates/admin.html b/templates/admin.html
new file mode 100644
index 0000000..c2fcb4b
--- /dev/null
+++ b/templates/admin.html
@@ -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 %}