mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 15:12:25 +00:00
Acl dans les modèles de users.
This commit is contained in:
parent
970fe94656
commit
75948450dd
8 changed files with 40 additions and 25 deletions
|
@ -126,6 +126,7 @@ MODEL_NAME = {
|
||||||
'Room' : topologie.Room,
|
'Room' : topologie.Room,
|
||||||
# users
|
# users
|
||||||
'User' : users.User,
|
'User' : users.User,
|
||||||
|
'Adherent' : users.Adherent,
|
||||||
'Club' : users.Club,
|
'Club' : users.Club,
|
||||||
'ServiceUser' : users.ServiceUser,
|
'ServiceUser' : users.ServiceUser,
|
||||||
'Right' : users.Right,
|
'Right' : users.Right,
|
||||||
|
|
|
@ -1077,7 +1077,7 @@ class Right(models.Model):
|
||||||
def can_create(user_request, *args, **kwargs):
|
def can_create(user_request, *args, **kwargs):
|
||||||
"""Check if an user can create a Right object.
|
"""Check if an user can create a Right object.
|
||||||
|
|
||||||
:param user_request: The user who wants to create a user object.
|
:param user_request: The user who wants to create an object.
|
||||||
:return: a message and a boolean which is True if the user can create.
|
:return: a message and a boolean which is True if the user can create.
|
||||||
"""
|
"""
|
||||||
return user_request.has_perms(('bureau',)), u"Vous n'avez pas le droit de\
|
return user_request.has_perms(('bureau',)), u"Vous n'avez pas le droit de\
|
||||||
|
|
|
@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
{% load acl %}
|
||||||
{% if ban_list.paginator %}
|
{% if ban_list.paginator %}
|
||||||
{% include "pagination.html" with list=ban_list %}
|
{% include "pagination.html" with list=ban_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -47,9 +47,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ ban.date_start }}</td>
|
<td>{{ ban.date_start }}</td>
|
||||||
<td>{{ ban.date_end }}</td>
|
<td>{{ ban.date_end }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% if is_bofh %}
|
{% can_edit ban %}
|
||||||
{% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %}
|
{% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %}
|
||||||
{% endif %}
|
{% acl_end %}
|
||||||
{% include 'buttons/history.html' with href='users:history' name='ban' id=ban.id %}
|
{% include 'buttons/history.html' with href='users:history' name='ban' id=ban.id %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
{% load acl %}
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -33,7 +33,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ school.name }}</td>
|
<td>{{ school.name }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
|
{% can_edit school %}
|
||||||
{% include 'buttons/edit.html' with href='users:edit-school' id=school.id %}
|
{% include 'buttons/edit.html' with href='users:edit-school' id=school.id %}
|
||||||
|
{% acl_end %}
|
||||||
{% include 'buttons/history.html' with href='users:history' name='school' id=school.id %}
|
{% include 'buttons/history.html' with href='users:history' name='school' id=school.id %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
{% load acl %}
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -37,8 +37,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ serviceuser.access_group }}</td>
|
<td>{{ serviceuser.access_group }}</td>
|
||||||
<td>{{ serviceuser.comment }}</td>
|
<td>{{ serviceuser.comment }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
|
{% can_delete serviceuser %}
|
||||||
{% include 'buttons/suppr.html' with href='users:del-serviceuser' id=serviceuser.id %}
|
{% include 'buttons/suppr.html' with href='users:del-serviceuser' id=serviceuser.id %}
|
||||||
|
{% acl_end %}
|
||||||
|
{% can_edit serviceuser %}
|
||||||
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
|
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
|
||||||
|
{% acl_end %}
|
||||||
{% include 'buttons/history.html' with href='users:history' name='serviceuser' id=serviceuser.id %}
|
{% include 'buttons/history.html' with href='users:history' name='serviceuser' id=serviceuser.id %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% if white_list.paginator %}
|
{% if white_list.paginator %}
|
||||||
{% include "pagination.html" with list=white_list %}
|
{% include "pagination.html" with list=white_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% load acl %}
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -47,9 +47,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ whitelist.date_start }}</td>
|
<td>{{ whitelist.date_start }}</td>
|
||||||
<td>{{ whitelist.date_end }}</td>
|
<td>{{ whitelist.date_end }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% if is_cableur %}
|
{% can_edit whitelist %}
|
||||||
{% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %}
|
{% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %}
|
||||||
{% endif %}
|
{% acl_end %}
|
||||||
{% include 'buttons/history.html' with href='users:history' name='whitelist' id=whitelist.id %}
|
{% include 'buttons/history.html' with href='users:history' name='whitelist' id=whitelist.id %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load acl %}
|
||||||
{% block title %}Profil{% endblock %}
|
{% block title %}Profil{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -38,7 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<i class="glyphicon glyphicon-lock"></i>
|
<i class="glyphicon glyphicon-lock"></i>
|
||||||
Changer le mot de passe
|
Changer le mot de passe
|
||||||
</a>
|
</a>
|
||||||
{% if is_bureau %}
|
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' user.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' user.id %}">
|
||||||
<i class="glyphicon glyphicon-flash"></i>
|
<i class="glyphicon glyphicon-flash"></i>
|
||||||
Changer le statut
|
Changer le statut
|
||||||
|
@ -47,7 +46,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<i class="glyphicon glyphicon-ok"></i>
|
<i class="glyphicon glyphicon-ok"></i>
|
||||||
Ajouter un droit
|
Ajouter un droit
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
|
||||||
<a class="btn btn-info btn-sm" role="button" href="{% url 'users:history' 'user' user.id %}">
|
<a class="btn btn-info btn-sm" role="button" href="{% url 'users:history' 'user' user.id %}">
|
||||||
<i class="glyphicon glyphicon-time"></i>
|
<i class="glyphicon glyphicon-time"></i>
|
||||||
Historique
|
Historique
|
||||||
|
@ -189,21 +187,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<p>Aucune machine</p>
|
<p>Aucune machine</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>Cotisations</h2>
|
<h2>Cotisations</h2>
|
||||||
{% if is_cableur %}<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new-facture' user.id %}"><i class="glyphicon glyphicon-piggy-bank"></i> Ajouter une cotisation</a> {% if user_solde %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' user.id %}"><i class="glyphicon glyphicon-piggy-bank"></i> Modifier le solde</a>{% endif%}</h4>{% endif%}
|
<h4>{% can_create Facture %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new-facture' user.id %}"><i class="glyphicon glyphicon-piggy-bank"></i> Ajouter une cotisation</a>{% acl_end %} {% if user_solde %}<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' user.id %}"><i class="glyphicon glyphicon-piggy-bank"></i> Modifier le solde</a>{% endif%}</h4>
|
||||||
{% if facture_list %}
|
{% if facture_list %}
|
||||||
{% include "cotisations/aff_cotisations.html" with facture_list=facture_list %}
|
{% include "cotisations/aff_cotisations.html" with facture_list=facture_list %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>Aucune facture</p>
|
<p>Aucune facture</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>Bannissements</h2>
|
<h2>Bannissements</h2>
|
||||||
{% if is_bofh %}<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' user.id %}"><i class="glyphicon glyphicon-pushpin"></i> Ajouter un bannissement</a></h4>{% endif %}
|
{% can_create Ban %}<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' user.id %}"><i class="glyphicon glyphicon-pushpin"></i> Ajouter un bannissement</a></h4>{% acl_end %}
|
||||||
{% if ban_list %}
|
{% if ban_list %}
|
||||||
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>Aucun bannissement</p>
|
<p>Aucun bannissement</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>Accès à titre gracieux :</h2>
|
<h2>Accès à titre gracieux :</h2>
|
||||||
{% if is_cableur %}<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' user.id %}"><i class="glyphicon glyphicon-flag"></i> Accorder un accès à titre gracieux</a></h4>{% endif %}
|
{% can_create Whitelist %}<h4><a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' user.id %}"><i class="glyphicon glyphicon-flag"></i> Accorder un accès à titre gracieux</a></h4>{% acl_end %}
|
||||||
{% if white_list %}
|
{% if white_list %}
|
||||||
{% include "users/aff_whitelists.html" with white_list=white_list %}
|
{% include "users/aff_whitelists.html" with white_list=white_list %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -22,49 +22,61 @@ You should have received a copy of the GNU General Public License along
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
{% load acl %}
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
{% if is_cableur %}
|
{% can_create Club %}
|
||||||
<a class="list-group-item list-group-item-success" href="{% url "users:new-club" %}">
|
<a class="list-group-item list-group-item-success" href="{% url "users:new-club" %}">
|
||||||
<i class="glyphicon glyphicon-plus"></i>
|
<i class="glyphicon glyphicon-plus"></i>
|
||||||
Créer un club/association
|
Créer un club/association
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% acl_end %}
|
||||||
|
{% can_create User %}
|
||||||
<a class="list-group-item list-group-item-success" href="{% url "users:new-user" %}">
|
<a class="list-group-item list-group-item-success" href="{% url "users:new-user" %}">
|
||||||
<i class="glyphicon glyphicon-plus"></i>
|
<i class="glyphicon glyphicon-plus"></i>
|
||||||
Créer un adhérent
|
Créer un adhérent
|
||||||
</a>
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "users:index-clubs" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "users:index-clubs" %}">
|
||||||
<i class="glyphicon glyphicon-list"></i>
|
<i class="glyphicon glyphicon-list"></i>
|
||||||
Clubs et assos
|
Clubs et assos
|
||||||
</a>
|
</a>
|
||||||
{% if is_cableur %}
|
{% can_view_all Adherent %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "users:index" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "users:index" %}">
|
||||||
<i class="glyphicon glyphicon-list"></i>
|
<i class="glyphicon glyphicon-list"></i>
|
||||||
Adherents
|
Adherents
|
||||||
</a>
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
{% can_view_all Ban %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "users:index-ban" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "users:index-ban" %}">
|
||||||
<i class="glyphicon glyphicon-list"></i>
|
<i class="glyphicon glyphicon-list"></i>
|
||||||
Bannissements
|
Bannissements
|
||||||
</a>
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
{% can_view_all Whitelist %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "users:index-white" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "users:index-white" %}">
|
||||||
<i class="glyphicon glyphicon-list"></i>
|
<i class="glyphicon glyphicon-list"></i>
|
||||||
Accès à titre gracieux
|
Accès à titre gracieux
|
||||||
</a>
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
{% can_view_all School %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "users:index-school" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "users:index-school" %}">
|
||||||
<i class="glyphicon glyphicon-list"></i>
|
<i class="glyphicon glyphicon-list"></i>
|
||||||
Établissements
|
Établissements
|
||||||
</a>
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
{% can_view_all ListRight %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "users:index-listright" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "users:index-listright" %}">
|
||||||
<i class="glyphicon glyphicon-list"></i>
|
<i class="glyphicon glyphicon-list"></i>
|
||||||
Droits
|
Droits
|
||||||
</a>
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
{% can_view_all ServiceUser %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "users:index-serviceusers" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "users:index-serviceusers" %}">
|
||||||
<i class="glyphicon glyphicon-list"></i>
|
<i class="glyphicon glyphicon-list"></i>
|
||||||
Gérer les service users
|
Gérer les service users
|
||||||
</a>
|
</a>
|
||||||
{% if is_bureau %}
|
{% acl_end %}
|
||||||
<a class="list-group-item list-group-item-danger" href="{% url "users:del-right" %}">
|
<a class="list-group-item list-group-item-danger" href="{% url "users:del-right" %}">
|
||||||
<i class="glyphicon glyphicon-trash"></i>
|
<i class="glyphicon glyphicon-trash"></i>
|
||||||
Retirer un droit
|
Retirer un droit
|
||||||
|
@ -73,6 +85,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<i class="glyphicon glyphicon-book"></i>
|
<i class="glyphicon glyphicon-book"></i>
|
||||||
Archiver en masse
|
Archiver en masse
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue