1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#68: Improved permissions-related error handling

This commit is contained in:
Jeremy Stretch
2016-07-06 17:22:10 -04:00
parent e7f21dea4b
commit 966ea45050
5 changed files with 62 additions and 33 deletions

View File

@@ -1,5 +1,6 @@
{% extends '_base.html' %}
{% load static from staticfiles %}
{% load secret_helpers %}
{% block title %}Secret: {{ secret }}{% endblock %}
@@ -67,28 +68,35 @@
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<strong>Secret Data</strong>
</div>
<div class="panel-body">
<form id="secret_form">
{% csrf_token %}
</form>
<div class="row">
<div class="col-md-2">Secret</div>
<div class="col-md-8" id="secret_{{ secret.pk }}">********</div>
<div class="col-md-2 text-right">
<button class="btn btn-xs btn-success unlock-secret" secret-id="{{ secret.pk }}">
<i class="fa fa-lock"></i> Unlock
</button>
<button class="btn btn-xs btn-danger lock-secret collapse" secret-id="{{ secret.pk }}">
<i class="fa fa-unlock-alt"></i> Lock
</button>
{% if secret|decryptable_by:request.user %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Secret Data</strong>
</div>
<div class="panel-body">
<form id="secret_form">
{% csrf_token %}
</form>
<div class="row">
<div class="col-md-2">Secret</div>
<div class="col-md-8" id="secret_{{ secret.pk }}">********</div>
<div class="col-md-2 text-right">
<button class="btn btn-xs btn-success unlock-secret" secret-id="{{ secret.pk }}">
<i class="fa fa-lock"></i> Unlock
</button>
<button class="btn btn-xs btn-danger lock-secret collapse" secret-id="{{ secret.pk }}">
<i class="fa fa-unlock-alt"></i> Lock
</button>
</div>
</div>
</div>
</div>
</div>
{% else %}
<div class="alert alert-warning">
<i class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></i>
You do not have permission to decrypt this secret.
</div>
{% endif %}
</div>
</div>