diff --git a/re2o/templatetags/acl.py b/re2o/templatetags/acl.py
index 5661882e..2db6d682 100644
--- a/re2o/templatetags/acl.py
+++ b/re2o/templatetags/acl.py
@@ -126,6 +126,7 @@ MODEL_NAME = {
'Room' : topologie.Room,
# users
'User' : users.User,
+ 'Adherent' : users.Adherent,
'Club' : users.Club,
'ServiceUser' : users.ServiceUser,
'Right' : users.Right,
diff --git a/users/models.py b/users/models.py
index c3c2c8ca..db7e3da5 100644
--- a/users/models.py
+++ b/users/models.py
@@ -1077,7 +1077,7 @@ class Right(models.Model):
def can_create(user_request, *args, **kwargs):
"""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 user_request.has_perms(('bureau',)), u"Vous n'avez pas le droit de\
diff --git a/users/templates/users/aff_bans.html b/users/templates/users/aff_bans.html
index dff72aa2..2e3957a1 100644
--- a/users/templates/users/aff_bans.html
+++ b/users/templates/users/aff_bans.html
@@ -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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
-
+{% load acl %}
{% if ban_list.paginator %}
{% include "pagination.html" with list=ban_list %}
{% endif %}
@@ -47,9 +47,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ ban.date_start }} |
{{ ban.date_end }} |
- {% if is_bofh %}
+ {% can_edit ban %}
{% 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 %}
|
diff --git a/users/templates/users/aff_schools.html b/users/templates/users/aff_schools.html
index 5fcdeb72..64d92cd1 100644
--- a/users/templates/users/aff_schools.html
+++ b/users/templates/users/aff_schools.html
@@ -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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
-
+{% load acl %}
@@ -33,7 +33,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ school.name }} |
+ {% can_edit school %}
{% 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 %}
|
diff --git a/users/templates/users/aff_serviceusers.html b/users/templates/users/aff_serviceusers.html
index 01e223aa..ddef0360 100644
--- a/users/templates/users/aff_serviceusers.html
+++ b/users/templates/users/aff_serviceusers.html
@@ -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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
-
+{% load acl %}
@@ -37,9 +37,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ serviceuser.access_group }} |
{{ serviceuser.comment }} |
- {% include 'buttons/suppr.html' with href='users:del-serviceuser' id=serviceuser.id %}
- {% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
- {% include 'buttons/history.html' with href='users:history' name='serviceuser' id=serviceuser.id %}
+ {% can_delete serviceuser %}
+ {% 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 %}
+ {% acl_end %}
+ {% include 'buttons/history.html' with href='users:history' name='serviceuser' id=serviceuser.id %}
|
{% endfor %}
diff --git a/users/templates/users/aff_whitelists.html b/users/templates/users/aff_whitelists.html
index d86d356b..099d4b39 100644
--- a/users/templates/users/aff_whitelists.html
+++ b/users/templates/users/aff_whitelists.html
@@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% if white_list.paginator %}
{% include "pagination.html" with list=white_list %}
{% endif %}
-
+{% load acl %}
@@ -47,9 +47,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ whitelist.date_start }} |
{{ whitelist.date_end }} |
- {% if is_cableur %}
+ {% can_edit whitelist %}
{% 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 %}
|
diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html
index f2bdd54e..f17bf809 100644
--- a/users/templates/users/profil.html
+++ b/users/templates/users/profil.html
@@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load bootstrap3 %}
-
+{% load acl %}
{% block title %}Profil{% endblock %}
{% block content %}
@@ -38,7 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Changer le mot de passe
- {% if is_bureau %}
Changer le statut
@@ -47,7 +46,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Ajouter un droit
- {% endif %}
Historique
@@ -189,21 +187,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Aucune machine
{% endif %}
Cotisations
- {% if is_cableur %}{% endif%}
+
{% if facture_list %}
{% include "cotisations/aff_cotisations.html" with facture_list=facture_list %}
{% else %}
Aucune facture
{% endif %}
Bannissements
- {% if is_bofh %}{% endif %}
+ {% can_create Ban %}{% acl_end %}
{% if ban_list %}
{% include "users/aff_bans.html" with ban_list=ban_list %}
{% else %}
Aucun bannissement
{% endif %}
Accès à titre gracieux :
- {% if is_cableur %}{% endif %}
+ {% can_create Whitelist %}{% acl_end %}
{% if white_list %}
{% include "users/aff_whitelists.html" with white_list=white_list %}
{% else %}
diff --git a/users/templates/users/sidebar.html b/users/templates/users/sidebar.html
index d6b31acd..08e700d6 100644
--- a/users/templates/users/sidebar.html
+++ b/users/templates/users/sidebar.html
@@ -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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
-
+{% load acl %}
{% block sidebar %}
- {% if is_cableur %}
+ {% can_create Club %}
Créer un club/association
- {% endif %}
+ {% acl_end %}
+ {% can_create User %}
Créer un adhérent
+ {% acl_end %}
Clubs et assos
- {% if is_cableur %}
+ {% can_view_all Adherent %}
Adherents
+ {% acl_end %}
+ {% can_view_all Ban %}
Bannissements
+ {% acl_end %}
+ {% can_view_all Whitelist %}
Accès à titre gracieux
+ {% acl_end %}
+ {% can_view_all School %}
Établissements
+ {% acl_end %}
+ {% can_view_all ListRight %}
Droits
+ {% acl_end %}
+ {% can_view_all ServiceUser %}
Gérer les service users
- {% if is_bureau %}
+ {% acl_end %}
Retirer un droit
@@ -73,6 +85,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Archiver en masse
- {% endif %}
- {% endif %}
{% endblock %}