3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-25 22:22:27 +00:00

Graphical acl

This commit is contained in:
Yoann Pétri 2018-12-02 19:26:33 +01:00
parent 74b628d831
commit 6810db96e2
17 changed files with 88 additions and 20 deletions

View file

@ -12,9 +12,15 @@
<header class="major">
<h2>Liste des fûts actifs</h2>
</header>
{% if perms.gestion.add_keg %}
<a class="button" href="{% url 'gestion:addKeg' %}">Créer un fût</a>
{% endif %}
{% if perms.gestion.open_keg %}
<a class="button" href="{% url 'gestion:openKeg' %}">Percuter un fût</a>
{% endif %}
{% if perms.gestion.close_keg %}
<a class="button" href="{% url 'gestion:closeKeg' %}">Fermer un fût</a>
{% endif %}
<br><br>
<div class="table-wrapper">
<table>
@ -42,7 +48,7 @@
<td>{{ kegH.amountSold }} €</td>
<td>{{ kegH.keg.amount }} €</td>
<td><a href="{% url 'gestion:kegH' kegH.keg.pk %}">Voir</a></td>
<td><a href="{% url 'gestion:closeDirectKeg' kegH.keg.pk %}" class="button small">Fermer</a> <a href="{% url 'gestion:editKeg' kegH.keg.pk %}" class="button small">Modifier</a></td>
<td>{% if perms.gestion.close_keg %}<a href="{% url 'gestion:closeDirectKeg' kegH.keg.pk %}" class="button small">Fermer</a> {% endif %}{% if perms.gestion.change_keg %}<a href="{% url 'gestion:editKeg' kegH.keg.pk %}" class="button small">Modifier</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>
@ -53,9 +59,15 @@
<header class="major">
<h2>Liste des fûts inactifs</h2>
</header>
{% if perms.gestion.add_keg %}
<a class="button" href="{% url 'gestion:addKeg' %}">Créer un fût</a>
{% endif %}
{% if perms.gestion.open_keg %}
<a class="button" href="{% url 'gestion:openKeg' %}">Percuter un fût</a>
{% endif %}
{% if perms.gestion.close_keg %}
<a class="button" href="{% url 'gestion:closeKeg' %}">Fermer un fût</a>
{% endif %}
<br><br>
<div class="table-wrapper">
<table>
@ -79,7 +91,7 @@
<td>{{ keg.capacity }} L</td>
<td>{{ keg.amount }} €</td>
<td><a href="{% url 'gestion:kegH' keg.pk %}">Voir</a></td>
<td>{% if keg.stockHold > 0 %}<a href="{% url 'gestion:openDirectKeg' keg.pk %}" class="button small">Percuter</a>{% endif %} <a href="{% url 'gestion:editKeg' keg.pk %}" class="button small">Modifier</a></td>
<td>{% if perms.gestion.open_keg %}{% if keg.stockHold > 0 %}<a href="{% url 'gestion:openDirectKeg' keg.pk %}" class="button small">Percuter</a> {% endif %}{% endif %}{% if perms.gestion.change_keg %}<a href="{% url 'gestion:editKeg' keg.pk %}" class="button small">Modifier</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -5,9 +5,9 @@
{% block navbar %}
<ul>
{% if perms.gestion.can_add_consumption_history %}<li><a href="#first">Commande</a></li>{% endif %}
{% if perms.gestion.can_add_reload %}<li><a href="#second">Rechargement Client</a></li>{% endif %}
{% if perms.gestion.can_add_refund %}<li><a href="#third">Remboursement client</a><li>{% endif %}
{% if perms.gestion.add_consumptionhistory %}<li><a href="#first">Commande</a></li>{% endif %}
{% if perms.gestion.add_reload %}<li><a href="#second">Rechargement Client</a></li>{% endif %}
{% if perms.gestion.add_refund %}<li><a href="#third">Remboursement client</a><li>{% endif %}
</ul>
{% endblock %}
@ -31,6 +31,7 @@
bottom : 1em;
}
</style>
{% if perms.gestion.add_consumptionhistory %}
<section id="intro" class="main">
<div class="spotlight">
<div class="content">
@ -182,7 +183,8 @@
</div>
</div>
</section>
{% if perms.gestion.cand_add_reload %}
{% endif %}
{% if perms.gestion.add_reload %}
<section id="second" class="main">
<header class="major">
<h2>Rechargement client</h2>

View file

@ -31,7 +31,7 @@
<td>{{ menu.barcode }}</td>
<td>{% for art in menu.articles.all %}{{art}},{% endfor %}</td>
<td>{{ menu.is_active | yesno:"Oui, Non"}}</td>
<td><a href="{% url 'gestion:switchActivateMenu' menu.pk %}" class="button small">{% if menu.is_active %}Désa{% else %}A{% endif %}ctiver</a> <a href="{% url 'gestion:editMenu' menu.pk %}" class="button small">Modifier</a></td>
<td>{% if perms.gestion.change_menu %}<a href="{% url 'gestion:switchActivateMenu' menu.pk %}" class="button small">{% if menu.is_active %}Désa{% else %}A{% endif %}ctiver</a> <a href="{% url 'gestion:editMenu' menu.pk %}" class="button small">Modifier</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block entete %}<h1>Gestion des utilisateurs</h1>{% endblock %}
{% block entete %}<h1>Gestion des produits</h1>{% endblock %}
{% block navbar %}
<ul>
<li><a href="#first">Général</a></li>
@ -10,7 +10,7 @@
<header class="major">
<h2>Général</h2>
</header>
<a href="{% url 'gestion:switchActivate' product.pk %}" class="button small">{% if product.is_active %}Désa{% else %}A{% endif %}ctiver</a> <a href="{% url 'gestion:editProduct' product.pk %}" class="button small">Modifier</a><br>
{% if perms.gestion.change_product %}<a href="{% url 'gestion:switchActivate' product.pk %}" class="button small">{% if product.is_active %}Désa{% else %}A{% endif %}ctiver</a> <a href="{% url 'gestion:editProduct' product.pk %}" class="button small">Modifier</a><br>{% endif %}
<strong>Nom</strong> : {{ product.name }}<br>
<strong>Prix de vente</strong> : {{ product.amount }}€<br>
<strong>Stock en soute</strong> : {{ product.stockHold }}<br>

View file

@ -14,9 +14,13 @@
</header>
Actions possibles :
<ul>
{% if perms.gestion.add_product %}
<li><a href="{% url 'gestion:addProduct' %}">Créer un produit</a></li>
{% endif %}
{% if permis.gestion.view_product}
<li><a href="{% url 'gestion:searchProduct' %}">Rechercher un produit</a></li>
<li><a href="{% url 'gestion:productsList' %}">Lister tous les produits</a></li>
{% endif %}
</ul>
</section>
<section id="second" class="main">
@ -25,10 +29,18 @@
</header>
Actions possibles :
<ul>
{% if perms.gestion.add_keg %}
<li><a href="{% url 'gestion:addKeg' %}">Créer un fut</a></li>
{% endif %}
{% if perms.gestion.open_keg}
<li><a href="{% url 'gestion:openKeg' %}">Percuter un fut</a></li>
{% endif %}
{% if perms.gestion.close_keg}
<li><a href="{% url 'gestion:closeKeg' %}">Fermer un fût</a></li>
{% endif %}
{% if perms.gestion.view_keg}
<li><a href="{% url 'gestion:kegsList' %}">Lister les futs</a></li>
{% endif %}
</ul>
</section>
<section id="third" class="main">
@ -37,9 +49,13 @@
</header>
Actions possibles :
<ul>
{% if perms.gestion.add_menu %}
<li><a href="{% url 'gestion:addMenu' %}">Créer un menu</a></li>
{% endif %}
{% if perms.gestion.view_menu %}
<li><a href="{% url 'gestion:searchMenu' %}">Rechercher un menu</a></li>
<li><a href="{% url 'gestion:menusList' %}">Lister les menus</a></li>
{% endif %}
</ul>
</section>
{% endblock %}

View file

@ -10,7 +10,9 @@
<header class="major">
<h2>Liste des produits</h2>
</header>
{% if perms.gestion.add_product %}
<a class="button" href="{% url 'gestion:addProduct' %}">Créer un produit</a><br><br>
{% endif %}
<div class="table-wrapper">
<table>
<thead>
@ -39,7 +41,7 @@
<td>{{ product.is_active | yesno:"Oui, Non"}}</td>
<td>{{ product.deg }}</td>
<td>{{ product.volume }} cl</td>
<td><a href="{% url 'gestion:productProfile' product.pk %}" class="button small">Profil</a> <a href="{% url 'gestion:switchActivate' product.pk %}" class="button small">{% if product.is_active %}Désa{% else %}A{% endif %}ctiver</a> <a href="{% url 'gestion:editProduct' product.pk %}" class="button small">Modifier</a></td>
<td><a href="{% url 'gestion:productProfile' product.pk %}" class="button small">Profil</a> {% if perms.gestion.change_product %}<a href="{% url 'gestion:switchActivate' product.pk %}" class="button small">{% if product.is_active %}Désa{% else %}A{% endif %}ctiver</a> <a href="{% url 'gestion:editProduct' product.pk %}" class="button small">Modifier</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -10,7 +10,9 @@
<header class="major">
<h2>Liste des cotisations</h2>
</header>
{% if perms.preferences.add_cotisation %}
<a class="button" href="{% url 'preferences:addCotisation' %}">Créer une cotisation</a><br><br>
{% endif %}
<div class="table-wrapper">
<table>
<thead>
@ -25,7 +27,7 @@
<tr>
<td>{{ cotisation.duration }} jours</td>
<td>{{ cotisation.amount }} €</td>
<td><a class="button small" href="{% url 'preferences:editCotisation' cotisation.pk %}">Modifier</a> <a class="button small" href="{% url 'preferences:deleteCotisation' cotisation.pk %}">Supprimer</a></td>
<td>{% if perms.preferences.change_cotisation %}<a class="button small" href="{% url 'preferences:editCotisation' cotisation.pk %}">Modifier</a> {% endif %}{% if perms.preferences.delete_cotisation %}<a class="button small" href="{% url 'preferences:deleteCotisation' cotisation.pk %}">Supprimer</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -10,7 +10,9 @@
<header class="major">
<h2>Liste des moyens de paiement</h2>
</header>
{% if perms.preferences.add_paymentmethod %}
<a class="button" href="{% url 'preferences:addPaymentMethod' %}">Créer un moyen de paiement</a><br><br>
{% endif %}
<div class="table-wrapper">
<table>
<thead>
@ -31,7 +33,7 @@
<td>{{ pm.is_usable_in_cotisation | yesno:"Oui, Non" }}</td>
<td>{{ pm.is_usable_in_reload | yesno:"Oui, Non" }}</td>
<td>{{ pm.affect_balance | yesno:"Oui, Non" }}</td>
<td><a class="button small" href="{% url 'preferences:editPaymentMethod' pm.pk %}">Modifier</a> <a class="button small" href="{% url 'preferences:deletePaymentMethod' pm.pk %}">Supprimer</a></td>
<td>{% if perms.preferences.change_paymentmethod %}<a class="button small" href="{% url 'preferences:editPaymentMethod' pm.pk %}">Modifier</a> {% endif %}{% if perms.preferences.delete_paymentmethod %}<a class="button small" href="{% url 'preferences:deletePaymentMethod' pm.pk %}">Supprimer</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -2,27 +2,39 @@
<span class="tabulation2">
<a href="{% url 'users:profile' request.user.pk %}">Mon profil</a>
</span>
{% if perms.gestion.add_consumptionhistory or perms.gestion.add_refund or perms.gestion.add_reload %}
<span class="tabulation2">
<a href="{% url 'gestion:manage' %}">Caisse</a>
</span>
{% endif %}
{% if perms.auth.add_user or perms.auth.view_user or perms.auth.add_group or perms.auth.view_group or perms.users.add_school or perms.users.view_school %}
<span class="tabulation2">
<a href="{% url 'users:index' %}">Gestion des clients</a>
</span>
{% endif %}
{% if perms.gestion.view_product or perms.gestion.add_product or perms.gestion.add_keg or perms.gestion.view_keg or perms.gestion.change_keg or perms.gestion.view_menu or perms.gestion.add_menu %}
<span class="tabulation2">
<a href="{% url 'gestion:productsIndex' %}">Gestion des produits</a>
</span>
{% endif %}
<span class="tabulation2">
<a href="{% url 'gestion:ranking' %}">Classement</a>
</span>
{% if perms.preferences.change_generalpreferences %}
<span class="tabulation2">
<a href="{% url 'preferences:generalPreferences' %}">Admin</a>
</span>
{% endif %}
{% if perms.preferences.view_cotisation %}
<span class="tabulation2">
<a href="{% url 'preferences:cotisationsIndex' %}">Cotisations</a>
</span>
{% endif %}
{% if perms.preferences.view_cotisation %}
<span class="tabulation2">
<a href="{% url 'preferences:paymentMethodsIndex' %}">Moyens de paiement</a>
</span>
{% endif %}
<span class="tabulation2">
<a href="{% url 'users:logout' %}">Deconnexion</a>
</span>

