ui: rewrite admin templates to pf4, add some helper scripts

This commit is contained in:
Jens Langhammer 2020-02-21 14:20:16 +01:00
parent 8fd86a28ff
commit ea6a1422f7
26 changed files with 1063 additions and 956 deletions

View File

@ -3,44 +3,65 @@
{% load i18n %} {% load i18n %}
{% load utils %} {% load utils %}
{% block title %}
{% title %}
{% endblock %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="pficon-applications"></span> {% trans "Applications" %}</h1> <div class="pf-c-content">
<span>{% trans "External Applications which use passbook as Identity-Provider, utilizing protocols like OAuth2 and SAML." %}</span> <h1>
<hr> <i class="pf-icon pf-icon-applications"></i>
<a href="{% url 'passbook_admin:application-create' %}?back={{ request.get_full_path }}" class="btn btn-primary"> {% trans 'Applications' %}
{% trans 'Create...' %} </h1>
</a> <p>{% trans "External Applications which use passbook as Identity-Provider, utilizing protocols like OAuth2 and SAML." %}</p>
<hr> </div>
<table class="table table-striped table-bordered"> </section>
<thead> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<tr> <div class="pf-c-card">
<th>{% trans 'Name' %}</th> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
<th>{% trans 'Provider' %}</th> <div class="pf-c-toolbar__action-group">
<th>{% trans 'Provider Type' %}</th> <a href="{% url 'passbook_admin:application-create' %}?back={{ request.get_full_path }}" class="pf-c-button pf-m-primary" type="button">{% trans 'Create' %}</a>
<th></th> </div>
</tr> {% include 'partials/pagination.html' %}
</thead> </div>
<tbody> <table class="pf-c-table pf-m-grid-xl" role="grid">
{% for application in object_list %} <thead>
<tr> <tr role="row">
<td>{{ application.name }}</td> <th role="columnheader" scope="col">{% trans 'Name' %}</th>
<td>{{ application.get_provider }}</td> <th role="columnheader" scope="col">{% trans 'Provider' %}</th>
<td>{{ application.get_provider|verbose_name }}</td> <th role="columnheader" scope="col">{% trans 'Provider Type' %}</th>
<td> <th role="cell"></th>
<a class="btn btn-default btn-sm" </tr>
href="{% url 'passbook_admin:application-update' pk=application.uuid %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> </thead>
<a class="btn btn-default btn-sm" <tbody role="rowgroup">
href="{% url 'passbook_admin:application-delete' pk=application.uuid %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> {% for application in object_list %}
</td> <tr role="row">
</tr> <th role="columnheader">
{% endfor %} <div>
</tbody> <div>{{ application.name }}</div>
</table> {% if application.meta_publisher %}
{% include 'partials/pagination.html' %} <small>{{ application.meta_publisher }}</small>
</div> {% endif %}
</div>
</th>
<td role="cell">
<span>
{{ application.get_provider }}
</span>
</td>
<td role="cell">
<span>
{{ application.get_provider|verbose_name }}
</span>
</td>
<td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:application-update' pk=application.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:application-delete' pk=application.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -3,85 +3,66 @@
{% load i18n %} {% load i18n %}
{% load utils %} {% load utils %}
{% block title %}
{% title %}
{% endblock %}
{% block content %} {% block content %}
<h1><span class="pficon-catalog"></span> {% trans "Audit Log" %}</h1> <section class="pf-c-page__main-section pf-m-light">
<div id="pf-list-standard" class="list-group list-view-pf list-view-pf-view"> <div class="pf-c-content">
{% for entry in object_list %} <h1>
<div class="list-group-item"> <i class="pf-icon pf-icon-catalog"></i>
<div class="list-view-pf-main-info"> {% trans 'Audit Log' %}
<div class="list-view-pf-left"> </h1>
<span class="fa fa-plane list-view-pf-icon-sm"></span> </div>
</div> </section>
<div class="list-view-pf-body"> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<div class="list-view-pf-description"> <div class="pf-c-card">
<div class="list-group-item-heading"> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
{{ entry.action }} {% include 'partials/pagination.html' %}
</div> </div>
<div class="list-group-item-text"> <table class="pf-c-table pf-m-grid-xl" role="grid">
{{ entry.context }} <thead>
</div> <tr role="row">
</div> <th role="columnheader" scope="col">{% trans 'Action' %}</th>
<div class="list-view-pf-additional-info"> <th role="columnheader" scope="col">{% trans 'Context' %}</th>
<div class="list-view-pf-additional-info-item"> <th role="columnheader" scope="col">{% trans 'User' %}</th>
<span class="pficon pficon-user"></span> <th role="columnheader" scope="col">{% trans 'Creation Date' %}</th>
<strong>{{ entry.user }}</strong> <th role="columnheader" scope="col">{% trans 'Client IP' %}</th>
</div> </tr>
<div class="list-view-pf-additional-info-item"> </thead>
<span class="pficon pficon-cluster"></span> <tbody role="rowgroup">
<strong>{{ entry.app|default:'-' }}</strong> {% for entry in object_list %}
</div> <tr role="row">
<div class="list-view-pf-additional-info-item"> <th role="columnheader">
<span class="fa fa-clock-o"></span> <div>
<strong>{{ entry.created }}</strong> <div>{{ entry.action }}</div>
</div> <small>{{ entry.app|default:'-' }}</small>
<div class="list-view-pf-additional-info-item"> </div>
<span class="pficon pficon-screen"></span> </th>
<strong>{{ entry.request_ip }}</strong> <td role="cell">
</div> <span>
</div> {{ entry.context }}
</div> </span>
</td>
<td role="cell">
<span>
{{ entry.user }}
</span>
</td>
<td role="cell">
<span>
{{ entry.created }}
</span>
</td>
<td role="cell">
<span>
{{ entry.client_ip }}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div> </div>
</div> </div>
{% endfor %} </section>
<script>
$(document).ready(function () {
// Row Checkbox Selection
$("#pf-list-standard input[type='checkbox']").change(function (e) {
if ($(this).is(":checked")) {
$(this).closest('.list-group-item').addClass("active");
} else {
$(this).closest('.list-group-item').removeClass("active");
}
});
// toggle dropdown menu
$('#pf-list-standard .list-view-pf-actions').on('show.bs.dropdown', function () {
var $this = $(this);
var $dropdown = $this.find('.dropdown');
var space = $(window).height() - $dropdown[0].getBoundingClientRect().top - $this.find('.dropdown-menu').outerHeight(true);
$dropdown.toggleClass('dropup', space < 10);
});
// allow users to select multiple list items with shift key
$('#pf-list-standard .list-group').on('click', '.list-view-pf-checkbox>input', function (event) {
var $list = $('.list-group');
var prevIndex = $list.data('preIndex');
var $listItems = $list.children('.list-group-item');
var $currentItem = $(this).closest('.list-group-item');
if (event.shiftKey && prevIndex > -1 && this.checked) {
var currentIndex = $listItems.index($currentItem);
var $selectScope = currentIndex - prevIndex > 0
? $currentItem.prevAll().not($listItems.eq(prevIndex).prevAll().addBack())
: $listItems.eq(prevIndex).prevAll().not($currentItem.prevAll().addBack());
$selectScope.addClass('active').find('.list-view-pf-checkbox').children('input').prop('checked', true);
}
$list.data('preIndex', this.checked ? $listItems.index($currentItem) : -1);
});
});
</script>
{% include 'partials/pagination.html' %}
</div>
{% endblock %} {% endblock %}

View File

@ -3,29 +3,34 @@
{% load i18n %} {% load i18n %}
{% load utils %} {% load utils %}
{% block title %}
{% title %}
{% endblock %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="pficon-applications"></span> {% trans "Request" %}</h1> <div class="pf-c-content">
<hr> <h1>
<table class="table table-striped table-bordered"> <i class="pf-icon pf-icon-applications"></i>
<thead> {% trans 'Request' %}
<tr> </h1>
<th>{% trans 'Key' %}</th> </div>
<th>{% trans 'Value' %}</th> </section>
</tr> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
</thead> <div class="pf-c-card">
<tbody> <table class="pf-c-table pf-m-grid-xl" role="grid">
{% for key, value in request_dict.items %} <thead>
<tr> <tr role="row">
<td>{{ key }}</td> <th role="columnheader" scope="col" style="min-width: 150px;">{% trans 'Key' %}</th>
<td>{{ value }}</td> <th role="columnheader" scope="col">{% trans 'Value' %}</th>
</tr> </tr>
{% endfor %} </thead>
</tbody> <tbody role="rowgroup">
</table> {% for key, value in request_dict.items %}
<tr role="row">
<td role="cell">{{ key }}</td>
<td role="cell">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -4,60 +4,80 @@
{% load utils %} {% load utils %}
{% load admin_reflection %} {% load admin_reflection %}
{% block title %}
{% title %}
{% endblock %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="pficon-plugged"></span> {% trans "Factors" %}</h1> <div class="pf-c-content">
<span>{% trans "Factors required for a user to successfully authenticate." %}</span> <h1>
<hr> <i class="pf-icon pf-icon-plugged"></i>
<div class="dropdown"> {% trans 'Factors' %}
<button class="btn btn-primary dropdown-toggle" type="button" id="createDropdown" data-toggle="dropdown"> </h1>
{% trans 'Create...' %} <p>{% trans "Factors required for a user to successfully authenticate." %}
<span class="caret"></span> </p>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="createDropdown">
{% for type, name in types.items %}
<li role="presentation"><a role="menuitem" tabindex="-1"
href="{% url 'passbook_admin:factor-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a></li>
{% endfor %}
</ul>
</div> </div>
<hr> </section>
<table class="table table-striped table-bordered"> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<thead> <div class="pf-c-card">
<tr> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
<th>{% trans 'Name' %}</th> <div class="pf-c-toolbar__action-group">
<th>{% trans 'Type' %}</th> <div class="pf-c-dropdown">
<th>{% trans 'Order' %}</th> <button class="pf-m-primary pf-c-dropdown__toggle" type="button">
<th>{% trans 'Enabled?' %}</th> <span class="pf-c-dropdown__toggle-text">{% trans 'Create' %}</span>
<th></th> <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
</tr> </button>
</thead> <ul class="pf-c-dropdown__menu" hidden>
<tbody> {% for type, name in types.items %}
{% for factor in object_list %} <li>
<tr> <a class="pf-c-dropdown__menu-item" href="{% url 'passbook_admin:factor-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a>
<td>{{ factor.name }} ({{ factor.slug }})</td> </li>
<td>{{ factor|verbose_name }}</td> {% endfor %}
<td>{{ factor.order }}</td> </ul>
<td>{{ factor.enabled }}</td> </div>
<td> </div>
<a class="btn btn-default btn-sm" {% include 'partials/pagination.html' %}
href="{% url 'passbook_admin:factor-update' pk=factor.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> </div>
<a class="btn btn-default btn-sm" <table class="pf-c-table pf-m-grid-xl" role="grid">
href="{% url 'passbook_admin:factor-delete' pk=factor.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> <thead>
{% get_links factor as links %} <tr role="row">
{% for name, href in links.items %} <th role="columnheader" scope="col">{% trans 'Name' %}</th>
<a class="btn btn-default btn-sm" <th role="columnheader" scope="col">{% trans 'Order' %}</th>
href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a> <th role="columnheader" scope="col">{% trans 'Enabled' %}</th>
{% endfor %} <th role="cell"></th>
</td> </tr>
</tr> </thead>
{% endfor %} <tbody role="rowgroup">
</tbody> {% for factor in object_list %}
</table> <tr role="row">
{% include 'partials/pagination.html' %} <th role="columnheader">
</div> <div>
<div>{{ factor.name }} ({{ factor.slug }})</div>
<small>{{ factor|verbose_name }}</small>
</div>
</th>
<td role="cell">
<span>
{{ factor.order }}
</span>
</td>
<td role="cell">
<span>
{{ factor.enabled }}
</span>
</td>
<td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:factor-update' pk=factor.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:factor-delete' pk=factor.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
{% get_links factor as links %}
{% for name, href in links.items %}
<a class="pf-c-button pf-m-tertiary" href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a>
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -3,44 +3,64 @@
{% load i18n %} {% load i18n %}
{% load utils %} {% load utils %}
{% block title %}
{% title %}
{% endblock %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="pficon-users"></span> {% trans "Groups" %}</h1> <div class="pf-c-content">
<span>{% trans "Group users together and give them permissions based on the membership." %}</span> <h1>
<hr> <i class="pf-icon pf-icon-users"></i>
<a href="{% url 'passbook_admin:group-create' %}?back={{ request.get_full_path }}" class="btn btn-primary"> {% trans 'Groups' %}
{% trans 'Create...' %} </h1>
</a> <p>{% trans "Group users together and give them permissions based on the membership." %}
<hr> </p>
<table class="table table-striped table-bordered"> </div>
<thead> </section>
<tr> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<th>{% trans 'Name' %}</th> <div class="pf-c-card">
<th>{% trans 'Parent' %}</th> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
<th>{% trans 'Members' %}</th> <div class="pf-c-toolbar__action-group">
<th></th> <a href="{% url 'passbook_admin:group-create' %}?back={{ request.get_full_path }}"
</tr> class="pf-c-button pf-m-primary" type="button">{% trans 'Create' %}</a>
</thead> </div>
<tbody> {% include 'partials/pagination.html' %}
{% for group in object_list %} </div>
<tr> <table class="pf-c-table pf-m-grid-xl" role="grid">
<td>{{ group.name }}</td> <thead>
<td>{{ group.parent }}</td> <tr role="row">
<td>{{ group.user_set.all|length }}</td> <th role="columnheader" scope="col">{% trans 'Name' %}</th>
<td> <th role="columnheader" scope="col">{% trans 'Parent' %}</th>
<a class="btn btn-default btn-sm" <th role="columnheader" scope="col">{% trans 'Members' %}</th>
href="{% url 'passbook_admin:group-update' pk=group.uuid %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> <th role="cell"></th>
<a class="btn btn-default btn-sm" </tr>
href="{% url 'passbook_admin:group-delete' pk=group.uuid %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> </thead>
</td> <tbody role="rowgroup">
</tr> {% for group in object_list %}
{% endfor %} <tr role="row">
</tbody> <td role="cell">
</table> <span>
{% include 'partials/pagination.html' %} {{ group.name }}
</div> </span>
</td>
<td role="cell">
<span>
{{ group.parent }}
</span>
</td>
<td role="cell">
<span>
{{ group.user_set.all|length }}
</span>
</td>
<td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:group-update' pk=group.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:group-delete' pk=group.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -3,42 +3,57 @@
{% load i18n %} {% load i18n %}
{% load utils %} {% load utils %}
{% block title %}
{% title %}
{% endblock %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="pficon-migration"></span> {% trans "Invitations" %}</h1> <div class="pf-c-content">
<span>{% trans "Create Invitation Links which optionally force a username or expire on a set date." %}</span> <h1>
<hr> <i class="pf-icon pf-icon-migration"></i>
<a href="{% url 'passbook_admin:invitation-create' %}?back={{ request.get_full_path }}" class="btn btn-primary"> {% trans 'Invitations' %}
{% trans 'Create...' %} </h1>
</a> <p>{% trans "Create Invitation Links to enroll Users, and optionally force a username or expire on a set date." %}
<hr> </p>
<table class="table table-striped table-bordered"> </div>
<thead> </section>
<tr> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<th>{% trans 'Expiry' %}</th> <div class="pf-c-card">
<th>{% trans 'Link' %}</th> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
<th></th> <div class="pf-c-toolbar__action-group">
</tr> <a href="{% url 'passbook_admin:invitation-create' %}?back={{ request.get_full_path }}"
</thead> class="pf-c-button pf-m-primary" type="button">{% trans 'Create' %}</a>
<tbody> </div>
{% for invitation in object_list %} {% include 'partials/pagination.html' %}
<tr> </div>
<td>{{ invitation.expires|default:"Never" }}</td> <table class="pf-c-table pf-m-grid-xl" role="grid">
<td> <thead>
<pre>{{ invitation.link }}</pre> <tr role="row">
</td> <th role="columnheader" scope="col">{% trans 'Expiry' %}</th>
<td> <th role="columnheader" scope="col">{% trans 'Link' %}</th>
<a class="btn btn-default btn-sm" <th role="cell"></th>
href="{% url 'passbook_admin:invitation-delete' pk=invitation.uuid %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> </tr>
</td> </thead>
</tr> <tbody role="rowgroup">
{% endfor %} {% for invitation in object_list %}
</tbody> <tr role="row">
</table> <td role="cell">
{% include 'partials/pagination.html' %} <span>
</div> {{ invitation.expiry }}
</span>
</td>
<td role="cell">
<span>
{{ invitation.Link }}
</span>
</td>
<td>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:invitation-delete' pk=invitation.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -3,224 +3,177 @@
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content">
<h1>{% trans 'System Overview' %}</h1>
</div>
</section>
<section class="pf-c-page__main-section"> <section class="pf-c-page__main-section">
<div class="pf-l-gallery pf-m-gutter"> <div class="pf-l-gallery pf-m-gutter">
<a href="{% url 'passbook_admin:applications' %}" class="pf-c-card pf-m-hoverable pf-m-compact" id="card-1"> <a href="{% url 'passbook_admin:applications' %}" class="pf-c-card pf-m-hoverable pf-m-compact">
<div class="pf-c-card__head"> <div class="pf-c-card__head">
<i class="pf-icon pf-icon-applications"></i> {% trans 'Applications' %} <div class="pf-c-card__head-main">
<i class="pf-icon pf-icon-applications"></i> {% trans 'Applications' %}
</div>
</div> </div>
<div class="pf-c-card__body"> <div class="pf-c-card__body">
<i class="pf-icon pf-icon-ok"></i> {{ application_count }} <i class="pf-icon pf-icon-ok"></i> {{ application_count }}
</div> </div>
</a> </a>
<a href="{% url 'passbook_admin:sources' %}" class="pf-c-card pf-m-hoverable pf-m-compact" id="card-1"> <a href="{% url 'passbook_admin:sources' %}" class="pf-c-card pf-m-hoverable pf-m-compact">
<div class="pf-c-card__head"> <div class="pf-c-card__head">
<i class="pf-icon pf-icon-resource-pool"></i> {% trans 'Sources' %} <div class="pf-c-card__head-main">
<i class="pf-icon pf-icon-middleware"></i> {% trans 'Sources' %}
</div>
</div> </div>
<div class="pf-c-card__body"> <div class="pf-c-card__body">
<i class="pf-icon pf-icon-ok"></i> {{ source_count }} <i class="pf-icon pf-icon-ok"></i> {{ source_count }}
</div> </div>
</a> </a>
<a href="{% url 'passbook_admin:providers' %}" class="pf-c-card pf-m-hoverable pf-m-compact" id="card-1"> <a href="{% url 'passbook_admin:providers' %}" class="pf-c-card pf-m-hoverable pf-m-compact">
<div class="pf-c-card__head"> <div class="pf-c-card__head">
<i class="pf-icon pf-icon-plugged"></i> {% trans 'Providers' %} <div class="pf-c-card__head-main">
<i class="pf-icon pf-icon-plugged"></i> {% trans 'Providers' %}
</div>
</div> </div>
<div class="pf-c-card__body"> <div class="pf-c-card__body">
{% if providers_without_application.exists %} {% if providers_without_application.exists %}
<i class="pf-icon pf-icon-warning-triangle"></i> {{ provider_count }} <i class="pf-icon pf-icon-warning-triangle"></i> {{ provider_count }}
<div class="pf-c-tooltip pf-m-top" role="tooltip"> <p>{% trans 'Warning: At least one Provider has no application assigned.' %}</p>
<div class="pf-c-tooltip__arrow"></div>
<div class="pf-c-tooltip__content" id="tooltip-top-content">
{% trans 'Warning: At least one Provider has no application assigned.' %}
</div>
</div>
{% else %} {% else %}
<i class="pf-icon pf-icon-ok"></i> {{ provider_count }} <i class="pf-icon pf-icon-ok"></i> {{ provider_count }}
{% endif %} {% endif %}
</div> </div>
</a> </a>
</div>
</section> <a href="{% url 'passbook_admin:factors' %}" class="pf-c-card pf-m-hoverable pf-m-compact">
<div class="col-xs-6 col-sm-2 col-md-2"> <div class="pf-c-card__head">
<div class="card-pf card-pf-accented card-pf-aggregate-status"> <div class="pf-c-card__head-main">
<h2 class="card-pf-title"> <i class="pf-icon pf-icon-plugged"></i> {% trans 'Factors' %}
<a href="{% url 'passbook_admin:factors' %}"> </div>
<span class="pficon-plugged"></span> </div>
<span class="card-pf-aggregate-status-count"></span> {% trans 'Factors' %} <div class="pf-c-card__body">
</a> {% if factor_count < 1 %}
</h2> <i class="pficon-error-circle-o"></i> {{ factor_count }}
<div class="card-pf-body"> <p>{% trans 'No Factors configured. No Users will be able to login.' %}"></p>
<p class="card-pf-aggregate-status-notifications"> {% else %}
<span class="card-pf-aggregate-status-notification"> <i class="pf-icon pf-icon-ok"></i> {{ factor_count }}
{% if factor_count < 1 %} {% endif %}
<span class="pficon-error-circle-o" data-toggle="tooltip" data-placement="right" </div>
title="{% trans 'No Factors configured. No Users will be able to login.' %}"></span> </a>
{{ factor_count }}
{% else %} <a href="{% url 'passbook_admin:policies' %}" class="pf-c-card pf-m-hoverable pf-m-compact">
<i class="pf-icon pf-icon-ok"></i>{{ factor_count }} <div class="pf-c-card__head">
{% endif %} <div class="pf-c-card__head-main">
</span> <i class="pf-icon pf-icon-infrastructure"></i> {% trans 'Policies' %}
</p> </div>
</div>
<div class="pf-c-card__body">
{% if policies_without_binding %}
<i class="pf-icon pf-icon-warning-triangle"></i> {{ policy_count }}
<p>{% trans 'Policies without binding exist.' %}</p>
{% else %}
<i class="pf-icon pf-icon-ok"></i> {{ policy_count }}
{% endif %}
</div>
</a>
<a href="{% url 'passbook_admin:invitations' %}" class="pf-c-card pf-m-hoverable pf-m-compact">
<div class="pf-c-card__head">
<div class="pf-c-card__head-main">
<i class="pf-icon pf-icon-migration"></i> {% trans 'Invitation' %}
</div>
</div>
<div class="pf-c-card__body">
<i class="pf-icon pf-icon-ok"></i> {{ invitation_count }}
</div>
</a>
<a href="{% url 'passbook_admin:users' %}" class="pf-c-card pf-m-hoverable pf-m-compact">
<div class="pf-c-card__head">
<div class="pf-c-card__head-main">
<i class="pf-icon pf-icon-user"></i> {% trans 'Users' %}
</div>
</div>
<div class="pf-c-card__body">
<i class="pf-icon pf-icon-ok"></i> {{ user_count }}
</div>
</a>
<div class="pf-c-card pf-m-hoverable pf-m-compact">
<div class="pf-c-card__head">
<div class="pf-c-card__head-main">
<i class="pf-icon pf-icon-bundle"></i> {% trans 'Version' %}
</div>
</div>
<div class="pf-c-card__body">
<i class="pf-icon pf-icon-ok"></i> {{ version }}
</div> </div>
</div> </div>
</div>
<div class="col-xs-6 col-sm-2 col-md-2"> <div class="pf-c-card pf-m-hoverable pf-m-compact">
<div class="card-pf card-pf-accented card-pf-aggregate-status"> <div class="pf-c-card__head">
<h2 class="card-pf-title"> <div class="pf-c-card__head-main">
<a href="{% url 'passbook_admin:policies' %}"> <i class="pf-icon pf-icon-server"></i> {% trans 'Workers' %}
<span class="pficon-infrastructure"></span> </div>
<span class="card-pf-aggregate-status-count"></span> {% trans 'Policies' %} </div>
</a> <div class="pf-c-card__body">
</h2> {% if worker_count < 1 %}
<div class="card-pf-body"> <i class="pf-icon pf-icon-warning-triangle"></i> {{ worker_count }}
<p class="card-pf-aggregate-status-notifications"> <p>{% trans 'No workers connected.' %}</p>
<span class="card-pf-aggregate-status-notification"> {% else %}
{% if policies_without_attachment > 0 %} <i class="pf-icon pf-icon-ok"></i> {{ worker_count }}
<span class="pficon-warning-triangle-o" data-toggle="tooltip" data-placement="right" {% endif %}
title="{% trans 'Policies without attachment exist.' %}"></span>
{{ policy_count }}
{% else %}
<i class="pf-icon pf-icon-ok"></i>{{ policy_count }}
{% endif %}
</span>
</p>
</div> </div>
</div> </div>
</div>
<div class="col-xs-6 col-sm-2 col-md-2"> <a class="pf-c-card pf-m-hoverable pf-m-compact" data-target="modal" data-modal="clearCacheModalRoot">
<div class="card-pf card-pf-accented card-pf-aggregate-status"> <div class="pf-c-card__head">
<h2 class="card-pf-title"> <div class="pf-c-card__head-main">
<a href="{% url 'passbook_admin:invitations' %}"> <i class="pf-icon pf-icon-server"></i> {% trans 'Cached Policies' %}
<span class="pficon-migration"></span> </div>
<span class="card-pf-aggregate-status-count"></span> {% trans 'Invitation' %}
</a>
</h2>
<div class="card-pf-body">
<p class="card-pf-aggregate-status-notifications">
<span class="card-pf-aggregate-status-notification">
<a href="{% url 'passbook_admin:invitations' %}">
<i class="pf-icon pf-icon-ok"></i>{{ invitation_count }}
</a>
</span>
</p>
</div> </div>
</div> <div class="pf-c-card__body">
</div> {% if cached_policies < 1 %}
<div class="col-xs-6 col-sm-2 col-md-2"> <i class="pf-icon pf-icon-warning-triangle"></i> {{ cached_policies }}
<div class="card-pf card-pf-accented card-pf-aggregate-status"> <p>{% trans 'No policies cached. Users may experience slow response times.' %}</p>
<h2 class="card-pf-title"> {% else %}
<a href="{% url 'passbook_admin:users' %}"> <i class="pf-icon pf-icon-ok"></i> {{ cached_policies }}
<span class="pficon-users"></span> {% endif %}
<span class="card-pf-aggregate-status-count"></span> {% trans 'Users' %}
</a>
</h2>
<div class="card-pf-body">
<p class="card-pf-aggregate-status-notifications">
<span class="card-pf-aggregate-status-notification">
<a href="{% url 'passbook_admin:users' %}">
<i class="pf-icon pf-icon-ok"></i>{{ user_count }}
</a>
</span>
</p>
</div> </div>
</div> </a>
</div> </section>
<div class="col-xs-6 col-sm-2 col-md-2">
<div class="card-pf card-pf-accented card-pf-aggregate-status">
<h2 class="card-pf-title">
<span class="pficon-bundle"></span>
<span class="card-pf-aggregate-status-count"></span> {% trans 'Version' %}
</h2>
<div class="card-pf-body">
<p class="card-pf-aggregate-status-notifications">
<span class="card-pf-aggregate-status-notification">
<a href="#">
{{ version }}
</a>
</span>
</p>
</div>
</div>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<div class="card-pf card-pf-accented card-pf-aggregate-status">
<h2 class="card-pf-title">
<a href="#">
<span class="pficon-server"></span>
<span class="card-pf-aggregate-status-count"></span> {% trans 'Worker(s)' %}
</a>
</h2>
<div class="card-pf-body">
<p class="card-pf-aggregate-status-notifications">
<span class="card-pf-aggregate-status-notification">
<a href="#">
{% if worker_count < 1%}
<span class="pficon-warning-triangle-o" data-toggle="tooltip" data-placement="right"
title="{% trans 'No workers connected.' %}"></span> {{ worker_count }}
{% else %}
<i class="pf-icon pf-icon-ok"></i>{{ worker_count }}
{% endif %}
</a>
</span>
</p>
</div>
</div>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<div class="card-pf card-pf-accented card-pf-aggregate-status">
<h2 class="card-pf-title">
<span class="pficon-server"></span>
<span class="card-pf-aggregate-status-count"></span> {% trans 'Cached Policies' %}
</h2>
<div class="card-pf-body">
<p class="card-pf-aggregate-status-notifications">
<span class="card-pf-aggregate-status-notification">
<a href="#" data-toggle="modal" data-target="#clearCacheMOdal">
{% if cached_policies < 1 %}
<span class="pficon-warning-triangle-o" data-toggle="tooltip" data-placement="right"
title="{% trans 'No policies cached. Users may experience slow response times.' %}"></span> {{ cached_policies }}
{% else %}
<i class="pf-icon pf-icon-ok"></i>{{ cached_policies }}
{% endif %}
</a>
</span>
</p>
</div>
</div>
</div>
</div> </div>
<div class="modal fade" id="clearCacheMOdal" tabindex="-1" role="dialog" aria-labelledby="clearCacheMOdalLabel" aria-hidden="true"> <div class="pf-c-backdrop" id="clearCacheModalRoot" hidden>
<div class="modal-dialog"> <div class="pf-l-bullseye">
<div class="modal-content"> <div class="pf-c-modal-box pf-m-sm" role="dialog">
<div class="modal-header"> <button data-modal-close class="pf-c-button pf-m-plain" type="button" aria-label="Close dialog">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"> <i class="fas fa-times" aria-hidden="true"></i>
<span class="pficon pficon-close"></span> </button>
</button> <h1 class="pf-c-title pf-m-2xl" id="modal-title">{% trans 'Clear Cache' %}?</h1>
<h4 class="modal-title" id="clearCacheMOdalLabel">{% trans 'Clear Cache' %}</h4> <div class="pf-c-modal-box__body" id="modal-description">
</div> <form method="post" id="clearForm">
<div class="modal-body"> {% csrf_token %}
<form method="post" id="clearForm"> <input type="hidden" name="clear">
{% csrf_token %} <p>
<input type="hidden" name="clear"> {% blocktrans %}
<p> Are you sure you want to clear the cache? This includes all user sessions and all cached Policy results.
{% blocktrans %} {% endblocktrans %}
Are you sure you want to clear the cache? This includes all user sessions and all cached Policy results. </p>
{% endblocktrans %} <h3>
</p> {% blocktrans %}
<h3> This will also log you out.
{% blocktrans %} {% endblocktrans %}
This will also log you out. </h3>
{% endblocktrans %} </form>
</h3> </div>
</form> <footer class="pf-c-modal-box__footer pf-m-align-left">
</div> <button form="clearForm" class="pf-c-button pf-m-primary" type="submit">{% trans 'Clear' %}</button>
<div class="modal-footer"> <button data-modal-close class="pf-c-button pf-m-link" type="button">{% trans 'Cancel' %}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> </footer>
<button form="clearForm" type="submit" type="button" class="btn btn-danger">{% trans 'Clear' %}</button> </div>
</div>
</div> </div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -3,61 +3,76 @@
{% load i18n %} {% load i18n %}
{% load utils %} {% load utils %}
{% block title %}
{% title %}
{% endblock %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="pficon-infrastructure"></span> {% trans "Policies" %}</h1> <div class="pf-c-content">
<span>{% trans "Allow users to use Applications based on properties, enforce Password Criteria and selectively apply Factors." %}</span> <h1>
<hr> <i class="pf-icon pf-icon-infrastructure"></i>
<div class="dropdown"> {% trans 'Policies' %}
<button class="btn btn-primary dropdown-toggle" type="button" id="createDropdown" data-toggle="dropdown"> </h1>
{% trans 'Create...' %} <p>{% trans "Allow users to use Applications based on properties, enforce Password Criteria and selectively apply Factors." %}</p>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="createDropdown">
{% for type, name in types.items %}
<li role="presentation"><a role="menuitem" tabindex="-1"
href="{% url 'passbook_admin:policy-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a></li>
{% endfor %}
</ul>
</div> </div>
<hr> </section>
<table class="table table-striped table-bordered"> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<thead> <div class="pf-c-card">
<tr> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
<th></th> <div class="pf-c-toolbar__action-group">
<th>{% trans 'Name' %}</th> <div class="pf-c-dropdown">
<th>{% trans 'Type' %}</th> <button class="pf-m-primary pf-c-dropdown__toggle" type="button">
<th></th> <span class="pf-c-dropdown__toggle-text">{% trans 'Create' %}</span>
</tr> <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
</thead> </button>
<tbody> <ul class="pf-c-dropdown__menu" hidden>
{% for policy in object_list %} {% for type, name in types.items %}
<tr {% if not policy.policymodel_set.exists %} class="warning" {% endif %}> <li>
<th> <a class="pf-c-dropdown__menu-item" href="{% url 'passbook_admin:policy-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a>
{% if not policy.policymodel_set.exists %} </li>
<span class="pficon-warning-triangle-o" data-toggle="tooltip" data-placement="right" title="{% trans 'Warning: Policy is not assigned.' %}"></span> {% endfor %}
{% else %} </ul>
<span class="pficon-ok" data-toggle="tooltip" data-placement="right" title="{% blocktrans with objects=policy.policymodel_set.all|join:', ' %}Assigned to objects {{ objects }}{% endblocktrans %}"></span> </div>
{% endif %} </div>
</th> {% include 'partials/pagination.html' %}
<td>{{ policy.name }}</td> </div>
<td>{{ policy|verbose_name }}</td> <table class="pf-c-table pf-m-grid-xl" role="grid">
<td> <thead>
<a class="btn btn-default btn-sm" <tr role="row">
href="{% url 'passbook_admin:policy-update' pk=policy.uuid %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> <th role="columnheader" scope="col">{% trans 'Name' %}</th>
<a class="btn btn-default btn-sm" <th role="columnheader" scope="col">{% trans 'Type' %}</th>
href="{% url 'passbook_admin:policy-test' pk=policy.uuid %}?back={{ request.get_full_path }}">{% trans 'Test' %}</a> <th role="cell"></th>
<a class="btn btn-default btn-sm" </tr>
href="{% url 'passbook_admin:policy-delete' pk=policy.uuid %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> </thead>
</td> <tbody role="rowgroup">
</tr> {% for policy in object_list %}
{% endfor %} <tr role="row">
</tbody> <th role="columnheader">
</table> <div>
{% include 'partials/pagination.html' %} <div>{{ policy.name }}</div>
</div> {% if not policy.policymodel_set.exists %}
<i class="pf-icon pf-icon-warning-triangle"></i>
<small>{% trans 'Warning: Policy is not assigned.' %}</small>
{% else %}
<i class="pf-icon pf-icon-ok"></i>
<small>{% blocktrans with objects=policy.policymodel_set.all|join:', ' %}Assigned to objects {{ objects }}{% endblocktrans %}</small>
{% endif %}
</div>
</th>
<td role="cell">
<span>
{{ policy|verbose_name }}
</span>
</td>
<td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:policy-update' pk=policy.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-tertiary" href="{% url 'passbook_admin:policy-test' pk=policy.pk %}?back={{ request.get_full_path }}">{% trans 'Test' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:policy-delete' pk=policy.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -3,51 +3,70 @@
{% load i18n %} {% load i18n %}
{% load utils %} {% load utils %}
{% block title %}
{% title %}
{% endblock %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="fa fa-table"></span> {% trans "Property Mappings" %}</h1> <div class="pf-c-content">
<span>{% trans "Property Mappings allow you expose provider-specific attributes." %}</span> <h1>
<hr> <i class="pf-icon pf-icon-blueprint"></i>
<div class="dropdown"> {% trans 'Property Mappings' %}
<button class="btn btn-primary dropdown-toggle" type="button" id="createDropdown" data-toggle="dropdown"> </h1>
{% trans 'Create...' %} <p>{% trans "Control how passbook exposes and interprets information." %}
<span class="caret"></span> </p>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="createDropdown">
{% for type, name in types.items %}
<li role="presentation"><a role="menuitem" tabindex="-1"
href="{% url 'passbook_admin:property-mapping-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a></li>
{% endfor %}
</ul>
</div> </div>
<hr> </section>
<table class="table table-striped table-bordered"> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<thead> <div class="pf-c-card">
<tr> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
<th>{% trans 'Name' %}</th> <div class="pf-c-toolbar__action-group">
<th>{% trans 'Type' %}</th> <div class="pf-c-dropdown">
<th></th> <button class="pf-m-primary pf-c-dropdown__toggle" type="button">
</tr> <span class="pf-c-dropdown__toggle-text">{% trans 'Create' %}</span>
</thead> <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
<tbody> </button>
{% for property_mapping in object_list %} <ul class="pf-c-dropdown__menu" hidden>
<tr> {% for type, name in types.items %}
<td>{{ property_mapping.name }}</td> <li>
<td>{{ property_mapping|verbose_name }}</td> <a class="pf-c-dropdown__menu-item"
<td> href="{% url 'passbook_admin:property-mapping-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a>
<a class="btn btn-default btn-sm" </li>
href="{% url 'passbook_admin:property-mapping-update' pk=property_mapping.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> {% endfor %}
<a class="btn btn-default btn-sm" </ul>
href="{% url 'passbook_admin:property-mapping-delete' pk=property_mapping.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> </div>
</td> </div>
</tr> {% include 'partials/pagination.html' %}
{% endfor %} </div>
</tbody> <table class="pf-c-table pf-m-grid-xl" role="grid">
</table> <thead>
{% include 'partials/pagination.html' %} <tr role="row">
</div> <th role="columnheader" scope="col">{% trans 'Name' %}</th>
<th role="columnheader" scope="col">{% trans 'Type' %}</th>
<th role="cell"></th>
</tr>
</thead>
<tbody role="rowgroup">
{% for property_mapping in object_list %}
<tr role="row">
<td role="cell">
<span>
{{ property_mapping.name }}
</span>
</td>
<td role="cell">
<span>
{{ property_mapping|verbose_name }}
</span>
</td>
<td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:property-mapping-update' pk=property_mapping.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:property-mapping-delete' pk=property_mapping.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -4,68 +4,88 @@
{% load utils %} {% load utils %}
{% load admin_reflection %} {% load admin_reflection %}
{% block title %}
{% title %}
{% endblock %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="pficon-integration"></span> {% trans "Providers" %}</h1> <div class="pf-c-content">
<span>{% trans "Authentication Protocol Provider, used as Protocol behind an Application." %}</span> <h1>
<hr> <i class="pf-icon pf-icon-integration"></i>
<div class="dropdown"> {% trans 'Providers' %}
<button class="btn btn-primary dropdown-toggle" type="button" id="createDropdown" data-toggle="dropdown"> </h1>
{% trans 'Create...' %} <p>{% trans "Provide support for protocols like SAML and OAuth to assigned applications." %}
<span class="caret"></span> </p>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="createDropdown">
{% for type, name in types.items %}
<li role="presentation"><a role="menuitem" tabindex="-1"
href="{% url 'passbook_admin:provider-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a></li>
{% endfor %}
</ul>
</div> </div>
<hr> </section>
<table class="table table-striped table-bordered"> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<thead> <div class="pf-c-card">
<tr> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
<th></th> <div class="pf-c-toolbar__action-group">
<th>{% trans 'Name' %}</th> <div class="pf-c-dropdown">
<th>{% trans 'Type' %}</th> <button class="pf-m-primary pf-c-dropdown__toggle" type="button">
<th></th> <span class="pf-c-dropdown__toggle-text">{% trans 'Create' %}</span>
</tr> <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
</thead> </button>
<tbody> <ul class="pf-c-dropdown__menu" hidden>
{% for provider in object_list %} {% for type, name in types.items %}
<tr {% if not provider.application %} class="warning" {% endif %}> <li>
<th> <a class="pf-c-dropdown__menu-item" href="{% url 'passbook_admin:provider-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a>
{% if not provider.application %} </li>
<span class="pficon-warning-triangle-o" data-toggle="tooltip" data-placement="right" title="{% trans 'Warning: Provider has no application assigned.' %}"></span> {% endfor %}
{% else %} </ul>
<span class="pficon-ok" data-toggle="tooltip" data-placement="right" title="{% blocktrans with app=provider.application %}Assigned to Application {{ app }}{% endblocktrans %}"></span> </div>
{% endif %} </div>
</th> {% include 'partials/pagination.html' %}
<td>{{ provider.name }}</td> </div>
<td>{{ provider|verbose_name }}</td> <table class="pf-c-table pf-m-grid-xl" role="grid">
<td> <thead>
<a class="btn btn-default btn-sm" <tr role="row">
href="{% url 'passbook_admin:provider-update' pk=provider.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> <th role="columnheader" scope="col">{% trans 'Name' %}</th>
<a class="btn btn-default btn-sm" <th role="columnheader" scope="col">{% trans 'Type' %}</th>
href="{% url 'passbook_admin:provider-delete' pk=provider.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> <th role="cell"></th>
{% get_links provider as links %} </tr>
{% for name, href in links.items %} </thead>
<a class="btn btn-default btn-sm" <tbody role="rowgroup">
href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a> {% for provider in object_list %}
{% endfor %} <tr role="row">
{% get_htmls provider as htmls %} <th role="columnheader">
{% for html in htmls %} <div>
{{ html|safe }} <div>{{ provider.name }}</div>
{% endfor %} {% if not provider.application %}
</td> <i class="pf-icon pf-icon-warning-triangle"></i>
</tr> <small>{% trans 'Warning: Provider not assigned to any application.' %}</small>
{% endfor %} {% else %}
</tbody> <i class="pf-icon pf-icon-ok"></i>
</table> <small>
{% include 'partials/pagination.html' %} {% blocktrans with app=provider.application %}
</div> Assigned to application {{ app }}.
{% endblocktrans %}
</small>
{% endif %}
</div>
</th>
<td role="cell">
<span>
{{ provider|verbose_name }}
</span>
</td>
<td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:provider-update' pk=provider.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:provider-delete' pk=provider.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
{% get_links provider as links %}
{% for name, href in links.items %}
<a class="pf-c-button pf-m-tertiary" href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a>
{% endfor %}
{% get_htmls provider as htmls %}
{% for html in htmls %}
{{ html|safe }}
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -5,53 +5,81 @@
{% load admin_reflection %} {% load admin_reflection %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="pficon-resource-pool"></span> {% trans "Sources" %}</h1> <div class="pf-c-content">
<span>{% trans "External Sources which can be used to get Identities into passbook, for example Social Providers like Twiter and GitHub or Enterprise Providers like ADFS and LDAP." %}</span> <h1>
<hr> <i class="pf-icon pf-icon-middleware"></i>
<div class="dropdown"> {% trans 'Source' %}
<button class="btn btn-primary dropdown-toggle" type="button" id="createDropdown" data-toggle="dropdown"> </h1>
{% trans 'Create...' %} <p>{% trans "External Sources which can be used to get Identities into passbook, for example Social Providers like Twiter and GitHub or Enterprise Providers like ADFS and LDAP." %}
<span class="caret"></span> </p>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="createDropdown">
{% for type, name in types.items %}
<li role="presentation"><a role="menuitem" tabindex="-1"
href="{% url 'passbook_admin:source-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a></li>
{% endfor %}
</ul>
</div> </div>
<hr> </section>
<table class="table table-striped table-bordered"> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<thead> <div class="pf-c-card">
<tr> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
<th>{% trans 'Name' %}</th> <div class="pf-c-toolbar__action-group">
<th>{% trans 'Class' %}</th> <div class="pf-c-dropdown">
<th>{% trans 'Additional Info' %}</th> <button class="pf-m-primary pf-c-dropdown__toggle" type="button">
<th></th> <span class="pf-c-dropdown__toggle-text">{% trans 'Create' %}</span>
</tr> <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
</thead> </button>
<tbody> <ul class="pf-c-dropdown__menu" hidden>
{% for source in object_list %} {% for type, name in types.items %}
<tr> <li>
<td>{{ source.name }}</td> <a class="pf-c-dropdown__menu-item" href="{% url 'passbook_admin:source-create' %}?type={{ type }}&back={{ request.get_full_path }}">{{ name }}</a>
<td>{{ source|fieldtype }}</td> </li>
<td>{{ source.ui_additional_info|safe|default:"" }}</td> {% endfor %}
<td> </ul>
<a class="btn btn-default btn-sm" </div>
href="{% url 'passbook_admin:source-update' pk=source.uuid %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> </div>
<a class="btn btn-default btn-sm" {% include 'partials/pagination.html' %}
href="{% url 'passbook_admin:source-delete' pk=source.uuid %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> </div>
{% get_links source as links %} <table class="pf-c-table pf-m-grid-xl" role="grid">
{% for name, href in links %} <thead>
<a class="btn btn-default btn-sm" <tr role="row">
href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a> <th role="columnheader" scope="col">{% trans 'Name' %}</th>
{% endfor %} <th role="columnheader" scope="col">{% trans 'Type' %}</th>
</td> <th role="columnheader" scope="col">{% trans 'Additional Info' %}</th>
</tr> <th role="cell"></th>
{% endfor %} </tr>
</tbody> </thead>
</table> <tbody role="rowgroup">
{% include 'partials/pagination.html' %} {% for source in object_list %}
</div> <tr role="row">
<th role="columnheader">
<div>
<div>{{ source.name }}</div>
{% if not source.enabled %}
<small>{% trans 'Disabled' %}</small>
{% endif %}
</div>
</th>
<td role="cell">
<span>
{{ source|fieldtype }}
</span>
</td>
<td role="cell">
<span>
{{ source.ui_additional_info|default:""|safe }}
</span>
</td>
<td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:source-update' pk=source.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:source-delete' pk=source.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
{% get_links source as links %}
{% for name, href in links %}
<a class="pf-c-button pf-m-tertiary" href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a>
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -4,44 +4,63 @@
{% load utils %} {% load utils %}
{% block content %} {% block content %}
<div class="container"> <section class="pf-c-page__main-section pf-m-light">
<h1><span class="pficon-users"></span> {% trans "Users" %}</h1> <div class="pf-c-content">
<hr> <h1>
<a href="{% url 'passbook_admin:user-create' %}?back={{ request.get_full_path }}" class="btn btn-primary"> <i class="pf-icon pf-icon-user"></i>
{% trans 'Create...' %} {% trans 'Users' %}
</a> </h1>
<hr> </div>
<table class="table table-striped table-bordered"> </section>
<thead> <section class="pf-c-page__main-section pf-m-no-padding-mobile">
<tr> <div class="pf-c-card">
<th>{% trans 'Username' %}</th> <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
<th>{% trans 'Name' %}</th> <div class="pf-c-toolbar__action-group">
<th>{% trans 'Active' %}</th> <a href="{% url 'passbook_admin:user-create' %}?back={{ request.get_full_path }}" class="pf-c-button pf-m-primary" type="button">{% trans 'Create' %}</a>
<th>{% trans 'Last Login' %}</th> </div>
<th></th> {% include 'partials/pagination.html' %}
</tr> </div>
</thead> <table class="pf-c-table pf-m-grid-xl" role="grid">
<tbody> <thead>
{% for user in object_list %} <tr role="row">
<tr> <th role="columnheader" scope="col">{% trans 'Name' %}</th>
<td>{{ user.username }}</td> <th role="columnheader" scope="col">{% trans 'Active' %}</th>
<td>{{ user.name|default:'-' }}</td> <th role="columnheader" scope="col">{% trans 'Last Login' %}</th>
<td>{{ user.is_active }}</td> <th role="cell"></th>
<td>{{ user.last_login }}</td> </tr>
<td> </thead>
<a class="btn btn-default btn-sm" <tbody role="rowgroup">
href="{% url 'passbook_admin:user-update' pk=user.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> {% for user in object_list %}
<a class="btn btn-default btn-sm" <tr role="row">
href="{% url 'passbook_admin:user-delete' pk=user.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> <th role="columnheader">
<a class="btn btn-default btn-sm" <div>
href="{% url 'passbook_admin:user-password-reset' pk=user.pk %}?back={{ request.get_full_path }}">{% trans 'Reset Password' %}</a> <div>{{ user.username }}</div>
<a class="btn btn-default btn-sm" <small>{{ user.name }}</small>
href="{% url 'passbook_core:overview' %}?__impersonate={{ user.pk }}">{% trans 'Impersonate' %}</a> </div>
</td> </th>
</tr> <td role="cell">
{% endfor %} <span>
</tbody> {{ user.is_active }}
</table> </span>
{% include 'partials/pagination.html' %} </td>
</div> <td role="cell">
<span>
{{ user.last_login }}
</span>
</td>
<td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:user-update' pk=user.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:user-delete' pk=user.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
<a class="pf-c-button pf-m-tertiary" href="{% url 'passbook_admin:user-password-reset' pk=user.pk %}?back={{ request.get_full_path }}">{% trans 'Reset Password' %}</a>
<a class="pf-c-button pf-m-tertiary" href="{% url 'passbook_core:overview' %}?__impersonate={{ user.pk }}">{% trans 'Impersonate' %}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
{% include 'partials/pagination.html' %}
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -42,7 +42,7 @@ class AdministrationOverviewView(AdminRequiredMixin, TemplateView):
kwargs["providers_without_application"] = Provider.objects.filter( kwargs["providers_without_application"] = Provider.objects.filter(
application=None application=None
) )
kwargs["policies_without_attachment"] = len( kwargs["policies_without_binding"] = len(
Policy.objects.filter(policymodel__isnull=True) Policy.objects.filter(policymodel__isnull=True)
) )
kwargs["cached_policies"] = len(cache.keys("policy_*")) kwargs["cached_policies"] = len(cache.keys("policy_*"))

View File

@ -3,49 +3,33 @@
{% load utils %} {% load utils %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="layout-pf layout-pf-fixed transitions">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>
{% block title %}
{% title %}
{% endblock %}
</title>
<link rel="icon" type="image/png" href="{% static 'img/logo.png' %}">
<link rel="shortcut icon" type="image/png" href="{% static 'img/logo.png' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/patternfly.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/patternfly-additions.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/passbook.css' %}">
<style>
.login-pf {
background-attachment: fixed;
scroll-behavior: smooth;
background-size: cover;
}
</style>
{% block head %}
{% endblock %}
</head>
<body {% if is_login %} class="login-pf" {% endif %}>
{% if 'impersonate_id' in request.session %}
<div class="experimental-pf-bar">
<span id="experimentalBar" class="experimental-pf-text">
{% blocktrans with user=user %}You're currently impersonating {{ user }}.{% endblocktrans %}
<a href="?__unimpersonate=True" id="acceptMessage">{% trans 'Stop impersonation' %}</a>
</span>
</div>
{% endif %}
{% block body %}
{% endblock %}
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/patternfly.min.js' %}"></script>
<script src="{% static 'js/passbook.js' %}"></script>
{% block scripts %}
{% endblock %}
</body>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{% block title %}{% title %}{% endblock %}</title>
<link rel="icon" type="image/png" href="{% static 'passbook/logo.png' %}">
<link rel="shortcut icon" type="image/png" href="{% static 'passbook/logo.png' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly-addons.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'passbook/pf.css' %}">
{% block head %}
{% endblock %}
</head>
<body>
{% if 'impersonate_id' in request.session %}
<div class="experimental-pf-bar">
<span id="experimentalBar" class="experimental-pf-text">
{% blocktrans with user=user %}You're currently impersonating {{ user }}.{% endblocktrans %}
<a href="?__unimpersonate=True" id="acceptMessage">{% trans 'Stop impersonation' %}</a>
</span>
</div>
{% endif %}
{% block body %}
{% endblock %}
{% block scripts %}
{% endblock %}
<script src="{% static 'passbook/pf.js' %}"></script>
</body>
</html> </html>

View File

@ -1,33 +0,0 @@
{% load static %}
{% load i18n %}
{% load utils %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{% block title %}{% title %}{% endblock %}</title>
<link rel="icon" type="image/png" href="{% static 'passbook/logo.png' %}">
<link rel="shortcut icon" type="image/png" href="{% static 'passbook/logo.png' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly-addons.css' %}">
{% block head %}
{% endblock %}
</head>
<body>
{% if 'impersonate_id' in request.session %}
<div class="experimental-pf-bar">
<span id="experimentalBar" class="experimental-pf-text">
{% blocktrans with user=user %}You're currently impersonating {{ user }}.{% endblocktrans %}
<a href="?__unimpersonate=True" id="acceptMessage">{% trans 'Stop impersonation' %}</a>
</span>
</div>
{% endif %}
{% block body %}
{% endblock %}
{% block scripts %}
{% endblock %}
</body>
</html>

View File

@ -1,4 +1,4 @@
{% extends 'base/skeleton_pf4.html' %} {% extends 'base/skeleton.html' %}
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}

View File

@ -1,4 +1,4 @@
{% extends "base/skeleton_pf4.html" %} {% extends "base/skeleton.html" %}
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
@ -123,16 +123,3 @@
</main> </main>
</div> </div>
{% endblock %} {% endblock %}
{% block scripts %}
{{ block.super }}
<script>
$(document).ready(function () {
// initialize tooltips
$('[data-toggle="tooltip"]').tooltip();
// Initialize the vertical navigation
$().setupVerticalNavigation(true);
});
</script>
{% endblock %}

View File

@ -14,7 +14,10 @@
{% block content %} {% block content %}
<section class="pf-c-page__main-section pf-m-light"> <section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content"> <div class="pf-c-content">
<h1>{% trans 'Applications' %}</h1> <h1>
<i class="pf-icon pf-icon-applications"></i>
{% trans 'Applications' %}
</h1>
</div> </div>
</section> </section>
<section class="pf-c-page__main-section"> <section class="pf-c-page__main-section">

View File

@ -1,22 +1,43 @@
{% load i18n %} {% load i18n %}
<div class="btn-group"> <div class="pf-c-pagination">
{% with param=get_param|default:'page' %} <div class="pf-c-pagination__total-items">
{% if page_obj.has_previous %} <b>{{ page_obj.start_index }} - {{ page_obj.end_index }}</b>of
<a class="btn btn-default" href="?{{ param }}={{ page_obj.previous_page_number }}"><span class="fa fa-angle-left"></span></a> <b>{{ page_obj.count }}</b>
{% else %} </div>
<a class="btn btn-default disabled" href=""><span class="fa fa-angle-left"></span></a> {% with param=get_param|default:'page' %}
{% endif %} <nav class="pf-c-pagination__nav" aria-label="Pagination">
<span class="btn btn-default"> <a class="pf-c-button pf-m-plain" type="button" aria-label="Go to first page"
{% blocktrans with current=page_obj.number total=page_obj.paginator.num_pages %} href="?{{ param }}=1">
Page {{ current }} of {{ total }} <i class="fas fa-angle-double-left" aria-hidden="true"></i>
{% endblocktrans %} </a>
</span> <a class="pf-c-button pf-m-plain" type="button" aria-label="Go to previous page"
{% if page_obj.has_next %} {% if page_obj.has_previous %}
<a class="btn btn-default" href="?{{ param }}={{ page_obj.next_page_number }}"><span class="fa fa-angle-right"></span></a> href="?{{ param }}={{ page_obj.previous_page_number }}"
{% else %} {% else %}
<a class="btn btn-default disabled" href=""><span class="fa fa-angle-right"></span></a> disabled
{% endif %} {% endif %}>
{% endwith %} <i class="fas fa-angle-left" aria-hidden="true"></i>
</a>
<div class="pf-c-pagination__nav-page-select">
<span>
{% blocktrans with current=page_obj.number total=page_obj.paginator.num_pages %}
{{ current }} of {{ total }}
{% endblocktrans %}
</span>
</div>
<a class="pf-c-button pf-m-plain" type="button" aria-label="Go to next page"
{% if page_obj.has_next %}
href="?{{ param }}={{ page_obj.next_page_number }}"
{% else %}
disabled
{% endif %}>
<i class="fas fa-angle-right" aria-hidden="true"></i>
</a>
<a class="pf-c-button pf-m-plain" type="button" aria-label="Go to last page"
href="?{{ param }}={{ page_obj.num_pages }}">
<i class="fas fa-angle-double-right" aria-hidden="true"></i>
</a>
</nav>
{% endwith %}
</div> </div>
<hr>

View File

@ -0,0 +1,15 @@
version: "3.5"
services:
passbook_gatekeeper:
container_name: gatekeeper
image: beryju/passbook-gatekeeper:{{ version }}
ports:
- 4180:4180
environment:
OAUTH2_PROXY_CLIENT_ID: {{ provider.client.client_id }}
OAUTH2_PROXY_CLIENT_SECRET: {{ provider.client.client_secret }}
OAUTH2_PROXY_REDIRECT_URL: https://{{ provider.external_host }}/oauth2/callback
OAUTH2_PROXY_OIDC_ISSUER_URL: https://{{ request.META.HTTP_HOST }}/application/oidc
OAUTH2_PROXY_COOKIE_SECRET: {{ cookie_secret }}
OAUTH2_PROXY_UPSTREAMS: http://{{ provider.internal_host }}

View File

@ -55,7 +55,7 @@ metadata:
namespace: kube-system namespace: kube-system
spec: spec:
rules: rules:
- host: {{ provider.host }} - host: {{ provider.external_host }}
http: http:
paths: paths:
- backend: - backend:

View File

@ -7,84 +7,71 @@
<link rel="stylesheet" href="{% static 'codemirror/theme/monokai.css' %}"> <link rel="stylesheet" href="{% static 'codemirror/theme/monokai.css' %}">
<script src="{% static 'codemirror/mode/yaml/yaml.js' %}"></script> <script src="{% static 'codemirror/mode/yaml/yaml.js' %}"></script>
<div class="dropdown" style="display: inline-block;"> <div class="pf-c-dropdown">
<button class="btn btn-default btn-sm dropdown-toggle" type="button" id="setupDropdown-{{ provider.pk }}" data-toggle="dropdown"> <button class="pf-c-button pf-m-tertiary pf-c-dropdown__toggle" type="button">
{% trans 'Setup with...' %} <span class="pf-c-dropdown__toggle-text">{% trans 'Setup with...' %}</span>
<span class="caret"></span> <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
</button> </button>
<ul class="dropdown-menu" role="menu" aria-labelledby="setupDropdown-{{ provider.pk }}"> <ul class="pf-c-dropdown__menu" hidden>
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#docker-compose-{{ provider.pk }}">{% trans 'docker-compose' %}</a></li> <li>
<li role="presentation"><a role="menuitem" data-toggle="modal" data-target="#k8s-{{ provider.pk }}">{% trans 'Kubernetes' %}</a></li> <button class="pf-c-dropdown__menu-item" data-target="modal" data-modal="docker-compose-{{ provider.pk }}">{% trans 'docker-compose' %}</button>
</li>
<li>
<button class="pf-c-dropdown__menu-item" data-target="modal" data-modal="k8s-{{ provider.pk }}">{% trans 'Kubernetes' %}</button>
</li>
</ul> </ul>
</div> </div>
<div class="modal fade" id="docker-compose-{{ provider.pk }}" tabindex="-1" role="dialog" aria-labelledby="{{ provider.pk }}Label" aria-hidden="true"> <div class="pf-c-backdrop" id="docker-compose-{{ provider.pk }}" hidden>
<div class="modal-dialog modal-lg"> <div class="pf-l-bullseye">
<div class="modal-content"> <div class="pf-c-modal-box pf-m-lg" role="dialog">
<div class="modal-header"> <button data-modal-close class="pf-c-button pf-m-plain" type="button" aria-label="Close dialog">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" aria-label="Close"> <i class="fas fa-times" aria-hidden="true"></i>
<span class="pficon pficon-close"></span> </button>
</button> <h1 class="pf-c-title pf-m-2xl">{% trans 'Setup with docker-compose' %}</h1>
<h4 class="modal-title" id="{{ provider.pk }}Label">{% trans 'Setup with docker-compose' %}</h4> <div class="pf-c-modal-box__body">
</div> {% trans 'Add the following snippet to your docker-compose file.' %}
<div class="modal-body"> <textarea class="codemirror">{% include 'app_gw/docker-compose.yml' %}</textarea>
{% trans 'Add the following snippet to your docker-compose file.' %} </div>
<textarea class="codemirror">version: "3.5" <footer class="pf-c-modal-box__footer pf-m-align-left">
<button data-modal-close class="pf-c-button pf-m-primary" type="button">{% trans 'Close' %}</button>
services: </footer>
passbook_gatekeeper: </div>
container_name: gatekeeper
image: beryju/passbook-gatekeeper:{{ version }}
ports:
- 4180:4180
environment:
OAUTH2_PROXY_CLIENT_ID: {{ provider.client.client_id }}
OAUTH2_PROXY_CLIENT_SECRET: {{ provider.client.client_secret }}
OAUTH2_PROXY_REDIRECT_URL: https://{{ provider.external_host }}/oauth2/callback
OAUTH2_PROXY_OIDC_ISSUER_URL: https://{{ request.META.HTTP_HOST }}/application/oidc
OAUTH2_PROXY_COOKIE_SECRET: {{ cookie_secret }}
OAUTH2_PROXY_UPSTREAMS: http://{{ provider.internal_host }}</textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">{% trans 'Close' %}</button>
</div>
</div> </div>
</div>
</div> </div>
<div class="modal fade" id="k8s-{{ provider.pk }}" tabindex="-1" role="dialog" aria-labelledby="{{ provider.pk }}Label" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="pf-c-backdrop" id="k8s-{{ provider.pk }}" hidden>
<div class="modal-content"> <div class="pf-l-bullseye">
<div class="modal-header"> <div class="pf-c-modal-box pf-m-lg" role="dialog">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" aria-label="Close"> <button data-modal-close class="pf-c-button pf-m-plain" type="button" aria-label="Close dialog">
<span class="pficon pficon-close"></span> <i class="fas fa-times" aria-hidden="true"></i>
</button> </button>
<h4 class="modal-title" id="{{ provider.pk }}Label">{% trans 'Setup with Kubernetes' %}</h4> <h1 class="pf-c-title pf-m-2xl">{% trans 'Setup with Kubernetes' %}</h1>
</div> <div class="pf-c-modal-box__body">
<div class="modal-body"> <p>{% trans 'Download the manifest to create the Gatekeeper deployment and service:' %}</p>
<p>{% trans 'Download the manifest to create the Gatekeeper deployment and service:' %}</p> <a href="{% url 'passbook_providers_app_gw:k8s-manifest' provider=provider.pk %}">{% trans 'Here' %}</a>
<a href="{% url 'passbook_providers_app_gw:k8s-manifest' provider=provider.pk %}">{% trans 'Here' %}</a> <p>{% trans 'Afterwards, add the following annotations to the Ingress you want to secure:' %}</p>
<p>{% trans 'Afterwards, add the following annotations to the Ingress you want to secure:' %}</p> <textarea class="codemirror">
<textarea class="codemirror"> nginx.ingress.kubernetes.io/auth-url: "https://{{ provider.external_host }}/oauth2/auth"
nginx.ingress.kubernetes.io/auth-url: "https://{{ provider.host }}/oauth2/auth" nginx.ingress.kubernetes.io/auth-signin: "https://{{ provider.external_host }}/oauth2/start?rd=$escaped_request_uri"
nginx.ingress.kubernetes.io/auth-signin: "https://{{ provider.host }}/oauth2/start?rd=$escaped_request_uri" </textarea>
</textarea> </div>
</div> <footer class="pf-c-modal-box__footer pf-m-align-left">
<div class="modal-footer"> <button data-modal-close class="pf-c-button pf-m-primary" type="button">{% trans 'Close' %}</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">{% trans 'Close' %}</button> </footer>
</div> </div>
</div> </div>
</div>
</div> </div>
<script> <script>
let attributes = document.getElementsByClassName('codemirror'); let attributes = document.getElementsByClassName('codemirror');
for (let attrib of attributes) { for (let attrib of attributes) {
let myCodeMirror = CodeMirror.fromTextArea(attrib, { let myCodeMirror = CodeMirror.fromTextArea(attrib, {
mode: 'yaml', mode: 'yaml',
theme: 'monokai', theme: 'monokai',
lineNumbers: false, lineNumbers: false,
readOnly: true, readOnly: true,
autoRefresh: true, autoRefresh: true,
}); });
} }
</script> </script>

View File

@ -1,49 +1,46 @@
{% load i18n %} {% load i18n %}
<button class="btn btn-default btn-sm" data-toggle="modal" data-target="#{{ provider.pk }}">{% trans 'View Setup URLs' %}</button> <button class="pf-c-button pf-m-tertiary" data-target="modal" data-modal="provider-{{ provider.pk }}">{% trans 'View Setup URLs' %}</button>
<div class="modal fade" id="{{ provider.pk }}" tabindex="-1" role="dialog" aria-labelledby="{{ provider.pk }}Label" aria-hidden="true">
<div class="modal-dialog"> <div class="pf-c-backdrop" id="provider-{{ provider.pk }}" hidden>
<div class="modal-content"> <div class="pf-l-bullseye">
<div class="modal-header"> <div class="pf-c-modal-box pf-m-sm" role="dialog">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" aria-label="Close"> <button data-modal-close class="pf-c-button pf-m-plain" type="button" aria-label="Close dialog">
<span class="pficon pficon-close"></span> <i class="fas fa-times" aria-hidden="true"></i>
</button> </button>
<h4 class="modal-title" id="{{ provider.pk }}Label">{% trans 'Setup URLs' %}</h4> <h1 class="pf-c-title pf-m-2xl" id="modal-title">{% trans 'Setup URLs' %}</h1>
</div> <div class="pf-c-modal-box__body" id="modal-description">
<div class="modal-body"> <form class="pf-c-form">
<form class="form-horizontal"> <div class="pf-c-form__group">
<div class="form-group"> <label class="pf-c-form__label" for="help-text-simple-form-name">
<label class="col-sm-3 control-label">{% trans 'Authorize URL' %}</label> <span class="pf-c-form__label-text">{% trans 'Authorize URL' %}</span>
<div class="col-sm-9"> </label>
<input type="text"class="form-control" readonly value="{{ authorize }}"> <input class="pf-c-form-control" readonly type="text" value="{{ authorize }}" />
</div>
<div class="pf-c-form__group">
<label class="pf-c-form__label" for="help-text-simple-form-name">
<span class="pf-c-form__label-text">{% trans 'Token URL' %}</span>
</label>
<input class="pf-c-form-control" readonly type="text" value="{{ token }}" />
</div>
<div class="pf-c-form__group">
<label class="pf-c-form__label" for="help-text-simple-form-name">
<span class="pf-c-form__label-text">{% trans 'Userinfo Endpoint' %}</span>
</label>
<input class="pf-c-form-control" readonly type="text" value="{{ userinfo }}" />
</div>
<hr>
<div class="pf-c-form__group">
<label class="pf-c-form__label" for="help-text-simple-form-name">
<span class="pf-c-form__label-text">{% trans 'OpenID Configuration URL' %}</span>
</label>
<input class="pf-c-form-control" readonly type="text" value="{{ provider_info }}" />
</div>
</form>
</div> </div>
</div> <footer class="pf-c-modal-box__footer pf-m-align-left">
<div class="form-group"> <button data-modal-close class="pf-c-button pf-m-primary" type="button">{% trans 'Close' %}</button>
<label class="col-sm-3 control-label">{% trans 'Token URL' %}</label> </footer>
<div class="col-sm-9"> </div>
<input type="text" class="form-control" readonly value="{{ token }}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{% trans 'Userinfo Endpoint' %}</label>
<div class="col-sm-9">
<input type="text" class="form-control" readonly value="{{ userinfo }}">
</div>
</div>
</form>
<hr>
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">{% trans 'OpenID Configuration URL' %}</label>
<div class="col-sm-9">
<input type="text"class="form-control" readonly value="{{ provider_info }}">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">{% trans 'Close' %}</button>
</div>
</div> </div>
</div>
</div> </div>

View File

@ -7,35 +7,35 @@
<link rel="stylesheet" href="{% static 'codemirror/theme/monokai.css' %}"> <link rel="stylesheet" href="{% static 'codemirror/theme/monokai.css' %}">
<script src="{% static 'codemirror/mode/xml/xml.js' %}"></script> <script src="{% static 'codemirror/mode/xml/xml.js' %}"></script>
<button class="btn btn-default btn-sm" data-toggle="modal" data-target="#{{ provider.pk }}">{% trans 'View Metadata' %}</button> <button class="pf-c-button pf-m-tertiary" data-target="modal" data-modal="{{ provider.pk }}">{% trans 'View Metadata' %}</button>
<div class="modal fade" id="{{ provider.pk }}" tabindex="-1" role="dialog" aria-labelledby="{{ provider.pk }}Label" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="pf-c-backdrop" id="{{ provider.pk }}" hidden>
<div class="modal-content"> <div class="pf-l-bullseye">
<div class="modal-header"> <div class="pf-c-modal-box pf-m-sm" role="dialog">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" aria-label="Close"> <button data-modal-close class="pf-c-button pf-m-plain" type="button" aria-label="Close dialog">
<span class="pficon pficon-close"></span> <i class="fas fa-times" aria-hidden="true"></i>
</button> </button>
<h4 class="modal-title" id="{{ provider.pk }}Label">{% trans 'Metadata' %}</h4> <h1 class="pf-c-title pf-m-2xl" id="modal-title">{% trans 'Metadata' %}</h1>
</div> <div class="pf-c-modal-box__body" id="modal-description">
<div class="modal-body"> <form method="post">
<form class="form-horizontal"> <textarea class="codemirror" id="{{ provider.pk }}-textarea">
<textarea class="codemirror" id="{{ provider.pk }}-textarea"> {{ metadata }}
{{ metadata }} </textarea>
</textarea> </form>
</form> </div>
</div> <footer class="pf-c-modal-box__footer pf-m-align-left">
<div class="modal-footer"> <button data-modal-close class="pf-c-button pf-m-primary" type="button">{% trans 'Close' %}</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">{% trans 'Close' %}</button> </footer>
</div> </div>
</div> </div>
</div>
</div> </div>
<script> <script>
CodeMirror.fromTextArea(document.getElementById("{{ provider.pk }}-textarea"), { CodeMirror.fromTextArea(document.getElementById("{{ provider.pk }}-textarea"), {
mode: 'xml', mode: 'xml',
theme: 'monokai', theme: 'monokai',
lineNumbers: false, lineNumbers: false,
readOnly: true, readOnly: true,
autoRefresh: true, autoRefresh: true,
}); });
</script> </script>

View File

@ -0,0 +1,7 @@
.pf-c-page__sidebar {
z-index: 0;
}
.pf-c-page__header {
z-index: 0;
}

View File

@ -0,0 +1,23 @@
// Button Dropdowns
document.querySelectorAll("button.pf-c-dropdown__toggle").forEach((b) => {
b.addEventListener('click', (e) => {
const parent = e.target.closest('.pf-c-dropdown');
const menu = parent.querySelector('.pf-c-dropdown__menu');
menu.hidden = !menu.hidden;
});
});
// Modal
document.querySelectorAll("[data-target='modal']").forEach((m) => {
m.addEventListener("click", (e) => {
const parentContainer = e.target.closest('[data-target="modal"]');
const modalId = parentContainer.attributes['data-modal'].value;
document.querySelector(`#${modalId}`).removeAttribute("hidden");
});
});
document.querySelectorAll(".pf-c-modal-box [data-modal-close]").forEach(b => {
b.addEventListener("click", (e) => {
const parentContainer = e.target.closest('.pf-c-backdrop');
parentContainer.setAttribute("hidden", true);
});
});