| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- {% extends 'users/_user.html' %}
- {% load helpers %}
- {% block title %}API Tokens{% endblock %}
- {% block usercontent %}
- <div class="row">
- <div class="col-md-12">
- {% for token in tokens %}
- <div class="panel panel-{% if token.is_expired %}danger{% else %}default{% endif %}">
- <div class="panel-heading">
- <div class="pull-right noprint">
- {% if perms.users.change_token %}
- <a href="{% url 'user:token_edit' pk=token.pk %}" class="btn btn-xs btn-warning">Edit</a>
- {% endif %}
- {% if perms.users.delete_token %}
- <a href="{% url 'user:token_delete' pk=token.pk %}" class="btn btn-xs btn-danger">Delete</a>
- {% endif %}
- </div>
- <i class="fa fa-key"></i> {{ token.key }}
- {% if token.is_expired %}
- <span class="label label-danger">Expired</span>
- {% endif %}
- </div>
- <div class="panel-body">
- <div class="row">
- <div class="col-md-4">
- <span title="{{ token.created }}">{{ token.created|date }}</span><br />
- <small class="text-muted">Created</small>
- </div>
- <div class="col-md-4">
- {% if token.expires %}
- <span title="{{ token.expires }}">{{ token.expires|date }}</span><br />
- {% else %}
- <span>Never</span><br />
- {% endif %}
- <small class="text-muted">Expires</small>
- </div>
- <div class="col-md-4">
- {% if token.write_enabled %}
- <span class="label label-success">Enabled</span>
- {% else %}
- <span class="label label-danger">Disabled</span>
- {% endif %}<br />
- <small class="text-muted">Create/edit/delete operations</small>
- </div>
- </div>
- {% if token.description %}
- <br /><span>{{ token.description }}</span>
- {% endif %}
- </div>
- </div>
- {% empty %}
- <p>You do not have any API tokens.</p>
- {% endfor %}
- {% if perms.users.add_token %}
- <a href="{% url 'user:token_add' %}" class="btn btn-primary">
- <span class="fa fa-plus" aria-hidden="true"></span>
- Add a token
- </a>
- {% else %}
- <div class="alert alert-info text-center" role="alert">
- You do not have permission to create new API tokens. If needed, ask an administrator to enable token creation for your account or an assigned group.
- </div>
- {% endif %}
- </div>
- </div>
- {% endblock %}
|