Basic doorlog access
This commit is contained in:
@@ -153,9 +153,24 @@ def view_user_cards_inner(username):
|
||||
}).sort([("last_seen", -1)])
|
||||
return render_template("doorboy_user.html", **locals())
|
||||
|
||||
#TODO: only returns UID opens, not web or slack
|
||||
@page_doorboy.route("/m/doorboy/log")
|
||||
@login_required(groups=["k-space:board", "k-space:kubernetes:admins"])
|
||||
def doorlog():
|
||||
latest_events = db.doorlog.find({}).sort([("timestamp", -1)])
|
||||
return render_template("doorboy_log.html", latest_events=latest_events)
|
||||
|
||||
|
||||
@page_doorboy.route("/m/doorboy/log/<username>")
|
||||
@login_required(groups=["k-space:board", "k-space:kubernetes:admins"])
|
||||
def view_user_events(username):
|
||||
def doorlog_user(username):
|
||||
if username is None:
|
||||
return redirect("/m/doorboy/log")
|
||||
|
||||
latest_events = db.doorlog.find({"user": username}).sort([("timestamp", -1)])
|
||||
return render_template("doorboy_log.html", latest_events=latest_events)
|
||||
return render_template("doorboy_log.html", latest_events=latest_events, info="Slack users without linked IDs opening from #members appear in <a href=\"/m/doorboy/log/_\">Unlinked users</a>.")
|
||||
|
||||
@page_doorboy.route("/m/doorboy/log/_")
|
||||
@login_required(groups=["k-space:board", "k-space:kubernetes:admins"])
|
||||
def doorlog_unknowns():
|
||||
latest_events = db.doorlog.find({"user": {"$in": [None, ""]}}).sort([("timestamp", -1)])
|
||||
return render_template("doorboy_log.html", latest_events=latest_events, info="Showing opens not linked to kube users.")
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h3>This page only shows Card and Webhook (inventory) opens!</h3>
|
||||
<p>Does not include Slack opens. Formats need to be unified. <b>Use #door-log Slack channel Ctrl-f instead!</b></p>
|
||||
{% if info -%}
|
||||
<h3>{{ info | safe }}</h3>
|
||||
{%- endif %}
|
||||
<p>Approved means door actually opened. Unapproved opens are failed attempts.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
@@ -11,7 +13,9 @@
|
||||
<th>Approved</th>
|
||||
<th>Timestamp</th>
|
||||
<th>Door</th>
|
||||
<th>Who (UID hash)</th>
|
||||
<th>Who</th>
|
||||
<th>Method</th>
|
||||
<th>Method details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -20,7 +24,13 @@
|
||||
<td>{% if o.approved %}<i class="material-icons">check_circle</i>{% else %}no{% endif %}</td>
|
||||
<td>{{ o.timestamp | timeago }}</td>
|
||||
<td>{{ o.door }}</td>
|
||||
<td>{{ o.inventory.owner_id }} (<a href="/m/doorboy/{{ o._id }}/events">{{ o.token.uid_hash[-6:] }})</a></td>
|
||||
<td>{% if o.user %}<a href="log/{{ o.user }}">{{ o.user }}</a>{% endif %}</td>
|
||||
<td>{{ o.method }}</td>
|
||||
<td>{% if o.userExtra %}{% if o.method == "card" -%}
|
||||
{{ o.userExtra[-6:] }}
|
||||
{% else -%}
|
||||
{{ o.userExtra }}
|
||||
{%- endif %}{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user