View file

@ -25,7 +25,7 @@
<tr>
<td>{{ user }} {% if user.is_superuser %}(superuser){% endif %}</td>
<td><a class="button small" href="{% url 'users:profile' user.pk %}">Profil</a></td>
<td><a class="button small" href="{% url 'users:removeAdmin' user.pk %}">Retirer des admins</a></td>
<td>{% if not user.is_superuser %}<a class="button small" href="{% url 'users:removeAdmin' user.pk %}">Retirer des admins</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -33,7 +33,7 @@
<td>{{c.amount}}</td>
<td>{{c.paymentMethod}}</td>
<td>{{c.date}}</td>
<td><a href="{% url 'gestion:cancelConsumption' c.pk %}" class="button small">Annuler</a></td>
<td>{% if perms.gestion.delete_consumptionhistory %}<a href="{% url 'gestion:cancelConsumption' c.pk %}" class="button small">Annuler</a>{% endif %}</td>
</tr>
{%endfor%}
</tbody>

View file

@ -33,7 +33,7 @@
<td>{{m.amount}}</td>
<td>{{m.paymentMethod}}</td>
<td>{{m.date}}</td>
<td><a href="{% url 'gestion:cancelMenu' m.pk %}" class="button small">Annuler</a></td>
<td>{% if perms.gestion.delete_menuhistory %}<a href="{% url 'gestion:cancelMenu' m.pk %}" class="button small">Annuler</a>{% endif %}</td>
</tr>
{%endfor%}
</tbody>

View file

@ -19,12 +19,16 @@
</div>
<br>
<div class="row">
{% if perms.auth.change_group %}
<div class="6u">
<a class="button" href="{% url 'users:editGroup' group.pk %}">Éditer</a>
</div>
{% endif %}
{% if perms.auth.delete_group %}
<div class="6u">
<a class="button" href="{% url 'users:deleteGroup' group.pk %}">Supprimer</a>
</div>
{% endif %}
</div>
</section>
<section id="second" class="main">

View file

