{% set page="api_tickets" %}
{% extends 'allura:templates/site_admin.html' %}

{% block content %}
<h1>Special API Tickets</h1>
<p>API Tickets give access to special APIs which should be used under supervision.
</p>

<form name="ticket_form" method="POST">
<table>
<tr>
<td>Username:</td> <td><input name="for_user" type="text" value="{{for_user}}"></td>
</tr>
<tr>
<td>Capabilities (JSON):</td> <td><input name="caps" type="text" value="{{caps}}"></td>
</tr>
<tr>
<td>Expiration date:</td> <td><input name="expires" type="text" value="{{expires}}"></td>
</tr>
<tr>
<td><input type="submit" value="Save"><td>
</tr>
</table>
</form>

<table>
<tr>
<th>Username</th>
<th>Expiration Date</th>
<th>Capabilities</th>
</tr>
{% for token in token_list %}
<tr>
<td>{{token.user.username}}</td>
<td>{{token.expires}}</td>
<td>{{token.capabilities}}</td>
<td></td>
</tr>
<tr>
<td colspan="3">
&nbsp;&nbsp;&nbsp;API Ticket: {{token.api_key}}<br/>
&nbsp;&nbsp;&nbsp;Secret Key: {{token.secret_key}}</td>
</tr>
{% endfor %}
</table>

{% endblock %}
