diff --git a/preferences/forms.py b/preferences/forms.py
index 03fa6360..fc214f52 100644
--- a/preferences/forms.py
+++ b/preferences/forms.py
@@ -117,6 +117,7 @@ class EditGeneralOptionForm(ModelForm):
self.fields['site_name'].label = 'Nom du site web'
self.fields['email_from'].label = "Adresse mail d\
'expedition automatique"
+ self.fields['GTU_sum_up'].label = "Résumé des CGU"
class EditAssoOptionForm(ModelForm):
diff --git a/preferences/models.py b/preferences/models.py
index d4c25c24..133d6f82 100644
--- a/preferences/models.py
+++ b/preferences/models.py
@@ -302,6 +302,16 @@ class GeneralOption(models.Model):
req_expire_hrs = models.IntegerField(default=48)
site_name = models.CharField(max_length=32, default="Re2o")
email_from = models.EmailField(default="www-data@serveur.net")
+ GTU_sum_up = models.TextField(
+ default="",
+ blank=True,
+ )
+ GTU = models.FileField(
+ upload_to = '',
+ default="",
+ null=True,
+ blank=True,
+ )
class Meta:
permissions = (
diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html
index 45a4fd11..e46564a3 100644
--- a/preferences/templates/preferences/display_preferences.html
+++ b/preferences/templates/preferences/display_preferences.html
@@ -137,7 +137,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Message global affiché sur le site |
{{ generaloptions.general_message }} |
+ Résumé des CGU |
+ {{ generaloptions.GTU_sum_up }} |
+
+ CGU |
+ {{generaloptions.GTU}}
+ |
Données de l'association
diff --git a/preferences/templates/preferences/edit_preferences.html b/preferences/templates/preferences/edit_preferences.html
index 02f006c1..8d75f289 100644
--- a/preferences/templates/preferences/edit_preferences.html
+++ b/preferences/templates/preferences/edit_preferences.html
@@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Edition des préférences
-
{% can_view_app preferences %}
diff --git a/users/models.py b/users/models.py
index 148142a4..d3c1d175 100644
--- a/users/models.py
+++ b/users/models.py
@@ -684,10 +684,13 @@ class User(FieldPermissionModelMixin, AbstractBaseUser, PermissionsMixin):
an user or if the `options.all_can_create` is set.
"""
options, _created = OptionalUser.objects.get_or_create()
- if options.all_can_create:
- return True, None
+ if(not user_request.is_authenticated and not options.self_adhesion):
+ return False, None
else:
- return user_request.has_perm('users.add_user'), u"Vous n'avez pas le\
+ if(options.all_can_create or options.self_adhesion):
+ return True, None
+ else:
+ return user_request.has_perm('users.add_user'), u"Vous n'avez pas le\
droit de créer un utilisateur"
def can_edit(self, user_request, *args, **kwargs):
@@ -862,7 +865,7 @@ class Club(User):
"""
if user_request.has_perm('users.view_user'):
return True, None
- if user_request.is_class_adherent:
+ if hasattr(user_request,'is_class_adherent') and user_request.is_class_adherent:
if user_request.adherent.club_administrator.all() or user_request.adherent.club_members.all():
return True, None
return False, u"Vous n'avez pas accès à la liste des utilisateurs."
diff --git a/users/templates/users/user.html b/users/templates/users/user.html
index 26b7e0ee..20931031 100644
--- a/users/templates/users/user.html
+++ b/users/templates/users/user.html
@@ -36,6 +36,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% massive_bootstrap_form userform 'room,school,administrators,members' %}
{% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %}
+
+En cliquant sur Créer ou modifier, l'utilisateur s'engage à respecter les règles d'utilisation du réseau.
+Résumé des règles d'utilisations
+{{ GTU_sum_up }}
diff --git a/users/views.py b/users/views.py
index bff33907..e3f73f38 100644
--- a/users/views.py
+++ b/users/views.py
@@ -117,12 +117,14 @@ def password_change_action(u_form, user, request, req=False):
kwargs={'userid':str(user.id)}
))
-@login_required
@can_create(Adherent)
def new_user(request):
""" Vue de création d'un nouvel utilisateur,
envoie un mail pour le mot de passe"""
user = AdherentForm(request.POST or None, user=request.user)
+ options, _created = GeneralOption.objects.get_or_create()
+ GTU_sum_up = options.GTU_sum_up
+ GTU = options.GTU
if user.is_valid():
user = user.save(commit=False)
with transaction.atomic(), reversion.create_revision():
@@ -136,7 +138,7 @@ def new_user(request):
'users:profil',
kwargs={'userid':str(user.id)}
))
- return form({'userform': user}, 'users/user.html', request)
+ return form({'userform': user,'GTU_sum_up':GTU_sum_up,'GTU':GTU}, 'users/user.html', request)
@login_required