Basic doorlog access
This commit is contained in:
@@ -153,9 +153,24 @@ def view_user_cards_inner(username):
|
|||||||
}).sort([("last_seen", -1)])
|
}).sort([("last_seen", -1)])
|
||||||
return render_template("doorboy_user.html", **locals())
|
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>")
|
@page_doorboy.route("/m/doorboy/log/<username>")
|
||||||
@login_required(groups=["k-space:board", "k-space:kubernetes:admins"])
|
@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)])
|
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 %}
|
{% block content %}
|
||||||
|
|
||||||
<h3>This page only shows Card and Webhook (inventory) opens!</h3>
|
{% if info -%}
|
||||||
<p>Does not include Slack opens. Formats need to be unified. <b>Use #door-log Slack channel Ctrl-f instead!</b></p>
|
<h3>{{ info | safe }}</h3>
|
||||||
|
{%- endif %}
|
||||||
|
<p>Approved means door actually opened. Unapproved opens are failed attempts.</p>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@@ -11,7 +13,9 @@
|
|||||||
<th>Approved</th>
|
<th>Approved</th>
|
||||||
<th>Timestamp</th>
|
<th>Timestamp</th>
|
||||||
<th>Door</th>
|
<th>Door</th>
|
||||||
<th>Who (UID hash)</th>
|
<th>Who</th>
|
||||||
|
<th>Method</th>
|
||||||
|
<th>Method details</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -20,7 +24,13 @@
|
|||||||
<td>{% if o.approved %}<i class="material-icons">check_circle</i>{% else %}no{% endif %}</td>
|
<td>{% if o.approved %}<i class="material-icons">check_circle</i>{% else %}no{% endif %}</td>
|
||||||
<td>{{ o.timestamp | timeago }}</td>
|
<td>{{ o.timestamp | timeago }}</td>
|
||||||
<td>{{ o.door }}</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>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user