@ -10,7 +10,9 @@
<header class="major">
<h2>Liste des groupes de droit</h2>
</header>
{% if perms.auth.add_group %}
<a href="{% url 'users:createGroup' %}" class="button">Ajouter un groupe de droit</a><br><br>
{% endif %}
<div class="table-wrapper">
<table>
<thead>
@ -27,7 +29,7 @@
<td>{{ group.name }}</td>
<td>{{ group.permissions.count }}</td>
<td>{{ group.user_set.count }}</td>
<td><a href="{% url 'users:groupProfile' group.pk %}" class="button small">Voir</a> <a href="{% url 'users:editGroup' group.pk %}" class="button small">Éditer</a> <a href="{% url 'users:deleteGroup' group.pk %}" class="button small">Supprimer</a></td>
<td><a href="{% url 'users:groupProfile' group.pk %}" class="button small">Voir</a> {% if perms.auth.change_group %}<a href="{% url 'users:editGroup' group.pk %}" class="button small">Éditer</a> {% endif %}{% if perms.auth.delete_group %}<a href="{% url 'users:deleteGroup' group.pk %}" class="button small">Supprimer</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -16,9 +16,13 @@
</header>
Actions possibles :
<ul>
{% if perms.auth.add_user}
<li><a href="{% url 'users:createUser' %}">Ajouter un utilisateur</a></li>
{% endif %}
{% if perms.auth.view_user %}
<li><a href="{% url 'users:searchUser' %}">Rechercher un utilisateur</a></li>
<li><a href="{% url 'users:usersIndex' %}">Lister tous les utilisateurs</a></li>
{% endif %}
</ul>
</section>
<section id="second" class="main">
@ -27,8 +31,10 @@
</header>
Actions possibles :
<ul>
{% if perms.auth.view_group %}
<li><a href="{% url 'users:createGroup' %}">Ajouter un groupe de droit</a></li>
<li><a href="{% url 'users:groupsIndex' %}">Lister les groupes de droits</a></li>
{% endif %}
</ul>
</section>
<section id="third" class="main">
@ -38,8 +44,10 @@
Les admins ont accès à l'interface admin.<br>
Actions possibles :
<ul>
{% if request.user.is_staff %}
<li><a href="{% url 'users:addAdmin' %}">Ajouter un admin</a></li>
<li><a href="{% url 'users:adminsIndex' %}">Lister les admins</a></li>
{% endif %}
</ul>
</section>
<section id="fourth" class="main">
@ -49,8 +57,10 @@
Attention : les superusers bypass toutes les vérifications de permissions.<br>
Actions possibles :
<ul>
{% if request.user.is_superuser %}
<li><a href="{% url 'users:addSuperuser' %}">Ajouter un superuser</a></li>
<li><a href="{% url 'users:superusersIndex' %}">Lister les superuser</a></li>
{% endif %}
</ul>
</section>
<section id="fifth" class="main">
@ -59,8 +69,12 @@
</header>
Actions possibles :
<ul>
{% if perms.gestion.add_school %}
<li><a href="{% url 'users:createSchool' %}">Ajouter une école</a></li>
{% endif %}
{% if perms.gestion.view_school %}
<li><a href="{% url 'users:schoolsIndex' %}">Lister les écoles</a></li>
{% endif %}
</ul>
</section>
{% endblock %}

View file

@ -150,7 +150,7 @@
<td>{{c.amount}}</td>
<td>{{c.paymentMethod}}</td>
<td>{{c.date}}</td>
<td><a href="{% url 'gestion:cancelConsumption' c.pk %}" class="button small">Annuler</a></td>
<td>{% if perms.gestion.delete_consumptionhistory %}<a href="{% url 'gestion:cancelConsumption' c.pk %}" class="button small">Annuler</a>{% endif %}</td>
</tr>
{%endfor%}
</tbody>
@ -184,7 +184,7 @@
<td>{{m.amount}}</td>
<td>{{m.paymentMethod}}</td>
<td>{{m.date}}</td>
<td><a href="{% url 'gestion:cancelMenu' m.pk %}" class="button small">Annuler</a></td>
<td>{% if perms.gestion.delete_menuhistory %}<a href="{% url 'gestion:cancelMenu' m.pk %}" class="button small">Annuler</a>{% endif %}</td>
</tr>
{%endfor%}
</tbody>
@ -249,7 +249,7 @@
<td>{{cotisation.paymentMethod}}</td>
<td>{{cotisation.endDate}}</td>
<td>{{cotisation.valid}}</td>
<td><a class="button small" href="{% url 'users:validateCotisationHistory' cotisation.pk %}">Valider</a> <a class="button small" href="{% url 'users:invalidateCotisationHistory' cotisation.pk %}">Invalider</a></td>
<td>{% if perms.users.validate_cotisationHistory %}<a class="button small" href="{% url 'users:validateCotisationHistory' cotisation.pk %}">Valider</a> <a class="button small" href="{% url 'users:invalidateCotisationHistory' cotisation.pk %}">Invalider</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -23,7 +23,7 @@
{% for school in schools %}
<tr>
<td>{{ school }}</td>
<td><a class="button small" href="{% url 'users:editSchool' school.pk %}">Modifier</a> <a class="button small" href="{% url 'users:deleteSchool' school.pk %}">Supprimer</a></td>
<td>{% if perms.gestion.change_school %}<a class="button small" href="{% url 'users:editSchool' school.pk %}">Modifier</a> {% endif %}{% if perms.gestion.delete_school %}<a class="button small" href="{% url 'users:deleteSchool' school.pk %}">Supprimer</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>