3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-05 01:16:28 +00:00

Fix permissions

This commit is contained in:
Yoann Pétri 2018-12-23 23:17:08 +01:00
parent 613c2b8348
commit 885f2c2af8
2 changed files with 45 additions and 7 deletions

View file

@ -2,13 +2,22 @@
{% block entete %}Gestion des produits{% endblock %}
{% block navbar%}
<ul>
{% if perms.gestion.add_product or perms.gestion.view_product %}
<li><a href="#first">Produits</a></li>
{% endif %}
{% if perms.gestion.add_keg or perms.gestion.open_keg or perms.gestion.close_keg or perms.gestion.view_keg %}
<li><a href="#second">Futs</a></li>
{% endif %}
{% if perms.gestion.add_menu or perms.gestion.view_menu %}
<li><a href="#third">Menus</a></li>
{% endif %}
{% if perms.gestion.add_pinte or perms.gestion.change_pinte or perms.gestion.view_pinte or perms.auth.view_user %}
<li><a href="#fourth">Pintes</a></li>
{% endif %}
</ul>
{% endblock %}
{% block content %}
{% if perms.gestion.add_product or perms.gestion.view_product %}
<section id="first" class="main">
<header class="major">
<h2>Produits</h2>
@ -24,6 +33,8 @@
{% endif %}
</ul>
</section>
{% endif %}
{% if perms.gestion.add_keg or perms.gestion.open_keg or perms.gestion.close_keg or perms.gestion.view_keg %}
<section id="second" class="main">
<header class="major">
<h2>Futs</h2>
@ -44,6 +55,8 @@
{% endif %}
</ul>
</section>
{% endif %}
{% if perms.gestion.add_menu or perms.gestion.view_menu %}
<section id="third" class="main">
<header class="major">
<h2>Menus</h2>
@ -59,6 +72,8 @@
{% endif %}
</ul>
</section>
{% endif %}
{% if perms.gestion.add_pinte or perms.gestion.change_pinte or perms.gestion.view_pinte or perms.auth.view_user %}
<section id="fourth" class="main">
<header class="major">
<h2>Pintes</h2>
@ -79,4 +94,5 @@
{% endif %}
</ul>
</section>
{% endif %}
{% endblock %}

View file

@ -2,15 +2,28 @@
{% block entete %}Gestion des utilisateurs{% endblock %}
{% block navbar%}
<ul>
{% if perms.auth.add_user or perms.auth.view_user %}
<li><a href="#first">Utilisateurs</a></li>
{% endif %}
{% if perms.auth.add_group or perms.auth.view_group %}
<li><a href="#second">Groupes</a></li>
{% endif %}
{% if request.user.is_staff %}
<li><a href="#third">Admins</a></li>
{% endif %}
{% if request.user.is_superuser %}
<li><a href="#fourth">Superusers</a></li>
{% endif %}
{% if perms.users.add_school or perms.users.view_school %}
<li><a href="#fifth">Écoles</a></li>
{% endif %}
{% if perms.aut.view_user %}
<li><a href="#sixth">Exportation de données</a></li>
{% endif %}
</ul>
{% endblock %}
{% block content %}
{% if perms.auth.add_user or perms.auth.view_user %}
<section id="first" class="main">
<header class="major">
<h2>Utilisateurs</h2>
@ -26,18 +39,24 @@
{% endif %}
</ul>
</section>
{% endif %}
{% if perms.auth.add_group or perms.auth.view_group %}
<section id="second" class="main">
<header class="major">
<h2>Groupes</h2>
</header>
Actions possibles :
<ul>
{% if perms.auth.view_group %}
{% if perms.auth.add_group %}
<li><a href="{% url 'users:createGroup' %}">Ajouter un groupe de droit</a></li>
{% endif %}
{% if perms.auth.view_group %}
<li><a href="{% url 'users:groupsIndex' %}">Lister les groupes de droits</a></li>
{% endif %}
</ul>
</section>
{% endif %}
{% if request.user.is_staff %}
<section id="third" class="main">
<header class="major">
<h2>Admins</h2>
@ -45,12 +64,12 @@
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>
{% endif %}
{% if request.user.is_superuser %}
<section id="fourth" class="main">
<header class="major">
<h2>Superusers</h2>
@ -58,26 +77,28 @@
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>
{% endif %}
{% if perms.users.add_school or perms.users.view_school %}
<section id="fifth" class="main">
<header class="major">
<h2>Écoles</h2>
</header>
Actions possibles :
<ul>
{% if perms.gestion.add_school %}
{% if perms.users.add_school %}
<li><a href="{% url 'users:createSchool' %}">Ajouter une école</a></li>
{% endif %}
{% if perms.gestion.view_school %}
{% if perms.users.view_school %}
<li><a href="{% url 'users:schoolsIndex' %}">Lister les écoles</a></li>
{% endif %}
</ul>
</section>
{% endif %}
{% if perms.auth.view_user %}
<section id="sixth" class="main">
<header class="major">
<h2>Exportation de données</h2>
@ -88,4 +109,5 @@
<button class="button" target="_blank">Exporter au format csv</button>
</form>
</section>
{% endif %}
{% endblock %}