mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Translation of users/ (front)
This commit is contained in:
parent
a06082c6d4
commit
af40e3ea4e
31 changed files with 2108 additions and 630 deletions
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
Here are defined some functions to check acl on the application.
|
Here are defined some functions to check acl on the application.
|
||||||
"""
|
"""
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
def can_view(user):
|
def can_view(user):
|
||||||
"""Check if an user can view the application.
|
"""Check if an user can view the application.
|
||||||
|
@ -38,4 +38,6 @@ def can_view(user):
|
||||||
viewing is granted and msg is a message (can be None).
|
viewing is granted and msg is a message (can be None).
|
||||||
"""
|
"""
|
||||||
can = user.has_module_perms('users')
|
can = user.has_module_perms('users')
|
||||||
return can, None if can else "Vous ne pouvez pas voir cette application."
|
return can, None if can else _("You don't have the right to view this"
|
||||||
|
" application.")
|
||||||
|
|
||||||
|
|
116
users/forms.py
116
users/forms.py
|
@ -39,6 +39,7 @@ from django.contrib.auth.forms import ReadOnlyPasswordHashField
|
||||||
from django.core.validators import MinLengthValidator
|
from django.core.validators import MinLengthValidator
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.contrib.auth.models import Group, Permission
|
from django.contrib.auth.models import Group, Permission
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from preferences.models import OptionalUser
|
from preferences.models import OptionalUser
|
||||||
from re2o.utils import remove_user_room, get_input_formats_help_text
|
from re2o.utils import remove_user_room, get_input_formats_help_text
|
||||||
|
@ -66,18 +67,18 @@ class PassForm(FormRevMixin, FieldPermissionFormMixin, forms.ModelForm):
|
||||||
nouveaux mots de passe renseignés sont identiques et respectent
|
nouveaux mots de passe renseignés sont identiques et respectent
|
||||||
une norme"""
|
une norme"""
|
||||||
selfpasswd = forms.CharField(
|
selfpasswd = forms.CharField(
|
||||||
label=u'Saisir le mot de passe existant',
|
label=_("Current password"),
|
||||||
max_length=255,
|
max_length=255,
|
||||||
widget=forms.PasswordInput
|
widget=forms.PasswordInput
|
||||||
)
|
)
|
||||||
passwd1 = forms.CharField(
|
passwd1 = forms.CharField(
|
||||||
label=u'Nouveau mot de passe',
|
label=_("New password"),
|
||||||
max_length=255,
|
max_length=255,
|
||||||
validators=[MinLengthValidator(8)],
|
validators=[MinLengthValidator(8)],
|
||||||
widget=forms.PasswordInput
|
widget=forms.PasswordInput
|
||||||
)
|
)
|
||||||
passwd2 = forms.CharField(
|
passwd2 = forms.CharField(
|
||||||
label=u'Saisir à nouveau le mot de passe',
|
label=_("New password confirmation"),
|
||||||
max_length=255,
|
max_length=255,
|
||||||
validators=[MinLengthValidator(8)],
|
validators=[MinLengthValidator(8)],
|
||||||
widget=forms.PasswordInput
|
widget=forms.PasswordInput
|
||||||
|
@ -94,7 +95,7 @@ class PassForm(FormRevMixin, FieldPermissionFormMixin, forms.ModelForm):
|
||||||
password2 = self.cleaned_data.get("passwd2")
|
password2 = self.cleaned_data.get("passwd2")
|
||||||
if password1 and password2 and password1 != password2:
|
if password1 and password2 and password1 != password2:
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
"Les 2 nouveaux mots de passe sont différents"
|
_("The new passwords don't match.")
|
||||||
)
|
)
|
||||||
return password2
|
return password2
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ class PassForm(FormRevMixin, FieldPermissionFormMixin, forms.ModelForm):
|
||||||
if not self.instance.check_password(
|
if not self.instance.check_password(
|
||||||
self.cleaned_data.get("selfpasswd")
|
self.cleaned_data.get("selfpasswd")
|
||||||
):
|
):
|
||||||
raise forms.ValidationError("Le mot de passe actuel est incorrect")
|
raise forms.ValidationError(_("The current password is incorrect."))
|
||||||
return
|
return
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
@ -121,18 +122,18 @@ class UserCreationForm(FormRevMixin, forms.ModelForm):
|
||||||
l'admin, lors de la creation d'un user par admin. Inclu tous les
|
l'admin, lors de la creation d'un user par admin. Inclu tous les
|
||||||
champs obligatoires"""
|
champs obligatoires"""
|
||||||
password1 = forms.CharField(
|
password1 = forms.CharField(
|
||||||
label='Password',
|
label=_("Password"),
|
||||||
widget=forms.PasswordInput,
|
widget=forms.PasswordInput,
|
||||||
validators=[MinLengthValidator(8)],
|
validators=[MinLengthValidator(8)],
|
||||||
max_length=255
|
max_length=255
|
||||||
)
|
)
|
||||||
password2 = forms.CharField(
|
password2 = forms.CharField(
|
||||||
label='Password confirmation',
|
label=_("Password confirmation"),
|
||||||
widget=forms.PasswordInput,
|
widget=forms.PasswordInput,
|
||||||
validators=[MinLengthValidator(8)],
|
validators=[MinLengthValidator(8)],
|
||||||
max_length=255
|
max_length=255
|
||||||
)
|
)
|
||||||
is_admin = forms.BooleanField(label='is admin')
|
is_admin = forms.BooleanField(label=_("Is admin"))
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
|
@ -142,7 +143,8 @@ class UserCreationForm(FormRevMixin, forms.ModelForm):
|
||||||
if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get('email'):
|
if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get('email'):
|
||||||
return self.cleaned_data.get('email').lower()
|
return self.cleaned_data.get('email').lower()
|
||||||
else:
|
else:
|
||||||
raise forms.ValidationError("You can't use an internal address as your external address.")
|
raise forms.ValidationError(_("You can't use an internal address"
|
||||||
|
" as your external address."))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Adherent
|
model = Adherent
|
||||||
|
@ -154,7 +156,7 @@ class UserCreationForm(FormRevMixin, forms.ModelForm):
|
||||||
password1 = self.cleaned_data.get("password1")
|
password1 = self.cleaned_data.get("password1")
|
||||||
password2 = self.cleaned_data.get("password2")
|
password2 = self.cleaned_data.get("password2")
|
||||||
if password1 and password2 and password1 != password2:
|
if password1 and password2 and password1 != password2:
|
||||||
raise forms.ValidationError("Passwords don't match")
|
raise forms.ValidationError(_("The passwords don't match."))
|
||||||
return password2
|
return password2
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
@ -173,13 +175,13 @@ class ServiceUserCreationForm(FormRevMixin, forms.ModelForm):
|
||||||
Formulaire pour la creation de nouveaux serviceusers.
|
Formulaire pour la creation de nouveaux serviceusers.
|
||||||
Requiert seulement un mot de passe; et un pseudo"""
|
Requiert seulement un mot de passe; et un pseudo"""
|
||||||
password1 = forms.CharField(
|
password1 = forms.CharField(
|
||||||
label='Password',
|
label=_("Password"),
|
||||||
widget=forms.PasswordInput,
|
widget=forms.PasswordInput,
|
||||||
min_length=8,
|
min_length=8,
|
||||||
max_length=255
|
max_length=255
|
||||||
)
|
)
|
||||||
password2 = forms.CharField(
|
password2 = forms.CharField(
|
||||||
label='Password confirmation',
|
label=_("Password confirmation"),
|
||||||
widget=forms.PasswordInput,
|
widget=forms.PasswordInput,
|
||||||
min_length=8,
|
min_length=8,
|
||||||
max_length=255
|
max_length=255
|
||||||
|
@ -203,7 +205,7 @@ class ServiceUserCreationForm(FormRevMixin, forms.ModelForm):
|
||||||
password1 = self.cleaned_data.get("password1")
|
password1 = self.cleaned_data.get("password1")
|
||||||
password2 = self.cleaned_data.get("password2")
|
password2 = self.cleaned_data.get("password2")
|
||||||
if password1 and password2 and password1 != password2:
|
if password1 and password2 and password1 != password2:
|
||||||
raise forms.ValidationError("Passwords don't match")
|
raise forms.ValidationError(_("The passwords don't match."))
|
||||||
return password2
|
return password2
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
@ -222,7 +224,7 @@ class UserChangeForm(FormRevMixin, forms.ModelForm):
|
||||||
Formulaire pour la modification d'un user coté admin
|
Formulaire pour la modification d'un user coté admin
|
||||||
"""
|
"""
|
||||||
password = ReadOnlyPasswordHashField()
|
password = ReadOnlyPasswordHashField()
|
||||||
is_admin = forms.BooleanField(label='is admin', required=False)
|
is_admin = forms.BooleanField(label=_("Is admin"), required=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Adherent
|
model = Adherent
|
||||||
|
@ -231,7 +233,7 @@ class UserChangeForm(FormRevMixin, forms.ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(UserChangeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(UserChangeForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
print("User is admin : %s" % kwargs['instance'].is_admin)
|
print(_("User is admin: %s") % kwargs['instance'].is_admin)
|
||||||
self.initial['is_admin'] = kwargs['instance'].is_admin
|
self.initial['is_admin'] = kwargs['instance'].is_admin
|
||||||
|
|
||||||
def clean_password(self):
|
def clean_password(self):
|
||||||
|
@ -279,7 +281,7 @@ class ServiceUserChangeForm(FormRevMixin, forms.ModelForm):
|
||||||
class ResetPasswordForm(forms.Form):
|
class ResetPasswordForm(forms.Form):
|
||||||
"""Formulaire de demande de reinitialisation de mot de passe,
|
"""Formulaire de demande de reinitialisation de mot de passe,
|
||||||
mdp oublié"""
|
mdp oublié"""
|
||||||
pseudo = forms.CharField(label=u'Pseudo', max_length=255)
|
pseudo = forms.CharField(label=_("Username"), max_length=255)
|
||||||
email = forms.EmailField(max_length=255)
|
email = forms.EmailField(max_length=255)
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,8 +296,9 @@ class MassArchiveForm(forms.Form):
|
||||||
date = cleaned_data.get("date")
|
date = cleaned_data.get("date")
|
||||||
if date:
|
if date:
|
||||||
if date > timezone.now():
|
if date > timezone.now():
|
||||||
raise forms.ValidationError("Impossible d'archiver des\
|
raise forms.ValidationError(_("Impossible to archive users"
|
||||||
utilisateurs dont la fin d'accès se situe dans le futur !")
|
" whose end access date is in"
|
||||||
|
" the future."))
|
||||||
|
|
||||||
|
|
||||||
class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
|
@ -305,20 +308,22 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(AdherentForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(AdherentForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = 'Prénom'
|
self.fields['name'].label = _("First name")
|
||||||
self.fields['surname'].label = 'Nom'
|
self.fields['surname'].label = _("Surname")
|
||||||
self.fields['email'].label = 'Adresse mail'
|
self.fields['email'].label = _("Email address")
|
||||||
self.fields['school'].label = 'Établissement'
|
self.fields['school'].label = _("School")
|
||||||
self.fields['comment'].label = 'Commentaire'
|
self.fields['comment'].label = _("Comment")
|
||||||
self.fields['room'].label = 'Chambre'
|
self.fields['room'].label = _("Room")
|
||||||
self.fields['room'].empty_label = "Pas de chambre"
|
self.fields['room'].empty_label = _("No room")
|
||||||
self.fields['school'].empty_label = "Séléctionner un établissement"
|
self.fields['school'].empty_label = _("Select a school")
|
||||||
|
|
||||||
def clean_email(self):
|
def clean_email(self):
|
||||||
if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get('email'):
|
if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get('email'):
|
||||||
return self.cleaned_data.get('email').lower()
|
return self.cleaned_data.get('email').lower()
|
||||||
else:
|
else:
|
||||||
raise forms.ValidationError("Vous ne pouvez pas utiliser une addresse {}".format(OptionalUser.objects.first().local_email_domain))
|
raise forms.ValidationError(
|
||||||
|
_("You can't use a {} address.").format(
|
||||||
|
OptionalUser.objects.first().local_email_domain))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Adherent
|
model = Adherent
|
||||||
|
@ -342,7 +347,7 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
telephone = self.cleaned_data['telephone']
|
telephone = self.cleaned_data['telephone']
|
||||||
if not telephone and OptionalUser.get_cached_value('is_tel_mandatory'):
|
if not telephone and OptionalUser.get_cached_value('is_tel_mandatory'):
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
"Un numéro de téléphone valide est requis"
|
_("A valid telephone number is required.")
|
||||||
)
|
)
|
||||||
return telephone
|
return telephone
|
||||||
|
|
||||||
|
@ -353,7 +358,7 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
return gpg_fingerprint.replace(' ', '').upper()
|
return gpg_fingerprint.replace(' ', '').upper()
|
||||||
|
|
||||||
force = forms.BooleanField(
|
force = forms.BooleanField(
|
||||||
label="Forcer le déménagement ?",
|
label=_("Force the move?"),
|
||||||
initial=False,
|
initial=False,
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
@ -373,13 +378,13 @@ class ClubForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ClubForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ClubForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['surname'].label = 'Nom'
|
self.fields['surname'].label = _("Name")
|
||||||
self.fields['school'].label = 'Établissement'
|
self.fields['school'].label = _("School")
|
||||||
self.fields['comment'].label = 'Commentaire'
|
self.fields['comment'].label = _("Comment")
|
||||||
self.fields['room'].label = 'Local'
|
self.fields['room'].label = _("Room")
|
||||||
self.fields['room'].empty_label = "Pas de chambre"
|
self.fields['room'].empty_label = _("No room")
|
||||||
self.fields['school'].empty_label = "Séléctionner un établissement"
|
self.fields['school'].empty_label = _("Select a school")
|
||||||
self.fields['mailing'].label = 'Utiliser une mailing'
|
self.fields['mailing'].label = _("Use a mailing list")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Club
|
model = Club
|
||||||
|
@ -400,7 +405,7 @@ class ClubForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
telephone = self.cleaned_data['telephone']
|
telephone = self.cleaned_data['telephone']
|
||||||
if not telephone and OptionalUser.get_cached_value('is_tel_mandatory'):
|
if not telephone and OptionalUser.get_cached_value('is_tel_mandatory'):
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
"Un numéro de téléphone valide est requis"
|
_("A valid telephone number is required.")
|
||||||
)
|
)
|
||||||
return telephone
|
return telephone
|
||||||
|
|
||||||
|
@ -436,7 +441,7 @@ class PasswordForm(FormRevMixin, ModelForm):
|
||||||
class ServiceUserForm(FormRevMixin, ModelForm):
|
class ServiceUserForm(FormRevMixin, ModelForm):
|
||||||
""" Modification d'un service user"""
|
""" Modification d'un service user"""
|
||||||
password = forms.CharField(
|
password = forms.CharField(
|
||||||
label=u'Nouveau mot de passe',
|
label=_("New password"),
|
||||||
max_length=255,
|
max_length=255,
|
||||||
validators=[MinLengthValidator(8)],
|
validators=[MinLengthValidator(8)],
|
||||||
widget=forms.PasswordInput,
|
widget=forms.PasswordInput,
|
||||||
|
@ -493,7 +498,7 @@ class GroupForm(FieldPermissionFormMixin, FormRevMixin, ModelForm):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(GroupForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(GroupForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
if 'is_superuser' in self.fields:
|
if 'is_superuser' in self.fields:
|
||||||
self.fields['is_superuser'].label = "Superuser"
|
self.fields['is_superuser'].label = _("Superuser")
|
||||||
|
|
||||||
|
|
||||||
class SchoolForm(FormRevMixin, ModelForm):
|
class SchoolForm(FormRevMixin, ModelForm):
|
||||||
|
@ -505,7 +510,7 @@ class SchoolForm(FormRevMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(SchoolForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(SchoolForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['name'].label = 'Établissement'
|
self.fields['name'].label = _("School")
|
||||||
|
|
||||||
|
|
||||||
class ShellForm(FormRevMixin, ModelForm):
|
class ShellForm(FormRevMixin, ModelForm):
|
||||||
|
@ -517,7 +522,7 @@ class ShellForm(FormRevMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ShellForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ShellForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['shell'].label = 'Nom du shell'
|
self.fields['shell'].label = _("Shell name")
|
||||||
|
|
||||||
|
|
||||||
class ListRightForm(FormRevMixin, ModelForm):
|
class ListRightForm(FormRevMixin, ModelForm):
|
||||||
|
@ -536,7 +541,7 @@ class ListRightForm(FormRevMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ListRightForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ListRightForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['unix_name'].label = 'Nom UNIX du groupe'
|
self.fields['unix_name'].label = _("Name of the group of rights")
|
||||||
|
|
||||||
|
|
||||||
class NewListRightForm(ListRightForm):
|
class NewListRightForm(ListRightForm):
|
||||||
|
@ -547,15 +552,15 @@ class NewListRightForm(ListRightForm):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(NewListRightForm, self).__init__(*args, **kwargs)
|
super(NewListRightForm, self).__init__(*args, **kwargs)
|
||||||
self.fields['gid'].label = ("Gid, attention, cet attribut ne doit "
|
self.fields['gid'].label = _("GID. Warning: this field must not be"
|
||||||
"pas être modifié après création")
|
" edited after creation.")
|
||||||
|
|
||||||
|
|
||||||
class DelListRightForm(Form):
|
class DelListRightForm(Form):
|
||||||
"""Suppression d'un ou plusieurs groupes"""
|
"""Suppression d'un ou plusieurs groupes"""
|
||||||
listrights = forms.ModelMultipleChoiceField(
|
listrights = forms.ModelMultipleChoiceField(
|
||||||
queryset=ListRight.objects.none(),
|
queryset=ListRight.objects.none(),
|
||||||
label="Droits actuels",
|
label=_("Current groups of rights"),
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -572,7 +577,7 @@ class DelSchoolForm(Form):
|
||||||
"""Suppression d'une ou plusieurs écoles"""
|
"""Suppression d'une ou plusieurs écoles"""
|
||||||
schools = forms.ModelMultipleChoiceField(
|
schools = forms.ModelMultipleChoiceField(
|
||||||
queryset=School.objects.none(),
|
queryset=School.objects.none(),
|
||||||
label="Etablissements actuels",
|
label=_("Current schools"),
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -590,7 +595,7 @@ class BanForm(FormRevMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(BanForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(BanForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['date_end'].label = 'Date de fin'
|
self.fields['date_end'].label = _("End date")
|
||||||
self.fields['date_end'].localize = False
|
self.fields['date_end'].localize = False
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -604,7 +609,7 @@ class WhitelistForm(FormRevMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(WhitelistForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(WhitelistForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['date_end'].label = 'Date de fin'
|
self.fields['date_end'].label = _("End date")
|
||||||
self.fields['date_end'].localize = False
|
self.fields['date_end'].localize = False
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -618,8 +623,8 @@ class EMailAddressForm(FormRevMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EMailAddressForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EMailAddressForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['local_part'].label = "Local part of the email"
|
self.fields['local_part'].label = _("Local part of the email address")
|
||||||
self.fields['local_part'].help_text = "Can't contain @"
|
self.fields['local_part'].help_text = _("Can't contain @")
|
||||||
|
|
||||||
def clean_local_part(self):
|
def clean_local_part(self):
|
||||||
return self.cleaned_data.get('local_part').lower()
|
return self.cleaned_data.get('local_part').lower()
|
||||||
|
@ -634,18 +639,21 @@ class EmailSettingsForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(EmailSettingsForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EmailSettingsForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['email'].label = "Main email address"
|
self.fields['email'].label = _("Main email address")
|
||||||
if 'local_email_redirect' in self.fields:
|
if 'local_email_redirect' in self.fields:
|
||||||
self.fields['local_email_redirect'].label = "Redirect local emails"
|
self.fields['local_email_redirect'].label = _("Redirect local emails")
|
||||||
if 'local_email_enabled' in self.fields:
|
if 'local_email_enabled' in self.fields:
|
||||||
self.fields['local_email_enabled'].label = "Use local emails"
|
self.fields['local_email_enabled'].label = _("Use local emails")
|
||||||
|
|
||||||
def clean_email(self):
|
def clean_email(self):
|
||||||
if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get('email'):
|
if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get('email'):
|
||||||
return self.cleaned_data.get('email').lower()
|
return self.cleaned_data.get('email').lower()
|
||||||
else:
|
else:
|
||||||
raise forms.ValidationError("Vous ne pouvez pas utiliser une addresse {}".format(OptionalUser.objects.first().local_email_domain))
|
raise forms.ValidationError(
|
||||||
|
_("You can't use a {} address.").format(
|
||||||
|
OptionalUser.objects.first().local_email_domain))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ['email','local_email_enabled', 'local_email_redirect']
|
fields = ['email','local_email_enabled', 'local_email_redirect']
|
||||||
|
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
109
users/migrations/0076_auto_20180818_1321.py
Normal file
109
users/migrations/0076_auto_20180818_1321.py
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.7 on 2018-08-18 11:21
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
import django.core.validators
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import users.models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0075_merge_20180815_2202'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='adherent',
|
||||||
|
options={'permissions': (('change_user_password', 'Can change the password of a user'), ('change_user_state', 'Can edit the state of a user'), ('change_user_force', 'Can force the move'), ('change_user_shell', 'Can edit the shell of a user'), ('change_user_groups', 'Can edit the groups of rights of a user (critical permission)'), ('change_all_users', 'Can edit all users, including those with rights.'), ('view_user', 'Can view a user object')), 'verbose_name': 'member', 'verbose_name_plural': 'members'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='ban',
|
||||||
|
options={'permissions': (('view_ban', 'Can view a ban object'),), 'verbose_name': 'ban', 'verbose_name_plural': 'bans'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='club',
|
||||||
|
options={'permissions': (('change_user_password', 'Can change the password of a user'), ('change_user_state', 'Can edit the state of a user'), ('change_user_force', 'Can force the move'), ('change_user_shell', 'Can edit the shell of a user'), ('change_user_groups', 'Can edit the groups of rights of a user (critical permission)'), ('change_all_users', 'Can edit all users, including those with rights.'), ('view_user', 'Can view a user object')), 'verbose_name': 'club', 'verbose_name_plural': 'clubs'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='emailaddress',
|
||||||
|
options={'permissions': (('view_emailaddress', 'Can view a local email account object'),), 'verbose_name': 'local email account', 'verbose_name_plural': 'local email accounts'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='listright',
|
||||||
|
options={'permissions': (('view_listright', 'Can view a group of rights object'),), 'verbose_name': 'group of rights', 'verbose_name_plural': 'groups of rights'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='listshell',
|
||||||
|
options={'permissions': (('view_listshell', 'Can view a shell object'),), 'verbose_name': 'shell', 'verbose_name_plural': 'shells'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='school',
|
||||||
|
options={'permissions': (('view_school', 'Can view a school object'),), 'verbose_name': 'school', 'verbose_name_plural': 'schools'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='serviceuser',
|
||||||
|
options={'permissions': (('view_serviceuser', 'Can view a service user object'),), 'verbose_name': 'service user', 'verbose_name_plural': 'service users'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='user',
|
||||||
|
options={'permissions': (('change_user_password', 'Can change the password of a user'), ('change_user_state', 'Can edit the state of a user'), ('change_user_force', 'Can force the move'), ('change_user_shell', 'Can edit the shell of a user'), ('change_user_groups', 'Can edit the groups of rights of a user (critical permission)'), ('change_all_users', 'Can edit all users, including those with rights.'), ('view_user', 'Can view a user object')), 'verbose_name': 'user (member or club)', 'verbose_name_plural': 'users (members or clubs)'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='whitelist',
|
||||||
|
options={'permissions': (('view_whitelist', 'Can view a whitelist object'),), 'verbose_name': 'whitelist (free of charge access)', 'verbose_name_plural': 'whitelists (free of charge access)'},
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adherent',
|
||||||
|
name='gpg_fingerprint',
|
||||||
|
field=models.CharField(blank=True, max_length=40, null=True, validators=[django.core.validators.RegexValidator('^[0-9A-F]{40}$', message='A GPG fingerprint must contain 40 hexadecimal characters.')]),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='ban',
|
||||||
|
name='state',
|
||||||
|
field=models.IntegerField(choices=[(0, 'HARD (no access)'), (1, 'SOFT (local access only)'), (2, 'RESTRICTED (speed limitation)')], default=0),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='emailaddress',
|
||||||
|
name='user',
|
||||||
|
field=models.ForeignKey(help_text='User of the local email account', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='listright',
|
||||||
|
name='unix_name',
|
||||||
|
field=models.CharField(max_length=255, unique=True, validators=[django.core.validators.RegexValidator('^[a-z]+$', message='UNIX groups can only contain lower case letters.')]),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='request',
|
||||||
|
name='type',
|
||||||
|
field=models.CharField(choices=[('PW', 'Password'), ('EM', 'Email address')], max_length=2),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='serviceuser',
|
||||||
|
name='comment',
|
||||||
|
field=models.CharField(blank=True, help_text='Comment', max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='serviceuser',
|
||||||
|
name='pseudo',
|
||||||
|
field=models.CharField(help_text='Must only contain letters, numerals or dashes.', max_length=32, unique=True, validators=[users.models.linux_user_validator]),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='user',
|
||||||
|
name='comment',
|
||||||
|
field=models.CharField(blank=True, help_text='Comment, school year', max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='user',
|
||||||
|
name='local_email_redirect',
|
||||||
|
field=models.BooleanField(default=False, help_text='Enable redirection of the local email messages to the main email address.'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='user',
|
||||||
|
name='pseudo',
|
||||||
|
field=models.CharField(help_text='Must only contain letters, numerals or dashes.', max_length=32, unique=True, validators=[users.models.linux_user_validator]),
|
||||||
|
),
|
||||||
|
]
|
267
users/models.py
267
users/models.py
|
@ -70,6 +70,8 @@ from django.contrib.auth.models import (
|
||||||
)
|
)
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
import traceback
|
import traceback
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from reversion import revisions as reversion
|
from reversion import revisions as reversion
|
||||||
|
|
||||||
import ldapdb.models
|
import ldapdb.models
|
||||||
|
@ -100,7 +102,7 @@ def linux_user_validator(login):
|
||||||
pas les contraintes unix (maj, min, chiffres ou tiret)"""
|
pas les contraintes unix (maj, min, chiffres ou tiret)"""
|
||||||
if not linux_user_check(login):
|
if not linux_user_check(login):
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
", ce pseudo ('%(label)s') contient des carractères interdits",
|
_("The username '%(label)s' contains forbidden characters."),
|
||||||
params={'label': login},
|
params={'label': login},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -142,10 +144,10 @@ class UserManager(BaseUserManager):
|
||||||
su=False
|
su=False
|
||||||
):
|
):
|
||||||
if not pseudo:
|
if not pseudo:
|
||||||
raise ValueError('Users must have an username')
|
raise ValueError(_("Users must have an username."))
|
||||||
|
|
||||||
if not linux_user_check(pseudo):
|
if not linux_user_check(pseudo):
|
||||||
raise ValueError('Username shall only contain [a-z0-9-]')
|
raise ValueError(_("Username should only contain [a-z0-9-]."))
|
||||||
|
|
||||||
user = Adherent(
|
user = Adherent(
|
||||||
pseudo=pseudo,
|
pseudo=pseudo,
|
||||||
|
@ -180,7 +182,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
""" Definition de l'utilisateur de base.
|
""" Definition de l'utilisateur de base.
|
||||||
Champs principaux : name, surnname, pseudo, email, room, password
|
Champs principaux : name, surnname, pseudo, email, room, password
|
||||||
Herite du django BaseUser et du système d'auth django"""
|
Herite du django BaseUser et du système d'auth django"""
|
||||||
PRETTY_NAME = "Utilisateurs (clubs et adhérents)"
|
|
||||||
STATE_ACTIVE = 0
|
STATE_ACTIVE = 0
|
||||||
STATE_DISABLED = 1
|
STATE_DISABLED = 1
|
||||||
STATE_ARCHIVE = 2
|
STATE_ARCHIVE = 2
|
||||||
|
@ -194,21 +196,22 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
pseudo = models.CharField(
|
pseudo = models.CharField(
|
||||||
max_length=32,
|
max_length=32,
|
||||||
unique=True,
|
unique=True,
|
||||||
help_text="Doit contenir uniquement des lettres, chiffres, ou tirets",
|
help_text=_("Must only contain letters, numerals or dashes."),
|
||||||
validators=[linux_user_validator]
|
validators=[linux_user_validator]
|
||||||
)
|
)
|
||||||
email = models.EmailField(
|
email = models.EmailField(
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text="External email address allowing us to contact you."
|
help_text=_("External email address allowing us to contact you.")
|
||||||
)
|
)
|
||||||
local_email_redirect = models.BooleanField(
|
local_email_redirect = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
help_text="Enable redirection of the local email messages to the main email."
|
help_text=_("Enable redirection of the local email messages to the"
|
||||||
|
" main email address.")
|
||||||
)
|
)
|
||||||
local_email_enabled = models.BooleanField(
|
local_email_enabled = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
help_text="Enable the local email account."
|
help_text=_("Enable the local email account.")
|
||||||
)
|
)
|
||||||
school = models.ForeignKey(
|
school = models.ForeignKey(
|
||||||
'School',
|
'School',
|
||||||
|
@ -223,7 +226,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
comment = models.CharField(
|
comment = models.CharField(
|
||||||
help_text="Commentaire, promo",
|
help_text=_("Comment, school year"),
|
||||||
max_length=255,
|
max_length=255,
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
|
@ -249,18 +252,20 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
("change_user_password",
|
("change_user_password",
|
||||||
"Peut changer le mot de passe d'un user"),
|
_("Can change the password of a user")),
|
||||||
("change_user_state", "Peut éditer l'etat d'un user"),
|
("change_user_state", _("Can edit the state of a user")),
|
||||||
("change_user_force", "Peut forcer un déménagement"),
|
("change_user_force", _("Can force the move")),
|
||||||
("change_user_shell", "Peut éditer le shell d'un user"),
|
("change_user_shell", _("Can edit the shell of a user")),
|
||||||
("change_user_groups",
|
("change_user_groups",
|
||||||
"Peut éditer les groupes d'un user ! Permission critique"),
|
_("Can edit the groups of rights of a user (critical"
|
||||||
|
" permission)")),
|
||||||
("change_all_users",
|
("change_all_users",
|
||||||
"Peut éditer tous les users, y compris ceux dotés de droits. "
|
_("Can edit all users, including those with rights.")),
|
||||||
"Superdroit"),
|
|
||||||
("view_user",
|
("view_user",
|
||||||
"Peut voir un objet user quelquonque"),
|
_("Can view a user object")),
|
||||||
)
|
)
|
||||||
|
verbose_name = _("user (member or club)")
|
||||||
|
verbose_name_plural = _("users (members or clubs)")
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -278,7 +283,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
elif self.is_class_club:
|
elif self.is_class_club:
|
||||||
return self.club.room
|
return self.club.room
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("Type inconnu")
|
raise NotImplementedError(_("Unknown type."))
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def get_mail_addresses(self):
|
def get_mail_addresses(self):
|
||||||
|
@ -298,11 +303,11 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
def class_name(self):
|
def class_name(self):
|
||||||
"""Renvoie si il s'agit d'un adhérent ou d'un club"""
|
"""Renvoie si il s'agit d'un adhérent ou d'un club"""
|
||||||
if hasattr(self, 'adherent'):
|
if hasattr(self, 'adherent'):
|
||||||
return "Adherent"
|
return _("Member")
|
||||||
elif hasattr(self, 'club'):
|
elif hasattr(self, 'club'):
|
||||||
return "Club"
|
return _("Club")
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("Type inconnu")
|
raise NotImplementedError(_("Unknown type."))
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def gid_number(self):
|
def gid_number(self):
|
||||||
|
@ -513,7 +518,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
if not interface.ipv4:
|
if not interface.ipv4:
|
||||||
with transaction.atomic(), reversion.create_revision():
|
with transaction.atomic(), reversion.create_revision():
|
||||||
interface.assign_ipv4()
|
interface.assign_ipv4()
|
||||||
reversion.set_comment("Assignation ipv4")
|
reversion.set_comment(_("IPv4 assigning"))
|
||||||
interface.save()
|
interface.save()
|
||||||
|
|
||||||
def unassign_ips(self):
|
def unassign_ips(self):
|
||||||
|
@ -522,7 +527,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
for interface in interfaces:
|
for interface in interfaces:
|
||||||
with transaction.atomic(), reversion.create_revision():
|
with transaction.atomic(), reversion.create_revision():
|
||||||
interface.unassign_ipv4()
|
interface.unassign_ipv4()
|
||||||
reversion.set_comment("Désassignation ipv4")
|
reversion.set_comment(_("IPv4 unassigning"))
|
||||||
interface.save()
|
interface.save()
|
||||||
|
|
||||||
def archive(self):
|
def archive(self):
|
||||||
|
@ -669,10 +674,9 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
if all_interfaces.count() > OptionalMachine.get_cached_value(
|
if all_interfaces.count() > OptionalMachine.get_cached_value(
|
||||||
'max_lambdauser_interfaces'
|
'max_lambdauser_interfaces'
|
||||||
):
|
):
|
||||||
return False, "Maximum de machines enregistrees atteinte"
|
return False, _("Maximum number of registered machines reached.")
|
||||||
if not nas_type:
|
if not nas_type:
|
||||||
return False, "Re2o ne sait pas à quel machinetype affecter cette\
|
return False, _("Re2o doesn't know wich machine type to assign.")
|
||||||
machine"
|
|
||||||
machine_type_cible = nas_type.machine_type
|
machine_type_cible = nas_type.machine_type
|
||||||
try:
|
try:
|
||||||
machine_parent = Machine()
|
machine_parent = Machine()
|
||||||
|
@ -768,7 +772,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
user_request.adherent in self.club.administrators.all()):
|
user_request.adherent in self.club.administrators.all()):
|
||||||
return True, None
|
return True, None
|
||||||
else:
|
else:
|
||||||
return False, u"Vous n'avez pas le droit d'éditer ce club"
|
return False, _("You don't have the right to edit this club.")
|
||||||
else:
|
else:
|
||||||
if self == user_request:
|
if self == user_request:
|
||||||
return True, None
|
return True, None
|
||||||
|
@ -776,18 +780,19 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
return True, None
|
return True, None
|
||||||
elif user_request.has_perm('users.change_user'):
|
elif user_request.has_perm('users.change_user'):
|
||||||
if self.groups.filter(listright__critical=True):
|
if self.groups.filter(listright__critical=True):
|
||||||
return False, (u"Utilisateurs avec droits critiques, ne "
|
return False, (_("User with critical rights, can't be"
|
||||||
"peut etre édité")
|
" edited."))
|
||||||
elif self == AssoOption.get_cached_value('utilisateur_asso'):
|
elif self == AssoOption.get_cached_value('utilisateur_asso'):
|
||||||
return False, (u"Impossible d'éditer l'utilisateur asso "
|
return False, (_("Impossible to edit the organisation's"
|
||||||
"sans droit change_all_users")
|
" user without the 'change_all_users'"
|
||||||
|
" right."))
|
||||||
else:
|
else:
|
||||||
return True, None
|
return True, None
|
||||||
elif user_request.has_perm('users.change_all_users'):
|
elif user_request.has_perm('users.change_all_users'):
|
||||||
return True, None
|
return True, None
|
||||||
else:
|
else:
|
||||||
return False, (u"Vous ne pouvez éditer un autre utilisateur "
|
return False, (_("You don't have the right to edit another"
|
||||||
"que vous même")
|
" user."))
|
||||||
|
|
||||||
def can_change_password(self, user_request, *_args, **_kwargs):
|
def can_change_password(self, user_request, *_args, **_kwargs):
|
||||||
"""Check if a user can change a user's password
|
"""Check if a user can change a user's password
|
||||||
|
@ -804,7 +809,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
user_request.adherent in self.club.administrators.all()):
|
user_request.adherent in self.club.administrators.all()):
|
||||||
return True, None
|
return True, None
|
||||||
else:
|
else:
|
||||||
return False, u"Vous n'avez pas le droit d'éditer ce club"
|
return False, _("You don't have the right to edit this club.")
|
||||||
else:
|
else:
|
||||||
if (self == user_request or
|
if (self == user_request or
|
||||||
user_request.has_perm('users.change_user_groups')):
|
user_request.has_perm('users.change_user_groups')):
|
||||||
|
@ -815,8 +820,8 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
not self.groups.all()):
|
not self.groups.all()):
|
||||||
return True, None
|
return True, None
|
||||||
else:
|
else:
|
||||||
return False, (u"Vous ne pouvez éditer un autre utilisateur "
|
return False, (_("You don't have the right to edit another"
|
||||||
"que vous même")
|
" user."))
|
||||||
|
|
||||||
def check_selfpasswd(self, user_request, *_args, **_kwargs):
|
def check_selfpasswd(self, user_request, *_args, **_kwargs):
|
||||||
""" Returns (True, None) if user_request is self, else returns
|
""" Returns (True, None) if user_request is self, else returns
|
||||||
|
@ -834,7 +839,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
user_request.has_perm('users.change_user_state'),
|
user_request.has_perm('users.change_user_state'),
|
||||||
"Droit requis pour changer l'état"
|
_("Permission required to change the state.")
|
||||||
)
|
)
|
||||||
|
|
||||||
def can_change_shell(self, user_request, *_args, **_kwargs):
|
def can_change_shell(self, user_request, *_args, **_kwargs):
|
||||||
|
@ -846,7 +851,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
if not ((self.pk == user_request.pk and OptionalUser.get_cached_value('self_change_shell'))
|
if not ((self.pk == user_request.pk and OptionalUser.get_cached_value('self_change_shell'))
|
||||||
or user_request.has_perm('users.change_user_shell')):
|
or user_request.has_perm('users.change_user_shell')):
|
||||||
return False, u"Droit requis pour changer le shell"
|
return False, _("Permission required to change the shell.")
|
||||||
else:
|
else:
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
|
@ -860,12 +865,12 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
OptionalUser.get_cached_value('local_email_accounts_enabled'),
|
OptionalUser.get_cached_value('local_email_accounts_enabled'),
|
||||||
"La gestion des comptes mails doit être activée"
|
_("Local email accounts must be enabled.")
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_change_local_email_enabled(user_request, *_args, **_kwargs):
|
def can_change_local_email_enabled(user_request, *_args, **_kwargs):
|
||||||
""" Check if a user can change internal address .
|
""" Check if a user can change internal address.
|
||||||
|
|
||||||
:param user_request: The user who request
|
:param user_request: The user who request
|
||||||
:returns: a message and a boolean which is True if the user has
|
:returns: a message and a boolean which is True if the user has
|
||||||
|
@ -873,7 +878,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
OptionalUser.get_cached_value('local_email_accounts_enabled'),
|
OptionalUser.get_cached_value('local_email_accounts_enabled'),
|
||||||
"La gestion des comptes mails doit être activée"
|
_("Local email accounts must be enabled.")
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -886,7 +891,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
user_request.has_perm('users.change_user_force'),
|
user_request.has_perm('users.change_user_force'),
|
||||||
"Droit requis pour forcer le déménagement"
|
_("Permission required to force the move.")
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -899,7 +904,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
user_request.has_perm('users.change_user_groups'),
|
user_request.has_perm('users.change_user_groups'),
|
||||||
"Droit requis pour éditer les groupes de l'user"
|
_("Permission required to edit the user's groups of rights.")
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -911,7 +916,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
user_request.is_superuser,
|
user_request.is_superuser,
|
||||||
"Droit superuser requis pour éditer le flag superuser"
|
_("'superuser' right required to edit the superuser flag.")
|
||||||
)
|
)
|
||||||
|
|
||||||
def can_view(self, user_request, *_args, **_kwargs):
|
def can_view(self, user_request, *_args, **_kwargs):
|
||||||
|
@ -929,14 +934,14 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
user_request.adherent in self.club.members.all()):
|
user_request.adherent in self.club.members.all()):
|
||||||
return True, None
|
return True, None
|
||||||
else:
|
else:
|
||||||
return False, u"Vous n'avez pas le droit de voir ce club"
|
return False, _("You don't have the right to view this club.")
|
||||||
else:
|
else:
|
||||||
if (self == user_request or
|
if (self == user_request or
|
||||||
user_request.has_perm('users.view_user')):
|
user_request.has_perm('users.view_user')):
|
||||||
return True, None
|
return True, None
|
||||||
else:
|
else:
|
||||||
return False, (u"Vous ne pouvez voir un autre utilisateur "
|
return False, (_("You don't have the right to view another"
|
||||||
"que vous même")
|
" user."))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_view_all(user_request, *_args, **_kwargs):
|
def can_view_all(user_request, *_args, **_kwargs):
|
||||||
|
@ -948,7 +953,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
user_request.has_perm('users.view_user'),
|
user_request.has_perm('users.view_user'),
|
||||||
u"Vous n'avez pas accès à la liste des utilisateurs."
|
_("You don't have the right to view the list of users.")
|
||||||
)
|
)
|
||||||
|
|
||||||
def can_delete(self, user_request, *_args, **_kwargs):
|
def can_delete(self, user_request, *_args, **_kwargs):
|
||||||
|
@ -961,7 +966,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
user_request.has_perm('users.delete_user'),
|
user_request.has_perm('users.delete_user'),
|
||||||
u"Vous ne pouvez pas supprimer cet utilisateur."
|
_("You don't have the right to delete this user.")
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -985,15 +990,15 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
if not self.local_email_enabled and not self.email:
|
if not self.local_email_enabled and not self.email:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
{'email': (
|
{'email': (
|
||||||
'There is neither a local email address nor an external'
|
_("There is neither a local email address nor an external"
|
||||||
' email address for this user.'
|
" email address for this user.")
|
||||||
), }
|
), }
|
||||||
)
|
)
|
||||||
if self.local_email_redirect and not self.email:
|
if self.local_email_redirect and not self.email:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
{'local_email_redirect': (
|
{'local_email_redirect': (
|
||||||
'You cannot redirect your local email if no external email '
|
_("You can't redirect your local emails if no external email"
|
||||||
'has been set.'), }
|
" address has been set.")), }
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -1003,7 +1008,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
class Adherent(User):
|
class Adherent(User):
|
||||||
""" A class representing a member (it's a user with special
|
""" A class representing a member (it's a user with special
|
||||||
informations) """
|
informations) """
|
||||||
PRETTY_NAME = "Adhérents"
|
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
room = models.OneToOneField(
|
room = models.OneToOneField(
|
||||||
'topologie.Room',
|
'topologie.Room',
|
||||||
|
@ -1017,11 +1022,29 @@ class Adherent(User):
|
||||||
null=True,
|
null=True,
|
||||||
validators=[RegexValidator(
|
validators=[RegexValidator(
|
||||||
'^[0-9A-F]{40}$',
|
'^[0-9A-F]{40}$',
|
||||||
message="Une fingerprint GPG doit contenir 40 "
|
message=_("A GPG fingerprint must contain 40 hexadecimal"
|
||||||
"caractères hexadécimaux"
|
" characters.")
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
permissions = (
|
||||||
|
("change_user_password",
|
||||||
|
_("Can change the password of a user")),
|
||||||
|
("change_user_state", _("Can edit the state of a user")),
|
||||||
|
("change_user_force", _("Can force the move")),
|
||||||
|
("change_user_shell", _("Can edit the shell of a user")),
|
||||||
|
("change_user_groups",
|
||||||
|
_("Can edit the groups of rights of a user (critical"
|
||||||
|
" permission)")),
|
||||||
|
("change_all_users",
|
||||||
|
_("Can edit all users, including those with rights.")),
|
||||||
|
("view_user",
|
||||||
|
_("Can view a user object")),
|
||||||
|
)
|
||||||
|
verbose_name = _("member")
|
||||||
|
verbose_name_plural = _("members")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_instance(cls, adherentid, *_args, **_kwargs):
|
def get_instance(cls, adherentid, *_args, **_kwargs):
|
||||||
"""Try to find an instance of `Adherent` with the given id.
|
"""Try to find an instance of `Adherent` with the given id.
|
||||||
|
@ -1049,14 +1072,14 @@ class Adherent(User):
|
||||||
else:
|
else:
|
||||||
return (
|
return (
|
||||||
user_request.has_perm('users.add_user'),
|
user_request.has_perm('users.add_user'),
|
||||||
u"Vous n'avez pas le droit de créer un utilisateur"
|
_("You don't have the right to create a user.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Club(User):
|
class Club(User):
|
||||||
""" A class representing a club (it is considered as a user
|
""" A class representing a club (it is considered as a user
|
||||||
with special informations) """
|
with special informations) """
|
||||||
PRETTY_NAME = "Clubs"
|
|
||||||
room = models.ForeignKey(
|
room = models.ForeignKey(
|
||||||
'topologie.Room',
|
'topologie.Room',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
|
@ -1077,6 +1100,24 @@ class Club(User):
|
||||||
default=False
|
default=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
permissions = (
|
||||||
|
("change_user_password",
|
||||||
|
_("Can change the password of a user")),
|
||||||
|
("change_user_state", _("Can edit the state of a user")),
|
||||||
|
("change_user_force", _("Can force the move")),
|
||||||
|
("change_user_shell", _("Can edit the shell of a user")),
|
||||||
|
("change_user_groups",
|
||||||
|
_("Can edit the groups of rights of a user (critical"
|
||||||
|
" permission)")),
|
||||||
|
("change_all_users",
|
||||||
|
_("Can edit all users, including those with rights.")),
|
||||||
|
("view_user",
|
||||||
|
_("Can view a user object")),
|
||||||
|
)
|
||||||
|
verbose_name = _("club")
|
||||||
|
verbose_name_plural = _("clubs")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_create(user_request, *_args, **_kwargs):
|
def can_create(user_request, *_args, **_kwargs):
|
||||||
"""Check if an user can create an user object.
|
"""Check if an user can create an user object.
|
||||||
|
@ -1093,7 +1134,7 @@ class Club(User):
|
||||||
else:
|
else:
|
||||||
return (
|
return (
|
||||||
user_request.has_perm('users.add_user'),
|
user_request.has_perm('users.add_user'),
|
||||||
u"Vous n'avez pas le droit de créer un club"
|
_("You don't have the right to create a club.")
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -1111,7 +1152,7 @@ class Club(User):
|
||||||
if (user_request.adherent.club_administrator.all() or
|
if (user_request.adherent.club_administrator.all() or
|
||||||
user_request.adherent.club_members.all()):
|
user_request.adherent.club_members.all()):
|
||||||
return True, None
|
return True, None
|
||||||
return False, u"Vous n'avez pas accès à la liste des utilisateurs."
|
return False, _("You don't have the right to view the list of users.")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_instance(cls, clubid, *_args, **_kwargs):
|
def get_instance(cls, clubid, *_args, **_kwargs):
|
||||||
|
@ -1176,12 +1217,10 @@ class ServiceUser(RevMixin, AclMixin, AbstractBaseUser):
|
||||||
('usermgmt', 'usermgmt'),
|
('usermgmt', 'usermgmt'),
|
||||||
)
|
)
|
||||||
|
|
||||||
PRETTY_NAME = "Utilisateurs de service"
|
|
||||||
|
|
||||||
pseudo = models.CharField(
|
pseudo = models.CharField(
|
||||||
max_length=32,
|
max_length=32,
|
||||||
unique=True,
|
unique=True,
|
||||||
help_text="Doit contenir uniquement des lettres, chiffres, ou tirets",
|
help_text=_("Must only contain letters, numerals or dashes."),
|
||||||
validators=[linux_user_validator]
|
validators=[linux_user_validator]
|
||||||
)
|
)
|
||||||
access_group = models.CharField(
|
access_group = models.CharField(
|
||||||
|
@ -1190,7 +1229,7 @@ class ServiceUser(RevMixin, AclMixin, AbstractBaseUser):
|
||||||
max_length=32
|
max_length=32
|
||||||
)
|
)
|
||||||
comment = models.CharField(
|
comment = models.CharField(
|
||||||
help_text="Commentaire",
|
help_text=_("Comment"),
|
||||||
max_length=255,
|
max_length=255,
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
|
@ -1200,12 +1239,14 @@ class ServiceUser(RevMixin, AclMixin, AbstractBaseUser):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
("view_serviceuser", "Peut voir un objet serviceuser"),
|
("view_serviceuser", _("Can view a service user object")),
|
||||||
)
|
)
|
||||||
|
verbose_name = _("service user")
|
||||||
|
verbose_name_plural = _("service users")
|
||||||
|
|
||||||
def get_full_name(self):
|
def get_full_name(self):
|
||||||
""" Renvoie le nom complet du serviceUser formaté nom/prénom"""
|
""" Renvoie le nom complet du serviceUser formaté nom/prénom"""
|
||||||
return "ServiceUser <{name}>".format(name=self.pseudo)
|
return _("Service user <{name}>").format(name=self.pseudo)
|
||||||
|
|
||||||
def get_short_name(self):
|
def get_short_name(self):
|
||||||
""" Renvoie seulement le nom"""
|
""" Renvoie seulement le nom"""
|
||||||
|
@ -1262,14 +1303,15 @@ def service_user_post_delete(**kwargs):
|
||||||
|
|
||||||
class School(RevMixin, AclMixin, models.Model):
|
class School(RevMixin, AclMixin, models.Model):
|
||||||
""" Etablissement d'enseignement"""
|
""" Etablissement d'enseignement"""
|
||||||
PRETTY_NAME = "Établissements enregistrés"
|
|
||||||
|
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
("view_school", "Peut voir un objet school"),
|
("view_school", _("Can view a school object")),
|
||||||
)
|
)
|
||||||
|
verbose_name = _("school")
|
||||||
|
verbose_name_plural = _("schools")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -1281,29 +1323,29 @@ class ListRight(RevMixin, AclMixin, Group):
|
||||||
Permet de gérer facilement les accès serveurs et autres
|
Permet de gérer facilement les accès serveurs et autres
|
||||||
La clef de recherche est le gid, pour cette raison là
|
La clef de recherche est le gid, pour cette raison là
|
||||||
il n'est plus modifiable après creation"""
|
il n'est plus modifiable après creation"""
|
||||||
PRETTY_NAME = "Liste des droits existants"
|
|
||||||
|
|
||||||
unix_name = models.CharField(
|
unix_name = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
unique=True,
|
unique=True,
|
||||||
validators=[RegexValidator(
|
validators=[RegexValidator(
|
||||||
'^[a-z]+$',
|
'^[a-z]+$',
|
||||||
message=("Les groupes unix ne peuvent contenir que des lettres "
|
message=(_("UNIX groups can only contain lower case letters."))
|
||||||
"minuscules")
|
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
gid = models.PositiveIntegerField(unique=True, null=True)
|
gid = models.PositiveIntegerField(unique=True, null=True)
|
||||||
critical = models.BooleanField(default=False)
|
critical = models.BooleanField(default=False)
|
||||||
details = models.CharField(
|
details = models.CharField(
|
||||||
help_text="Description",
|
help_text=_("Description"),
|
||||||
max_length=255,
|
max_length=255,
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
("view_listright", "Peut voir un objet Group/ListRight"),
|
("view_listright", _("Can view a group of rights object")),
|
||||||
)
|
)
|
||||||
|
verbose_name = _("group of rights")
|
||||||
|
verbose_name_plural = _("groups of rights")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -1345,14 +1387,16 @@ def listright_post_delete(**kwargs):
|
||||||
class ListShell(RevMixin, AclMixin, models.Model):
|
class ListShell(RevMixin, AclMixin, models.Model):
|
||||||
"""Un shell possible. Pas de check si ce shell existe, les
|
"""Un shell possible. Pas de check si ce shell existe, les
|
||||||
admin sont des grands"""
|
admin sont des grands"""
|
||||||
PRETTY_NAME = "Liste des shells disponibles"
|
|
||||||
|
|
||||||
shell = models.CharField(max_length=255, unique=True)
|
shell = models.CharField(max_length=255, unique=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
("view_listshell", "Peut voir un objet shell quelqu'il soit"),
|
("view_listshell", _("Can view a shell object")),
|
||||||
)
|
)
|
||||||
|
verbose_name = _("shell")
|
||||||
|
verbose_name_plural = _("shells")
|
||||||
|
|
||||||
|
|
||||||
def get_pretty_name(self):
|
def get_pretty_name(self):
|
||||||
"""Return the canonical name of the shell"""
|
"""Return the canonical name of the shell"""
|
||||||
|
@ -1365,15 +1409,14 @@ class ListShell(RevMixin, AclMixin, models.Model):
|
||||||
class Ban(RevMixin, AclMixin, models.Model):
|
class Ban(RevMixin, AclMixin, models.Model):
|
||||||
""" Bannissement. Actuellement a un effet tout ou rien.
|
""" Bannissement. Actuellement a un effet tout ou rien.
|
||||||
Gagnerait à être granulaire"""
|
Gagnerait à être granulaire"""
|
||||||
PRETTY_NAME = "Liste des bannissements"
|
|
||||||
|
|
||||||
STATE_HARD = 0
|
STATE_HARD = 0
|
||||||
STATE_SOFT = 1
|
STATE_SOFT = 1
|
||||||
STATE_BRIDAGE = 2
|
STATE_BRIDAGE = 2
|
||||||
STATES = (
|
STATES = (
|
||||||
(0, 'HARD (aucun accès)'),
|
(0, _("HARD (no access)")),
|
||||||
(1, 'SOFT (accès local seulement)'),
|
(1, _("SOFT (local access only)")),
|
||||||
(2, 'BRIDAGE (bridage du débit)'),
|
(2, _("RESTRICTED (speed limitation)")),
|
||||||
)
|
)
|
||||||
|
|
||||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||||
|
@ -1384,8 +1427,10 @@ class Ban(RevMixin, AclMixin, models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
("view_ban", "Peut voir un objet ban quelqu'il soit"),
|
("view_ban", _("Can view a ban object")),
|
||||||
)
|
)
|
||||||
|
verbose_name = _("ban")
|
||||||
|
verbose_name_plural = _("bans")
|
||||||
|
|
||||||
def notif_ban(self):
|
def notif_ban(self):
|
||||||
""" Prend en argument un objet ban, envoie un mail de notification """
|
""" Prend en argument un objet ban, envoie un mail de notification """
|
||||||
|
@ -1419,8 +1464,8 @@ class Ban(RevMixin, AclMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
if (not user_request.has_perm('users.view_ban') and
|
if (not user_request.has_perm('users.view_ban') and
|
||||||
self.user != user_request):
|
self.user != user_request):
|
||||||
return False, (u"Vous n'avez pas le droit de voir les "
|
return False, (_("You don't have the right to view bans other"
|
||||||
"bannissements autre que les vôtres")
|
" than yours."))
|
||||||
else:
|
else:
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
|
@ -1459,7 +1504,6 @@ class Whitelist(RevMixin, AclMixin, models.Model):
|
||||||
"""Accès à titre gracieux. L'utilisateur ne paye pas; se voit
|
"""Accès à titre gracieux. L'utilisateur ne paye pas; se voit
|
||||||
accorder un accès internet pour une durée défini. Moins
|
accorder un accès internet pour une durée défini. Moins
|
||||||
fort qu'un ban quel qu'il soit"""
|
fort qu'un ban quel qu'il soit"""
|
||||||
PRETTY_NAME = "Liste des accès gracieux"
|
|
||||||
|
|
||||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||||
raison = models.CharField(max_length=255)
|
raison = models.CharField(max_length=255)
|
||||||
|
@ -1468,8 +1512,10 @@ class Whitelist(RevMixin, AclMixin, models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
("view_whitelist", "Peut voir un objet whitelist"),
|
("view_whitelist", _("Can view a whitelist object")),
|
||||||
)
|
)
|
||||||
|
verbose_name = _("whitelist (free of charge access)")
|
||||||
|
verbose_name_plural = _("whitelists (free of charge access)")
|
||||||
|
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
""" Is this whitelisting active ? """
|
""" Is this whitelisting active ? """
|
||||||
|
@ -1485,8 +1531,8 @@ class Whitelist(RevMixin, AclMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
if (not user_request.has_perm('users.view_whitelist') and
|
if (not user_request.has_perm('users.view_whitelist') and
|
||||||
self.user != user_request):
|
self.user != user_request):
|
||||||
return False, (u"Vous n'avez pas le droit de voir les accès "
|
return False, (_("You don't have the right to view whitelists"
|
||||||
"gracieux autre que les vôtres")
|
" other than yours."))
|
||||||
else:
|
else:
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
|
@ -1529,8 +1575,8 @@ class Request(models.Model):
|
||||||
PASSWD = 'PW'
|
PASSWD = 'PW'
|
||||||
EMAIL = 'EM'
|
EMAIL = 'EM'
|
||||||
TYPE_CHOICES = (
|
TYPE_CHOICES = (
|
||||||
(PASSWD, 'Mot de passe'),
|
(PASSWD, _("Password")),
|
||||||
(EMAIL, 'Email'),
|
(EMAIL, _("Email address")),
|
||||||
)
|
)
|
||||||
type = models.CharField(max_length=2, choices=TYPE_CHOICES)
|
type = models.CharField(max_length=2, choices=TYPE_CHOICES)
|
||||||
token = models.CharField(max_length=32)
|
token = models.CharField(max_length=32)
|
||||||
|
@ -1722,20 +1768,20 @@ class EMailAddress(RevMixin, AclMixin, models.Model):
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
User,
|
User,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
help_text="User of the local email",
|
help_text=_("User of the local email account")
|
||||||
)
|
)
|
||||||
local_part = models.CharField(
|
local_part = models.CharField(
|
||||||
unique=True,
|
unique=True,
|
||||||
max_length=128,
|
max_length=128,
|
||||||
help_text="Local part of the email address"
|
help_text=_("Local part of the email address")
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
("view_emailaddress", "Can see a local email account object"),
|
("view_emailaddress", _("Can view a local email account object")),
|
||||||
)
|
)
|
||||||
verbose_name = "Local email account"
|
verbose_name = _("local email account")
|
||||||
verbose_name_plural = "Local email accounts"
|
verbose_name_plural = _("local email accounts")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.local_part) + OptionalUser.get_cached_value('local_email_domain')
|
return str(self.local_part) + OptionalUser.get_cached_value('local_email_domain')
|
||||||
|
@ -1759,11 +1805,12 @@ class EMailAddress(RevMixin, AclMixin, models.Model):
|
||||||
if user_request.has_perm('users.add_emailaddress'):
|
if user_request.has_perm('users.add_emailaddress'):
|
||||||
return True, None
|
return True, None
|
||||||
if not OptionalUser.get_cached_value('local_email_accounts_enabled'):
|
if not OptionalUser.get_cached_value('local_email_accounts_enabled'):
|
||||||
return False, "The local email accounts are not enabled."
|
return False, _("The local email accounts are not enabled.")
|
||||||
if int(user_request.id) != int(userid):
|
if int(user_request.id) != int(userid):
|
||||||
return False, "You don't have the right to add a local email account to another user."
|
return False, _("You don't have the right to add a local email"
|
||||||
|
" account to another user.")
|
||||||
elif user_request.email_address.count() >= OptionalUser.get_cached_value('max_email_address'):
|
elif user_request.email_address.count() >= OptionalUser.get_cached_value('max_email_address'):
|
||||||
return False, "You have reached the limit of {} local email account.".format(
|
return False, _("You reached the limit of {} local email accounts.").format(
|
||||||
OptionalUser.get_cached_value('max_email_address')
|
OptionalUser.get_cached_value('max_email_address')
|
||||||
)
|
)
|
||||||
return True, None
|
return True, None
|
||||||
|
@ -1781,10 +1828,11 @@ class EMailAddress(RevMixin, AclMixin, models.Model):
|
||||||
if user_request.has_perm('users.view_emailaddress'):
|
if user_request.has_perm('users.view_emailaddress'):
|
||||||
return True, None
|
return True, None
|
||||||
if not OptionalUser.get_cached_value('local_email_accounts_enabled'):
|
if not OptionalUser.get_cached_value('local_email_accounts_enabled'):
|
||||||
return False, "The local email accounts are not enabled."
|
return False, _("The local email accounts are not enabled.")
|
||||||
if user_request == self.user:
|
if user_request == self.user:
|
||||||
return True, None
|
return True, None
|
||||||
return False, "You don't have the right to edit someone else's local email account."
|
return False, _("You don't have the right to edit another user's local"
|
||||||
|
" email account.")
|
||||||
|
|
||||||
def can_delete(self, user_request, *_args, **_kwargs):
|
def can_delete(self, user_request, *_args, **_kwargs):
|
||||||
"""Check if a user can delete the alias
|
"""Check if a user can delete the alias
|
||||||
|
@ -1797,16 +1845,16 @@ class EMailAddress(RevMixin, AclMixin, models.Model):
|
||||||
the local email account.
|
the local email account.
|
||||||
"""
|
"""
|
||||||
if self.local_part == self.user.pseudo.lower():
|
if self.local_part == self.user.pseudo.lower():
|
||||||
return False, ("You cannot delete a local email account whose "
|
return False, _("You can't delete a local email account whose"
|
||||||
"local part is the same as the username.")
|
" local part is the same as the username.")
|
||||||
if user_request.has_perm('users.delete_emailaddress'):
|
if user_request.has_perm('users.delete_emailaddress'):
|
||||||
return True, None
|
return True, None
|
||||||
if not OptionalUser.get_cached_value('local_email_accounts_enabled'):
|
if not OptionalUser.get_cached_value('local_email_accounts_enabled'):
|
||||||
return False, "The local email accounts are not enabled."
|
return False, _("The local email accounts are not enabled.")
|
||||||
if user_request == self.user:
|
if user_request == self.user:
|
||||||
return True, None
|
return True, None
|
||||||
return False, ("You don't have the right to delete someone else's "
|
return False, _("You don't have the right to delete another user's"
|
||||||
"local email account")
|
" local email account")
|
||||||
|
|
||||||
def can_edit(self, user_request, *_args, **_kwargs):
|
def can_edit(self, user_request, *_args, **_kwargs):
|
||||||
"""Check if a user can edit the alias
|
"""Check if a user can edit the alias
|
||||||
|
@ -1819,19 +1867,20 @@ class EMailAddress(RevMixin, AclMixin, models.Model):
|
||||||
the local email account.
|
the local email account.
|
||||||
"""
|
"""
|
||||||
if self.local_part == self.user.pseudo.lower():
|
if self.local_part == self.user.pseudo.lower():
|
||||||
return False, ("You cannot edit a local email account whose "
|
return False, _("You can't edit a local email account whose local"
|
||||||
"local part is the same as the username.")
|
" part is the same as the username.")
|
||||||
if user_request.has_perm('users.change_emailaddress'):
|
if user_request.has_perm('users.change_emailaddress'):
|
||||||
return True, None
|
return True, None
|
||||||
if not OptionalUser.get_cached_value('local_email_accounts_enabled'):
|
if not OptionalUser.get_cached_value('local_email_accounts_enabled'):
|
||||||
return False, "The local email accounts are not enabled."
|
return False, _("The local email accounts are not enabled.")
|
||||||
if user_request == self.user:
|
if user_request == self.user:
|
||||||
return True, None
|
return True, None
|
||||||
return False, ("You don't have the right to edit someone else's "
|
return False, _("You don't have the right to edit another user's local"
|
||||||
"local email account")
|
" email account.")
|
||||||
|
|
||||||
def clean(self, *args, **kwargs):
|
def clean(self, *args, **kwargs):
|
||||||
self.local_part = self.local_part.lower()
|
self.local_part = self.local_part.lower()
|
||||||
if "@" in self.local_part:
|
if "@" in self.local_part:
|
||||||
raise ValidationError("The local part cannot contain a @")
|
raise ValidationError(_("The local part must not contain @."))
|
||||||
super(EMailAddress, self).clean(*args, **kwargs)
|
super(EMailAddress, self).clean(*args, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,11 @@ 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 %}
|
{% load acl %}
|
||||||
{% load logs_extra %}
|
{% load logs_extra %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% if ban_list.paginator %}
|
{% if ban_list.paginator %}
|
||||||
{% include "pagination.html" with list=ban_list %}
|
{% include "pagination.html" with list=ban_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -30,36 +33,40 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% include "buttons/sort.html" with prefix='ban' col="user" text="Utilisateur" %}</th>
|
{% trans "User" as tr_user %}
|
||||||
<th>Raison</th>
|
<th>{% include "buttons/sort.html" with prefix='ban' col="user" text=tr_user %}</th>
|
||||||
<th>{% include "buttons/sort.html" with prefix='ban' col="start" text="Date de début" %}</th>
|
<th>{% trans "Reason" %}</th>
|
||||||
<th>{% include "buttons/sort.html" with prefix='ban' col="end" text="Date de fin" %}</th>
|
{% trans "Start date" as tr_start %}
|
||||||
|
<th>{% include "buttons/sort.html" with prefix='ban' col="start" text=tr_start %}</th>
|
||||||
|
{% trans "End date" as tr_end %}
|
||||||
|
<th>{% include "buttons/sort.html" with prefix='ban' col="end" text=tr_end %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for ban in ban_list %}
|
{% for ban in ban_list %}
|
||||||
{% if ban.is_active %}
|
{% if ban.is_active %}
|
||||||
<tr class="danger">
|
<tr class="danger">
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr>
|
<tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td><a href="{% url "users:profil" ban.user.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i> {{ ban.user }}</a></td>
|
<td><a href="{% url "users:profil" ban.user.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i> {{ ban.user }}</a></td>
|
||||||
<td>{{ ban.raison }}</td>
|
<td>{{ ban.raison }}</td>
|
||||||
<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">
|
||||||
{% can_delete ban %}
|
|
||||||
{% include 'buttons/suppr.html' with href='users:del-ban' id=ban.id %}
|
|
||||||
{% acl_end %}
|
|
||||||
{% can_edit ban %}
|
{% 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 %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button ban %}
|
{% history_button ban %}
|
||||||
|
{% can_delete ban %}
|
||||||
|
{% include 'buttons/suppr.html' with href='users:del-ban' id=ban.id %}
|
||||||
|
{% acl_end %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% if ban_list.paginator %}
|
{% if ban_list.paginator %}
|
||||||
{% include "pagination.html" with list=ban_list %}
|
{% include "pagination.html" with list=ban_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ 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 i18n %}
|
||||||
|
|
||||||
{% if clubs_list.paginator %}
|
{% if clubs_list.paginator %}
|
||||||
{% include "pagination.html" with list=clubs_list %}
|
{% include "pagination.html" with list=clubs_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -31,29 +33,35 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% include "buttons/sort.html" with prefix='club' col="surname" text="Nom" %}</th>
|
{% trans "Name" as tr_name %}
|
||||||
<th>{% include "buttons/sort.html" with prefix='club' col="pseudo" text="Pseudo" %}</th>
|
<th>{% include "buttons/sort.html" with prefix='club' col="surname" text=tr_name %}</th>
|
||||||
<th>{% include "buttons/sort.html" with prefix='club' col="room" text="Chambre" %}</th>
|
{% trans "Username" as tr_username %}
|
||||||
<th>Fin de cotisation le</th>
|
<th>{% include "buttons/sort.html" with prefix='club' col="pseudo" text=tr_username %}</th>
|
||||||
<th>Connexion</th>
|
{% trans "Room" as tr_room %}
|
||||||
<th>Profil</th>
|
<th>{% include "buttons/sort.html" with prefix='club' col="room" text=tr_room %}</th>
|
||||||
|
<th>{% trans "End of subscription on" %}</th>
|
||||||
|
<th>{% trans "Internet access" %}</th>
|
||||||
|
<th>{% trans "Profile" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for club in clubs_list %}
|
{% for club in clubs_list %}
|
||||||
{% can_view club %}
|
{% can_view club %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ club.surname }}</td>
|
<td>{{ club.surname }}</td>
|
||||||
<td>{{ club.pseudo }}</td>
|
<td>{{ club.pseudo }}</td>
|
||||||
<td>{{ club.room }}</td>
|
<td>{{ club.room }}</td>
|
||||||
<td>{% if club.is_adherent %}{{ club.end_adhesion }}{% else %}Non adhérent{% endif %}</td>
|
<td>{% if club.is_adherent %}{{ club.end_adhesion }}{% else %}{% trans "Not a member" %}{% endif %}</td>
|
||||||
<td>{% if club.has_access == True %}
|
<td>{% if club.has_access == True %}
|
||||||
<i class="text-success">Active</i>
|
<i class="text-success">{% trans "Active" %}</i>
|
||||||
{% else %}
|
{% else %}
|
||||||
<i class="text-danger">Désactivée</i>
|
<i class="text-danger">{% trans "Disabled" %}</i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td><a href="{% url "users:profil" club.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i></a>
|
<td>
|
||||||
</td>
|
<a href="{% url "users:profil" club.id%}" class="btn btn-primary btn-sm" role="button">
|
||||||
|
<i class="fa fa-user"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -62,3 +70,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% if clubs_list.paginator %}
|
{% if clubs_list.paginator %}
|
||||||
{% include "pagination.html" with list=clubs_list %}
|
{% include "pagination.html" with list=clubs_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
{% load i18n %}
|
||||||
{% load logs_extra %}
|
{% load logs_extra %}
|
||||||
|
|
||||||
{% if emailaddress_list.paginator %}
|
{% if emailaddress_list.paginator %}
|
||||||
|
@ -32,20 +33,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Email address</th>
|
<th>{% trans "Email address" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for emailaddress in emailaddress_list %}
|
{% for emailaddress in emailaddress_list %}
|
||||||
<td>{{ emailaddress.complete_email_address }}</td>
|
<td>{{ emailaddress.complete_email_address }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_delete emailaddress %}
|
{% can_delete emailaddress %}
|
||||||
{% include 'buttons/suppr.html' with href='users:del-emailaddress' id=emailaddress.id %}
|
{% include 'buttons/suppr.html' with href='users:del-emailaddress' id=emailaddress.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_edit emailaddress %}
|
{% history_button emailaddress %}
|
||||||
{% include 'buttons/edit.html' with href='users:edit-emailaddress' id=emailaddress.id %}
|
{% can_edit emailaddress %}
|
||||||
{% acl_end %}
|
{% include 'buttons/edit.html' with href='users:edit-emailaddress' id=emailaddress.id %}
|
||||||
{% history_button emailaddress %}
|
{% acl_end %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -54,3 +55,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% if emailaddress_list.paginator %}
|
{% if emailaddress_list.paginator %}
|
||||||
{% include "pagination.html" with list=emailaddress_list %}
|
{% include "pagination.html" with list=emailaddress_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</thead>
|
</thead>
|
||||||
{% for user_right in user_right_list %}
|
{% for user_right in user_right_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td> {{ user_right }}</td>
|
<td>{{ user_right }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,20 +21,21 @@ 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 i18n %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
{% load logs_extra %}
|
{% load logs_extra %}
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
|
||||||
{% if school_list.paginator %}
|
{% if school_list.paginator %}
|
||||||
{% include "pagination.html" with list=school_list %}
|
{% include "pagination.html" with list=school_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% include "buttons/sort.html" with prefix='school' col='name' text='Etablissement' %}</th>
|
{% trans "School" as tr_school %}
|
||||||
|
<th>{% include "buttons/sort.html" with prefix='school' col='name' text=tr_school %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -21,32 +21,35 @@ 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 i18n %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
{% load logs_extra %}
|
{% load logs_extra %}
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
<table class="table table-striped">
|
||||||
<tr>
|
<thead>
|
||||||
<th>Nom</th>
|
<tr>
|
||||||
<th>Rôle</th>
|
<th>{% trans "Name" %}</th>
|
||||||
<th>Commentaire</th>
|
<th>{% trans "Role" %}</th>
|
||||||
<th></th>
|
<th>{% trans "Comment" %}</th>
|
||||||
</tr>
|
<th></th>
|
||||||
</thead>
|
</tr>
|
||||||
{% for serviceuser in serviceusers_list %}
|
</thead>
|
||||||
<tr>
|
{% for serviceuser in serviceusers_list %}
|
||||||
<td>{{ serviceuser.pseudo }}</td>
|
<tr>
|
||||||
<td>{{ serviceuser.access_group }}</td>
|
<td>{{ serviceuser.pseudo }}</td>
|
||||||
<td>{{ serviceuser.comment }}</td>
|
<td>{{ serviceuser.access_group }}</td>
|
||||||
<td class="text-right">
|
<td>{{ serviceuser.comment }}</td>
|
||||||
{% can_delete serviceuser %}
|
<td class="text-right">
|
||||||
{% include 'buttons/suppr.html' with href='users:del-serviceuser' id=serviceuser.id %}
|
{% can_delete serviceuser %}
|
||||||
{% acl_end %}
|
{% include 'buttons/suppr.html' with href='users:del-serviceuser' id=serviceuser.id %}
|
||||||
{% can_edit serviceuser %}
|
{% acl_end %}
|
||||||
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
|
{% history_button serviceuser %}
|
||||||
{% acl_end %}
|
{% can_edit serviceuser %}
|
||||||
{% history_button serviceuser %}
|
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
|
||||||
</td>
|
{% acl_end %}
|
||||||
</tr>
|
</td>
|
||||||
{% endfor %}
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -21,28 +21,31 @@ 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 i18n %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
{% load logs_extra %}
|
{% load logs_extra %}
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Shell</th>
|
<th>{% trans "Shell" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for shell in shell_list %}
|
{% for shell in shell_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ shell.shell }}</td>
|
<td>{{ shell.shell }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_delete shell %}
|
{% can_delete shell %}
|
||||||
{% include 'buttons/suppr.html' with href='users:del-shell' id=shell.id %}
|
{% include 'buttons/suppr.html' with href='users:del-shell' id=shell.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_edit shell %}
|
{% history_button shell %}
|
||||||
{% include 'buttons/edit.html' with href='users:edit-shell' id=shell.id %}
|
{% can_edit shell %}
|
||||||
{% acl_end %}
|
{% include 'buttons/edit.html' with href='users:edit-shell' id=shell.id %}
|
||||||
{% history_button shell %}
|
{% acl_end %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ 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 i18n %}
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
{% if users_list.paginator %}
|
{% if users_list.paginator %}
|
||||||
{% include "pagination.html" with list=users_list %}
|
{% include "pagination.html" with list=users_list %}
|
||||||
|
@ -29,31 +32,39 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% include "buttons/sort.html" with prefix='user' col="name" text="Prénom" %}</th>
|
{% trans "Firt name" as tr_name %}
|
||||||
<th>{% include "buttons/sort.html" with prefix='user' col="surname" text="Nom" %}</th>
|
<th>{% include "buttons/sort.html" with prefix='user' col="name" text=tr_name %}</th>
|
||||||
<th>{% include "buttons/sort.html" with prefix='user' col="pseudo" text="Pseudo" %}</th>
|
{% trans "Surname" as tr_surname %}
|
||||||
<th>{% include "buttons/sort.html" with prefix='user' col="room" text="Chambre" %}</th>
|
<th>{% include "buttons/sort.html" with prefix='user' col="surname" text=tr_surname %}</th>
|
||||||
<th>Fin de cotisation le</th>
|
{% trans "Username" as tr_username %}
|
||||||
<th>Connexion</th>
|
<th>{% include "buttons/sort.html" with prefix='user' col="pseudo" text=tr_username %}</th>
|
||||||
<th>Profil</th>
|
{% trans "Room" as tr_room %}
|
||||||
|
<th>{% include "buttons/sort.html" with prefix='user' col="room" text=tr_room %}</th>
|
||||||
|
<th>{% trans "End of subscription on" %}</th>
|
||||||
|
<th>{% trans "Internet access" %}</th>
|
||||||
|
<th>{% trans "Profile" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for user in users_list %}
|
{% for user in users_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ user.name }}</td>
|
<td>{{ user.name }}</td>
|
||||||
<td>{{ user.surname }}</td>
|
<td>{{ user.surname }}</td>
|
||||||
<td>{{ user.pseudo }}</td>
|
<td>{{ user.pseudo }}</td>
|
||||||
<td>{{ user.room }}</td>
|
<td>{{ user.room }}</td>
|
||||||
<td>{% if user.is_adherent %}{{ user.end_adhesion }}{% else %}Non adhérent{% endif %}</td>
|
<td>{% if user.is_adherent %}{{ user.end_adhesion }}{% else %}{% trans "Not a member" %}{% endif %}</td>
|
||||||
<td>{% if user.has_access == True %}
|
<td>
|
||||||
<i class="text-success">Active</i>
|
{% if user.has_access == True %}
|
||||||
{% else %}
|
<i class="text-success">{% trans "Active" %}</i>
|
||||||
<i class="text-danger">Désactivée</i>
|
{% else %}
|
||||||
{% endif %}
|
<i class="text-danger">{% trans "Disabled" %}</i>
|
||||||
</td>
|
{% endif %}
|
||||||
<td><a href="{% url "users:profil" user.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i></a>
|
</td>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<a href="{% url "users:profil" user.id%}" class="btn btn-primary btn-sm" role="button">
|
||||||
|
<i class="fa fa-user"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -61,3 +72,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% include "pagination.html" with list=users_list %}
|
{% include "pagination.html" with list=users_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -22,27 +22,33 @@ 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 i18n %}
|
||||||
|
|
||||||
{% 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 %}
|
{% load acl %}
|
||||||
{% load logs_extra %}
|
{% load logs_extra %}
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% include "buttons/sort.html" with prefix='white' col="user" text="Utilisateur" %}</th>
|
{% trans "User" as tr_user %}
|
||||||
<th>Raison</th>
|
<th>{% include "buttons/sort.html" with prefix='white' col="user" text=tr_user %}</th>
|
||||||
<th>{% include "buttons/sort.html" with prefix='white' col="start" text="Date de début" %}</th>
|
<th>{% trans "Reason" %}</th>
|
||||||
<th>{% include "buttons/sort.html" with prefix='white' col="end" text="Date de fin" %}</th>
|
{% trans "Start date" as tr_start %}
|
||||||
|
<th>{% include "buttons/sort.html" with prefix='white' col="start" text=tr_start %}</th>
|
||||||
|
{% trans "End date" as tr_end %}
|
||||||
|
<th>{% include "buttons/sort.html" with prefix='white' col="end" text=tr_end %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for whitelist in white_list %}
|
{% for whitelist in white_list %}
|
||||||
{% if whitelist.is_active %}
|
{% if whitelist.is_active %}
|
||||||
<tr class="success">
|
<tr class="success">
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr>
|
<tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td><a href="{% url "users:profil" whitelist.user.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i> {{ whitelist.user }}</a></td>
|
<td><a href="{% url "users:profil" whitelist.user.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i> {{ whitelist.user }}</a></td>
|
||||||
<td>{{ whitelist.raison }}</td>
|
<td>{{ whitelist.raison }}</td>
|
||||||
<td>{{ whitelist.date_start }}</td>
|
<td>{{ whitelist.date_start }}</td>
|
||||||
|
@ -51,10 +57,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% can_delete whitelist %}
|
{% can_delete whitelist %}
|
||||||
{% include 'buttons/suppr.html' with href='users:del-whitelist' id=whitelist.id %}
|
{% include 'buttons/suppr.html' with href='users:del-whitelist' id=whitelist.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
|
{% history_button whitelist %}
|
||||||
{% can_edit whitelist %}
|
{% 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 %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button whitelist %}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -63,3 +69,4 @@ 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 %}
|
||||||
|
|
||||||
|
|
|
@ -24,17 +24,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Destruction d'objets{% endblock %}
|
{% block title %}{% trans "Deletion of objects" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<h4>Attention, voulez-vous vraiment supprimer cet objet {{ objet_name }} ( {{ objet }} ) ?</h4>
|
<h4>{% blocktrans %}Warning: are you sure you want to delete this {{ objet_name }} object ( {{ objet }} )?{% endblocktrans %}</h4>
|
||||||
{% bootstrap_button "Confirmer" button_type="submit" icon="trash" %}
|
{% trans "Confirm" as tr_confirm %}
|
||||||
|
{% bootstrap_button tr_confirm button_type="submit" icon="trash" %}
|
||||||
</form>
|
</form>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Utilisateurs{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Adhérents</h2>
|
<h2>{% trans "Users" %}</h2>
|
||||||
{% include "users/aff_users.html" with users_list=users_list %}
|
{% include "users/aff_users.html" with users_list=users_list %}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -24,11 +24,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Utilisateurs{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Bannissements</h2>
|
<h2>{% trans "Bans" %}</h2>
|
||||||
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -24,11 +24,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Utilisateurs{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Clubs</h2>
|
<h2>{% trans "Clubs" %}</h2>
|
||||||
{% include "users/aff_clubs.html" with clubs_list=clubs_list %}
|
{% include "users/aff_clubs.html" with clubs_list=clubs_list %}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -24,11 +24,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Local email accounts{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Local email accounts</h2>
|
<h2>{% trans "Local email accounts" %}</h2>
|
||||||
{% include "users/aff_emailaddress.html" with emailaddress_list=emailaddress_list %}
|
{% include "users/aff_emailaddress.html" with emailaddress_list=emailaddress_list %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -25,15 +25,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Utilisateurs{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Liste des droits</h2>
|
<h2>{% trans "List of groups of rights" %}</h2>
|
||||||
{% can_create ListRight %}
|
{% can_create ListRight %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-listright' %}"><i class="fa fa-plus"></i> Ajouter un droit ou groupe</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-listright' %}"><i class="fa fa-plus"></i>{% trans " Add a group of rights" %}</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'users:del-listright' %}"><i class="fa fa-trash"></i> Supprimer un ou plusieurs droits/groupes</a>
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'users:del-listright' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several groups of rights" %}</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
{% include "users/aff_listright.html" %}
|
{% include "users/aff_listright.html" %}
|
||||||
|
|
|
@ -24,11 +24,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Utilisateurs{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Droits</h2>
|
<h2>{% trans "Rights" %}</h2>
|
||||||
{% include "users/aff_rights.html" %}
|
{% include "users/aff_rights.html" %}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -25,16 +25,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Utilisateurs{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Liste des Établissements</h2>
|
<h2>{% trans "List of schools" %}</h2>
|
||||||
<h5>Ensemble des établissements d'enseignement ou d'activité des utilisateurs crées</h5>
|
<h5>{% trans "List of schools for created users." %}</h5>
|
||||||
{% can_create School %}
|
{% can_create School %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-school' %}"><i class="fa fa-plus"></i> Ajouter un établissement</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-school' %}"><i class="fa fa-plus"></i>{% trans " Add a school" %}</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'users:del-school' %}"><i class="fa fa-trash"></i> Supprimer un ou plusieurs établissements</a>
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'users:del-school' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several schools" %}</a>
|
||||||
<hr>
|
<hr>
|
||||||
{% include "users/aff_schools.html" with school_list=school_list %}
|
{% include "users/aff_schools.html" with school_list=school_list %}
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -25,15 +25,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Utilisateurs{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Liste des service users LDAP</h2>
|
<h2>{% trans "List of LDAP service users" %}</h2>
|
||||||
<h5>Les service users LDAP sont des utilisateurs spéciaux qui disposent d'un accès uniquement sur le ldap pour effectuer des opération d'authentification.
|
<h5>{% trans "The LDAP service users are special users having access only to the LDAP for authentication operations. It is recommended to create a service user with a login and a password for any concerned service." %}</h5>
|
||||||
Il est recommandé de créer un service-user doté d'un login/mdp par service concerné</h5>
|
|
||||||
{% can_create ServiceUser %}
|
{% can_create ServiceUser %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:new-serviceuser' %}"><i class="fa fa-plus"></i> Ajouter un service user</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:new-serviceuser' %}"><i class="fa fa-plus"></i>{% trans " Add a service user" %}</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% include "users/aff_serviceusers.html" with serviceusers_list=serviceusers_list %}
|
{% include "users/aff_serviceusers.html" with serviceusers_list=serviceusers_list %}
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -25,13 +25,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Utilisateurs{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Liste des Shells</h2>
|
<h2>{% trans "List of shells" %}</h2>
|
||||||
{% can_create ListShell %}
|
{% can_create ListShell %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-shell' %}"><i class="fa fa-plus"></i> Ajouter un shell</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-shell' %}"><i class="fa fa-plus"></i>{% trans " Add a shell" %}</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% include "users/aff_shell.html" with shell_list=shell_list %}
|
{% include "users/aff_shell.html" with shell_list=shell_list %}
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -24,11 +24,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Utilisateurs{% endblock %}
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Accès à titre gracieux</h2>
|
<h2>{% trans "Whitelists" %}</h2>
|
||||||
{% include "users/aff_whitelists.html" with white_list=white_list %}
|
{% include "users/aff_whitelists.html" with white_list=white_list %}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -24,18 +24,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %} Utilisateurs à archiver{% endblock %}
|
{% block title %}{% trans "Users to archive" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% bootstrap_form userform %}
|
{% bootstrap_form userform %}
|
||||||
<input type="submit" name="chercher" value="Chercher" class="btn btn-primary" id="submit-id-submit">
|
<input type="submit" name="chercher" value={% trans "Search" %} class="btn btn-primary" id="submit-id-submit">
|
||||||
<input type="submit" name="valider" value="Valider définitivement" class="btn btn-primary" id="submit-id-submit">
|
<input type="submit" name="valider" value={% trans "Confirm" %} class="btn btn-primary" id="submit-id-submit">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3>Les utilisateurs suivant seront archivés ({{ to_archive_list|length }}):</h3>
|
<h3>{% blocktrans %}The following users will be archived ({{ to_archive_list|length }}):{% endblocktrans %}</h3>
|
||||||
{% include "users/aff_users.html" with users_list=to_archive_list %}
|
{% include "users/aff_users.html" with users_list=to_archive_list %}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -29,14 +29,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% load design %}
|
{% load design %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}Profil{% endblock %}
|
{% block title %}{% trans "Profile" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div align="center" class="title-dashboard">
|
<div align="center" class="title-dashboard">
|
||||||
{% if user == users %}
|
{% if user == users %}
|
||||||
<h2>Welcome {{ users.name }} {{ users.surname }}</h2>
|
<h2>{% blocktrans with name=users.name surname=users.surname %}Welcome {{ name }} {{ surname }}{% endblocktrans %}</h2>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h2>Profil de {{ users.name }} {{ users.surname }}</h2>
|
<h2>{% blocktrans with name=users.name surname=users.surname %}Profile of {{ name }} {{ surname }}{% endblocktrans %}</h2>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="dashboard_container">
|
<div class="dashboard_container">
|
||||||
|
@ -44,29 +44,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="col-sm-6 {% if solde_activated %}col-md-4{% else %}col_md-6{% endif %}">
|
<div class="col-sm-6 {% if solde_activated %}col-md-4{% else %}col_md-6{% endif %}">
|
||||||
{% if users.is_ban%}
|
{% if users.is_ban%}
|
||||||
<div class="panel panel-danger">
|
<div class="panel panel-danger">
|
||||||
<div class="panel-heading dashboard">Your account has been banned</div>
|
<div class="panel-heading dashboard">{% trans "Your account has been banned" %}</div>
|
||||||
<div class="panel-body dashboard">
|
<div class="panel-body dashboard">
|
||||||
<i class="text-danger">End of the ban: {{ users.end_ban | date:"SHORT_DATE_FORMAT" }}</i>
|
<i class="text-danger">{% blocktrans with end_ban=users.end_ban|date:"SHORT_DATE_FORMAT" %}End of the ban: {{ end_ban }}{% endblocktrans %}</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% elif not users.is_adherent %}
|
{% elif not users.is_adherent %}
|
||||||
<div class="panel panel-danger">
|
<div class="panel panel-danger">
|
||||||
<div class="panel-heading dashboard">Not connected</div>
|
<div class="panel-heading dashboard">{% trans "No connection" %}</div>
|
||||||
<div class="panel-body dashboard">
|
<div class="panel-body dashboard">
|
||||||
{% can_create Facture %}
|
{% can_create Facture %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:new-facture' users.id %}">
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:new-facture' users.id %}">
|
||||||
<i class="fas fa-sign-in-alt"></i> Pay for a connexion
|
<i class="fas fa-sign-in-alt"></i> {% trans "Pay for a connection" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_else %}
|
{% acl_else %}
|
||||||
Ask for someone with the correct rights to pay for a connexion
|
{% trans "Ask for someone with the appropriate rights to pay for a connection." %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="panel panel-success">
|
<div class="panel panel-success">
|
||||||
<div class="panel-heading dashboard">Connected</div>
|
<div class="panel-heading dashboard">{% trans "Connection" %}</div>
|
||||||
<div class="panel-body dashboard">
|
<div class="panel-body dashboard">
|
||||||
<i class="text-success">End of connexion: {{ users.end_adhesion | date:"SHORT_DATE_FORMAT"}}</i>
|
<i class="text-success">{% blocktrans with end_connection=user.end_adhesion|date:"SHORT_DATE_FORMAT" %}End of connection: {{ end_connection }}{% endblocktrans %}</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -79,7 +79,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body dashboard">
|
<div class="panel-body dashboard">
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.id %}">
|
||||||
<i class="fa fa-euro-sign"></i> Recharger
|
<i class="fa fa-euro-sign"></i> {% trans "Refill the balance" %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -89,20 +89,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% if nb_machines %}
|
{% if nb_machines %}
|
||||||
<div class="panel panel-info">
|
<div class="panel panel-info">
|
||||||
<div class="panel-heading dashboard" data-parent="#accordion" data-toggle="collapse" data-target="#collapse3">
|
<div class="panel-heading dashboard" data-parent="#accordion" data-toggle="collapse" data-target="#collapse3">
|
||||||
<i class="fa fa-desktop"></i> Machines <span class="badge">{{ nb_machines }}</span>
|
<i class="fa fa-desktop"></i>{% trans " Machines" %}<span class="badge">{{ nb_machines }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body dashboard">
|
<div class="panel-body dashboard">
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
|
||||||
<i class="fa fa-desktop"></i> Add a machine
|
<i class="fa fa-desktop"></i>{% trans " Add a machine" %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="panel panel-warning">
|
<div class="panel panel-warning">
|
||||||
<div class="panel-heading dashboard">No machines</div>
|
<div class="panel-heading dashboard">{% trans "No machine" %}</div>
|
||||||
<div class="panel-body dashboard">
|
<div class="panel-body dashboard">
|
||||||
<a class="btn btn-warning btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
|
<a class="btn btn-warning btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
|
||||||
<i class="fa fa-desktop"></i> Add a machine
|
<i class="fa fa-desktop"></i>{% trans " Add a machine" %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -111,147 +111,145 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="panel-group" id="accordion">
|
<div class="panel-group" id="accordion">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse1">
|
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse1">
|
||||||
<h3 class="panel-title pull-left" >
|
<h3 class="panel-title pull-left" >
|
||||||
<i class="fa fa-user"></i> Informations détaillées
|
<i class="fa fa-user"></i>{% trans " Detailed information" %}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-collapse collapse" id="collapse1">
|
<div class="panel-collapse collapse in" id="collapse1">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
Éditer
|
{% trans "Edit" %}
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' users.id %}">
|
||||||
<i class="fa fa-lock"></i>
|
<i class="fa fa-lock"></i>
|
||||||
Changer le mot de passe
|
{% trans "Change the password" %}
|
||||||
</a>
|
</a>
|
||||||
{% can_change User state %}
|
{% can_change User state %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
|
||||||
<i class="fa fa-id-badge"></i>
|
<i class="fa fa-id-badge"></i>
|
||||||
Changer le statut
|
{% trans "Change the state" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_change User groups %}
|
{% can_change User groups %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
|
||||||
<i class="fa fa-check"></i>
|
<i class="fa fa-check"></i>
|
||||||
Gérer les groupes
|
{% trans "Edit the groups" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button users text=True %}
|
{% history_button users text=True %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
{% if users.is_class_club %}
|
{% if users.is_class_club %}
|
||||||
<th>Mailing</th>
|
<th>{% trans "Mailing" %}</th>
|
||||||
{% if users.club.mailing %}
|
{% if users.club.mailing %}
|
||||||
<td>{{ users.pseudo }}(-admin)</td>
|
<td>{{ users.pseudo }}(-admin)</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td>Mailing désactivée</td>
|
<td>{% trans "Mailing disabled" %}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<th>Prénom</th>
|
<th>{% trans "Firt name" %}</th>
|
||||||
<td>{{ users.name }}</td>
|
<td>{{ users.name }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<th>Nom</th>
|
<th>{% trans "Surname" %}</th>
|
||||||
<td>{{ users.surname }}</td>
|
<td>{{ users.surname }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Pseudo</th>
|
<th>{% trans "Username" %}</th>
|
||||||
<td>{{ users.pseudo }}</td>
|
<td>{{ users.pseudo }}</td>
|
||||||
<th>E-mail</th>
|
<th>{% trans "Email address" %}</th>
|
||||||
<td>{{ users.email }}</td>
|
<td>{{ users.email }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Chambre</th>
|
<th>{% trans "Room" %}</th>
|
||||||
<td>{{ users.room }}</td>
|
<td>{{ users.room }}</td>
|
||||||
<th>Téléphone</th>
|
<th>{% trans "Telephone number" %}</th>
|
||||||
<td>{{ users.telephone }}</td>
|
<td>{{ users.telephone }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>École</th>
|
<th>{% trans "School" %}</th>
|
||||||
<td>{{ users.school }}</td>
|
<td>{{ users.school }}</td>
|
||||||
<th>Commentaire</th>
|
<th>{% trans "Comment" %}</th>
|
||||||
<td>{{ users.comment }}</td>
|
<td>{{ users.comment }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Date d'inscription</th>
|
<th>{% trans "Registration date" %}</th>
|
||||||
<td>{{ users.registered }}</td>
|
<td>{{ users.registered }}</td>
|
||||||
<th>Dernière connexion</th>
|
<th>{% trans "Last login" %}</th>
|
||||||
<td>{{ users.last_login }}</td>
|
<td>{{ users.last_login }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Fin d'adhésion</th>
|
<th>{% trans "End of membership" %}</th>
|
||||||
{% if users.end_adhesion != None %}
|
{% if users.end_adhesion != None %}
|
||||||
<td><i class="text-success">{{ users.end_adhesion }}</i></td>
|
<td><i class="text-success">{{ users.end_adhesion }}</i></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td><i class="text-danger">Non adhérent</i></td>
|
<td><i class="text-danger">{% trans "Not a member" %}</i></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<th>Accès gracieux</th>
|
<th>{% trans "Whitelist" %}</th>
|
||||||
{% if users.end_whitelist != None %}
|
{% if users.end_whitelist != None %}
|
||||||
<td><i class="text-success">{{ users.end_whitelist }}</i></td>
|
<td><i class="text-success">{{ users.end_whitelist }}</i></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td><i class="text-warning">Aucun</i></td>
|
<td><i class="text-warning">{% trans "None" %}</i></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>Bannissement</th>
|
<th>{% trans "Ban" %}</th>
|
||||||
{% if users.end_ban != None %}
|
{% if users.end_ban != None %}
|
||||||
<td><i class="text-danger">{{ users.end_ban }}</i></td>
|
<td><i class="text-danger">{{ users.end_ban }}</i></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td><i class="text-success">Non banni</i></td>
|
<td><i class="text-success">{% trans "Not banned" %}</i></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<th>Statut</th>
|
<th>{% trans "State" %}</th>
|
||||||
{% if users.state == 0 %}
|
{% if users.state == 0 %}
|
||||||
<td><i class="text-success">Actif</i></td>
|
<td><i class="text-success">{% trans "Active" %}</i></td>
|
||||||
{% elif users.state == 1 %}
|
{% elif users.state == 1 %}
|
||||||
<td><i class="text-danger">Désactivé</i></td>
|
<td><i class="text-danger">{% trans "Disabled" %}</i></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td><i class="text-warning">Archivé</i></td>
|
<td><i class="text-warning">{% trans "Archived" %}</i></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Accès internet</th>
|
<th>{% trans "Internet access" %}</th>
|
||||||
{% if users.has_access == True %}
|
{% if users.has_access == True %}
|
||||||
<td><i class="text-success">Actif (jusqu'au {{ users.end_access }})</i></td>
|
<td><i class="text-success">{% blocktrans with end_access=users.end_access %}Active (until {{ end_access }}){% endblocktrans %}</i></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td><i class="text-danger">Désactivé</i></td>
|
<td><i class="text-danger">{% trans "Disabled" %}</i></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<th>Groupes</th>
|
<th>{% trans "Groups of rights" %}</th>
|
||||||
{% if users.groups.all %}
|
{% if users.groups.all %}
|
||||||
<td>{{ users.groups.all|join:", "}}</td>
|
<td>{{ users.groups.all|join:", "}}</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td>Aucun</td>
|
<td>{% trans "None" %}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Solde</th>
|
<th>{% trans "Balance" %}</th>
|
||||||
<td>{{ users.solde }} €
|
<td>{{ users.solde }} €
|
||||||
{% if user_solde %}
|
{% if user_solde %}
|
||||||
<a class="btn btn-primary btn-sm" style='float:right' role="button" href="{% url 'cotisations:credit-solde' users.pk%}">
|
<a class="btn btn-primary btn-sm" style='float:right' role="button" href="{% url 'cotisations:credit-solde' users.pk%}">
|
||||||
<i class="fa fa-euro-sign"></i>
|
<i class="fa fa-euro-sign"></i>
|
||||||
Recharger
|
{% trans "Refill" %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% if users.adherent.gpg_fingerprint %}
|
{% if users.adherent.gpg_fingerprint %}
|
||||||
<th>Empreinte GPG</th>
|
<th>{% trans "GPG fingerprint" %}</th>
|
||||||
<td>{{ users.adherent.gpg_fingerprint }}</td>
|
<td>{{ users.adherent.gpg_fingerprint }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
{% if users.shell %}
|
{% if users.shell %}
|
||||||
<th>Shell</th>
|
<th>{% trans "Shell" %}</th>
|
||||||
<td>{{ users.shell }}</td>
|
<td>{{ users.shell }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -260,25 +258,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse2">
|
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse2">
|
||||||
<h3 class="panel-title pull-left">
|
<h3 class="panel-title pull-left">
|
||||||
<i class="fa fa-users"></i> Gérer le club
|
<i class="fa fa-users"></i>{% trans " Manage the club" %}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-collapse collapse" id="collapse2">
|
<div class="panel-collapse collapse" id="collapse2">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-club-admin-members' users.club.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-club-admin-members' users.club.id %}">
|
||||||
<i class="fa fa-lock"></i>
|
<i class="fa fa-lock"></i>
|
||||||
Gérer admin et membres
|
{% trans "Manage the admins and members" %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h4>Administrateurs du club</h4>
|
<h4>{% trans "Club admins" %}</h4>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nom</th>
|
<th>{% trans "Surname" %}</th>
|
||||||
<th>Prenom</th>
|
<th>{% trans "First name" %}</th>
|
||||||
<th>Pseudo</th>
|
<th>{% trans "Username" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for admin in users.club.administrators.all %}
|
{% for admin in users.club.administrators.all %}
|
||||||
|
@ -290,14 +288,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<h4>Membres</h4>
|
<h4>{% trans "Members" %}</h4>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nom</th>
|
<th>{% trans "Surname" %}</th>
|
||||||
<th>Prenom</th>
|
<th>{% trans "First name" %}</th>
|
||||||
<th>Pseudo</th>
|
<th>{% trans "Username" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for admin in users.club.members.all %}
|
{% for admin in users.club.members.all %}
|
||||||
|
@ -317,22 +315,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse3">
|
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse3">
|
||||||
<h3 class="panel-title pull-left">
|
<h3 class="panel-title pull-left">
|
||||||
<i class="fa fa-desktop"></i>
|
<i class="fa fa-desktop"></i>
|
||||||
Machines
|
{% trans "Machines" %}
|
||||||
<span class="badge">{{nb_machines}}</span>
|
<span class="badge">{{nb_machines}}</span>
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div id="collapse3" class="panel-collapse collapse">
|
<div id="collapse3" class="panel-collapse collapse">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
|
||||||
<i class="fa fa-desktop"></i>
|
<i class="fa fa-desktop"></i>
|
||||||
Ajouter une machine
|
{% trans "Add a machine" %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if machines_list %}
|
{% if machines_list %}
|
||||||
{% include "machines/aff_machines.html" with machines_list=machines_list %}
|
{% include "machines/aff_machines.html" with machines_list=machines_list %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>Aucune machine</p>
|
<p>{% trans "No machine" %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -341,7 +339,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse4">
|
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse4">
|
||||||
<h3 class="panel-title pull-left">
|
<h3 class="panel-title pull-left">
|
||||||
<i class="fa fa-euro-sign"></i>
|
<i class="fa fa-euro-sign"></i>
|
||||||
Cotisations
|
{% trans "Subscriptions" %}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div id="collapse4" class="panel-collapse collapse">
|
<div id="collapse4" class="panel-collapse collapse">
|
||||||
|
@ -349,12 +347,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% can_create Facture %}
|
{% can_create Facture %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new-facture' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new-facture' users.id %}">
|
||||||
<i class="fa fa-euro-sign"></i>
|
<i class="fa fa-euro-sign"></i>
|
||||||
Ajouter une cotisation
|
{% trans "Add as subscription" %}
|
||||||
</a>
|
</a>
|
||||||
{% if user_solde %}
|
{% if user_solde %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.id %}">
|
||||||
<i class="fa fa-euro-sign"></i>
|
<i class="fa fa-euro-sign"></i>
|
||||||
Modifier le solde
|
{% trans "Edit the balance" %}
|
||||||
</a>
|
</a>
|
||||||
{% endif%}
|
{% endif%}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
|
@ -363,7 +361,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% 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>{% trans "No invoice" %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -372,15 +370,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse5">
|
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse5">
|
||||||
<h3 class="panel-title pull-left">
|
<h3 class="panel-title pull-left">
|
||||||
<i class="fa fa-ban"></i>
|
<i class="fa fa-ban"></i>
|
||||||
Bannissements
|
{% trans "Bans" %}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div id="collapse5" class="panel-collapse collapse">
|
<div id="collapse5" class="panel-collapse collapse">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% can_create Ban %}
|
{% can_create Ban %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' users.id %}">
|
||||||
<i class="fa fa-ban"></i>
|
<i class="fa fa-ban"></i>
|
||||||
Ajouter un bannissement
|
{% trans "Add a ban" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -388,7 +386,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% 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>{% trans "No ban" %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -397,23 +395,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse6">
|
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse6">
|
||||||
<h3 class="panel-title pull-left">
|
<h3 class="panel-title pull-left">
|
||||||
<i class="fa fa-check-circle"></i>
|
<i class="fa fa-check-circle"></i>
|
||||||
Accès à titre gracieux
|
{% trans "Whitelists" %}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div id="collapse6" class="panel-collapse collapse">
|
<div id="collapse6" class="panel-collapse collapse">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% can_create Whitelist %}
|
{% can_create Whitelist %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' users.id %}">
|
||||||
<i class="fa fa-check-circle"></i>
|
<i class="fa fa-check-circle"></i>
|
||||||
Accorder un accès à titre gracieux
|
{% trans "Grant a whitelist" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% 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 %}
|
||||||
<p>Aucun accès gracieux</p>
|
<p>{% trans "No whitelist" %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -421,14 +419,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse7">
|
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse7">
|
||||||
<h3 class="panel-title pull-left">
|
<h3 class="panel-title pull-left">
|
||||||
<i class="fa fa-envelope"></i> Email settings
|
<i class="fa fa-envelope"></i>{% trans " Email settings" %}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div id="collapse7" class="panel-collapse collapse">
|
<div id="collapse7" class="panel-collapse collapse">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% can_edit users %}
|
{% can_edit users %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-email-settings' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-email-settings' users.id %}">
|
||||||
<i class="fa fa-pencil-alt"></i> Edit email settings
|
<i class="fa fa-pencil-alt"></i>{% trans " Edit email settings" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -437,22 +435,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">Contact email address</th>
|
<th colspan="2">{% trans "Contact email address" %}</th>
|
||||||
<td colspan="2">{{ users.get_mail }}</td>
|
<td colspan="2">{{ users.get_mail }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Enable the local email account</th>
|
<th>{% trans "Enable the local email account" %}</th>
|
||||||
<td>{{ users.local_email_enabled | tick }}</td>
|
<td>{{ users.local_email_enabled | tick }}</td>
|
||||||
<th>Enable the local email redirection</th>
|
<th>{% trans "Enable the local email redirection" %}</th>
|
||||||
<td>{{ users.local_email_redirect | tick }}</td>
|
<td>{{ users.local_email_redirect | tick }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p>{% blocktrans %}The Contact email is the email address where we send email to contact you. If you would like to use your external email address for that, you can either disable your local email address or enable the local email redirection.{% endblocktrans %}</p>
|
<p>{% trans "The contact email address is the email address where we send emails to contact you. If you would like to use your external email address for that, you can either disable your local email address or enable the local email redirection." %}</p>
|
||||||
</div>
|
</div>
|
||||||
{% if users.local_email_enabled %}
|
{% if users.local_email_enabled %}
|
||||||
{% can_create EMailAddress users.id %}
|
{% can_create EMailAddress users.id %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-emailaddress' users.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-emailaddress' users.id %}">
|
||||||
<i class="fa fa-plus-square"></i> Add an email address
|
<i class="fa fa-plus-square"></i>{% trans " Add an email address" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% if emailaddress_list %}
|
{% if emailaddress_list %}
|
||||||
|
@ -463,7 +461,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Contact email address</th>
|
<th>{% trans "Contact email address" %}</th>
|
||||||
<td>{{ users.get_mail }}</td>
|
<td>{{ users.get_mail }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -474,3 +472,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -23,74 +23,76 @@ 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 %}
|
{% load acl %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
{% if request.user.is_authenticated%}
|
{% if request.user.is_authenticated%}
|
||||||
{% can_create Club %}
|
{% 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="fa fa-plus"></i>
|
<i class="fa fa-plus"></i>
|
||||||
Créer un club/association
|
{% trans "Create a club or organisation" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_create Adherent %}
|
{% can_create Adherent %}
|
||||||
<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="fa fa-user-plus"></i>
|
<i class="fa fa-user-plus"></i>
|
||||||
Créer un adhérent
|
{% trans "Create a user" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% can_view_all Club %}
|
{% can_view_all Club %}
|
||||||
<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="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
Clubs et assos
|
{% trans "Clubs and organisations" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all Adherent %}
|
{% 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="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
Adherents
|
{% trans "Users" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all Ban %}
|
{% 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="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
Bannissements
|
{% trans "Bans" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all Whitelist %}
|
{% 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="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
Accès à titre gracieux
|
{% trans "Whitelists" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all School %}
|
{% 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="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
Établissements
|
{% trans "Schools" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all ListShell %}
|
{% can_view_all ListShell %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "users:index-shell" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "users:index-shell" %}">
|
||||||
<i class="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
Liste des shells
|
{% trans "Shells" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all ListRight %}
|
{% 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="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
Groupes de droits
|
{% trans "Groups of rights" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all ServiceUser %}
|
{% 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="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
Gérer les service users
|
{% trans "Service users" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_change User state %}
|
{% can_change User state %}
|
||||||
<a class="list-group-item list-group-item-danger" href="{% url "users:mass-archive" %}">
|
<a class="list-group-item list-group-item-danger" href="{% url "users:mass-archive" %}">
|
||||||
<i class="fa fa-archive"></i>
|
<i class="fa fa-archive"></i>
|
||||||
Archiver en masse
|
{% trans "Massively archive" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% load massive_bootstrap_form %}
|
{% load massive_bootstrap_form %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block title %}Création et modification d'utilisateur{% endblock %}
|
{% load i18n %}
|
||||||
|
{% block title %}{% trans "Users" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% bootstrap_form_errors userform %}
|
{% bootstrap_form_errors userform %}
|
||||||
|
@ -41,11 +42,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br>
|
<br>
|
||||||
{% if showCGU %}
|
{% if showCGU %}
|
||||||
<p>En cliquant sur Créer ou modifier, l'utilisateur s'engage à respecter les <a href="/media/{{ GTU }}" download="CGU" >règles d'utilisation du réseau</a>.</p>
|
<p>{% trans "By clicking 'Create or edit', the user commits to respect the " %}<a href="/media/{{ GTU }}" download="CGU" >{% trans "General Terms of Use" %}</a>.</p>
|
||||||
<h3>Résumé des règles d'utilisations</h3>
|
<h3>{% trans "Summary of the General Terms of Use" %}</h3>
|
||||||
<p>{{ GTU_sum_up }}</p>
|
<p>{{ GTU_sum_up }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
159
users/views.py
159
users/views.py
|
@ -46,6 +46,7 @@ from django.db import transaction
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from rest_framework.renderers import JSONRenderer
|
from rest_framework.renderers import JSONRenderer
|
||||||
from reversion import revisions as reversion
|
from reversion import revisions as reversion
|
||||||
|
@ -118,8 +119,8 @@ def new_user(request):
|
||||||
if user.is_valid():
|
if user.is_valid():
|
||||||
user = user.save()
|
user = user.save()
|
||||||
user.reset_passwd_mail(request)
|
user.reset_passwd_mail(request)
|
||||||
messages.success(request, "L'utilisateur %s a été crée, un mail\
|
messages.success(request, _("The user %s was created, an email to set"
|
||||||
pour l'initialisation du mot de passe a été envoyé" % user.pseudo)
|
" the password was sent.") % user.pseudo)
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(user.id)}
|
kwargs={'userid': str(user.id)}
|
||||||
|
@ -130,7 +131,7 @@ def new_user(request):
|
||||||
'GTU_sum_up': GTU_sum_up,
|
'GTU_sum_up': GTU_sum_up,
|
||||||
'GTU': GTU,
|
'GTU': GTU,
|
||||||
'showCGU': True,
|
'showCGU': True,
|
||||||
'action_name': 'Créer un utilisateur'
|
'action_name': _("Create a user")
|
||||||
},
|
},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
|
@ -147,14 +148,14 @@ def new_club(request):
|
||||||
club = club.save(commit=False)
|
club = club.save(commit=False)
|
||||||
club.save()
|
club.save()
|
||||||
club.reset_passwd_mail(request)
|
club.reset_passwd_mail(request)
|
||||||
messages.success(request, "L'utilisateur %s a été crée, un mail\
|
messages.success(request, _("The club %s was created, an email to set"
|
||||||
pour l'initialisation du mot de passe a été envoyé" % club.pseudo)
|
" the password was sent.") % club.pseudo)
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(club.id)}
|
kwargs={'userid': str(club.id)}
|
||||||
))
|
))
|
||||||
return form(
|
return form(
|
||||||
{'userform': club, 'showCGU': False, 'action_name': 'Créer un club'},
|
{'userform': club, 'showCGU': False, 'action_name': _("Create a club")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -172,7 +173,7 @@ def edit_club_admin_members(request, club_instance, **_kwargs):
|
||||||
if club.is_valid():
|
if club.is_valid():
|
||||||
if club.changed_data:
|
if club.changed_data:
|
||||||
club.save()
|
club.save()
|
||||||
messages.success(request, "Le club a bien été modifié")
|
messages.success(request, _("The club was edited."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(club_instance.id)}
|
kwargs={'userid': str(club_instance.id)}
|
||||||
|
@ -181,7 +182,7 @@ def edit_club_admin_members(request, club_instance, **_kwargs):
|
||||||
{
|
{
|
||||||
'userform': club,
|
'userform': club,
|
||||||
'showCGU': False,
|
'showCGU': False,
|
||||||
'action_name': 'Editer les admin et membres'
|
'action_name': _("Edit the admins and members")
|
||||||
},
|
},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
|
@ -209,13 +210,13 @@ def edit_info(request, user, userid):
|
||||||
if user_form.is_valid():
|
if user_form.is_valid():
|
||||||
if user_form.changed_data:
|
if user_form.changed_data:
|
||||||
user_form.save()
|
user_form.save()
|
||||||
messages.success(request, "L'user a bien été modifié")
|
messages.success(request, _("The user was edited."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(userid)}
|
kwargs={'userid': str(userid)}
|
||||||
))
|
))
|
||||||
return form(
|
return form(
|
||||||
{'userform': user_form, 'action_name': "Editer l'utilisateur"},
|
{'userform': user_form, 'action_name': _("Edit the user")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -229,13 +230,13 @@ def state(request, user, userid):
|
||||||
if state_form.is_valid():
|
if state_form.is_valid():
|
||||||
if state_form.changed_data:
|
if state_form.changed_data:
|
||||||
state_form.save()
|
state_form.save()
|
||||||
messages.success(request, "Etat changé avec succès")
|
messages.success(request, _("The state was edited."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(userid)}
|
kwargs={'userid': str(userid)}
|
||||||
))
|
))
|
||||||
return form(
|
return form(
|
||||||
{'userform': state_form, 'action_name': "Editer l'état"},
|
{'userform': state_form, 'action_name': _("Edit the state")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -250,13 +251,13 @@ def groups(request, user, userid):
|
||||||
if group_form.is_valid():
|
if group_form.is_valid():
|
||||||
if group_form.changed_data:
|
if group_form.changed_data:
|
||||||
group_form.save()
|
group_form.save()
|
||||||
messages.success(request, "Groupes changés avec succès")
|
messages.success(request, _("The groups were edited."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(userid)}
|
kwargs={'userid': str(userid)}
|
||||||
))
|
))
|
||||||
return form(
|
return form(
|
||||||
{'userform': group_form, 'action_name': 'Editer les groupes'},
|
{'userform': group_form, 'action_name': _("Edit the groups")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -272,13 +273,13 @@ def password(request, user, userid):
|
||||||
if u_form.is_valid():
|
if u_form.is_valid():
|
||||||
if u_form.changed_data:
|
if u_form.changed_data:
|
||||||
u_form.save()
|
u_form.save()
|
||||||
messages.success(request, "Le mot de passe a changé")
|
messages.success(request, _("The password was changed."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(userid)}
|
kwargs={'userid': str(userid)}
|
||||||
))
|
))
|
||||||
return form(
|
return form(
|
||||||
{'userform': u_form, 'action_name': 'Changer le mot de passe'},
|
{'userform': u_form, 'action_name': _("Change the password")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -290,7 +291,7 @@ def del_group(request, user, listrightid, **_kwargs):
|
||||||
""" View used to delete a group """
|
""" View used to delete a group """
|
||||||
user.groups.remove(ListRight.objects.get(id=listrightid))
|
user.groups.remove(ListRight.objects.get(id=listrightid))
|
||||||
user.save()
|
user.save()
|
||||||
messages.success(request, "Droit supprimé à %s" % user)
|
messages.success(request, _("%s was removed from the group.") % user)
|
||||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
|
return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
|
||||||
|
|
||||||
|
|
||||||
|
@ -300,7 +301,7 @@ def del_superuser(request, user, **_kwargs):
|
||||||
"""Remove the superuser right of an user."""
|
"""Remove the superuser right of an user."""
|
||||||
user.is_superuser = False
|
user.is_superuser = False
|
||||||
user.save()
|
user.save()
|
||||||
messages.success(request, "%s n'est plus superuser" % user)
|
messages.success(request, _("%s is no longer superuser.") % user)
|
||||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
|
return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
|
||||||
|
|
||||||
|
|
||||||
|
@ -313,11 +314,11 @@ def new_serviceuser(request):
|
||||||
user.save()
|
user.save()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
"L'utilisateur a été crée"
|
_("The service user was created.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('users:index-serviceusers'))
|
return redirect(reverse('users:index-serviceusers'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': user, 'action_name': 'Créer un serviceuser'},
|
{'userform': user, 'action_name': _("Create a service user")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -334,10 +335,10 @@ def edit_serviceuser(request, serviceuser, **_kwargs):
|
||||||
if serviceuser.is_valid():
|
if serviceuser.is_valid():
|
||||||
if serviceuser.changed_data:
|
if serviceuser.changed_data:
|
||||||
serviceuser.save()
|
serviceuser.save()
|
||||||
messages.success(request, "L'user a bien été modifié")
|
messages.success(request, _("The service user was edited."))
|
||||||
return redirect(reverse('users:index-serviceusers'))
|
return redirect(reverse('users:index-serviceusers'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': serviceuser, 'action_name': 'Editer un serviceuser'},
|
{'userform': serviceuser, 'action_name': _("Edit a service user")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -349,10 +350,10 @@ def del_serviceuser(request, serviceuser, **_kwargs):
|
||||||
"""Suppression d'un ou plusieurs serviceusers"""
|
"""Suppression d'un ou plusieurs serviceusers"""
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
serviceuser.delete()
|
serviceuser.delete()
|
||||||
messages.success(request, "L'user a été détruit")
|
messages.success(request, _("The service user was deleted."))
|
||||||
return redirect(reverse('users:index-serviceusers'))
|
return redirect(reverse('users:index-serviceusers'))
|
||||||
return form(
|
return form(
|
||||||
{'objet': serviceuser, 'objet_name': 'serviceuser'},
|
{'objet': serviceuser, 'objet_name': 'service user'},
|
||||||
'users/delete.html',
|
'users/delete.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -369,7 +370,7 @@ def add_ban(request, user, userid):
|
||||||
ban = BanForm(request.POST or None, instance=ban_instance)
|
ban = BanForm(request.POST or None, instance=ban_instance)
|
||||||
if ban.is_valid():
|
if ban.is_valid():
|
||||||
ban.save()
|
ban.save()
|
||||||
messages.success(request, "Bannissement ajouté")
|
messages.success(request, _("The ban was added."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(userid)}
|
kwargs={'userid': str(userid)}
|
||||||
|
@ -377,10 +378,10 @@ def add_ban(request, user, userid):
|
||||||
if user.is_ban():
|
if user.is_ban():
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
"Attention, cet utilisateur a deja un bannissement actif"
|
_("Warning: this user already has an active ban.")
|
||||||
)
|
)
|
||||||
return form(
|
return form(
|
||||||
{'userform': ban, 'action_name': 'Ajouter un ban'},
|
{'userform': ban, 'action_name': _("Add a ban")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -396,10 +397,10 @@ def edit_ban(request, ban_instance, **_kwargs):
|
||||||
if ban.is_valid():
|
if ban.is_valid():
|
||||||
if ban.changed_data:
|
if ban.changed_data:
|
||||||
ban.save()
|
ban.save()
|
||||||
messages.success(request, "Bannissement modifié")
|
messages.success(request, _("The ban was edited."))
|
||||||
return redirect(reverse('users:index'))
|
return redirect(reverse('users:index'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': ban, 'action_name': 'Editer un ban'},
|
{'userform': ban, 'action_name': _("Edit a ban")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -411,7 +412,7 @@ def del_ban(request, ban, **_kwargs):
|
||||||
""" Supprime un banissement"""
|
""" Supprime un banissement"""
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
ban.delete()
|
ban.delete()
|
||||||
messages.success(request, "Le banissement a été supprimé")
|
messages.success(request, _("The ban was deleted."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(ban.user.id)}
|
kwargs={'userid': str(ban.user.id)}
|
||||||
|
@ -438,7 +439,7 @@ def add_whitelist(request, user, userid):
|
||||||
)
|
)
|
||||||
if whitelist.is_valid():
|
if whitelist.is_valid():
|
||||||
whitelist.save()
|
whitelist.save()
|
||||||
messages.success(request, "Accès à titre gracieux accordé")
|
messages.success(request, _("The whitelist was added."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(userid)}
|
kwargs={'userid': str(userid)}
|
||||||
|
@ -446,10 +447,10 @@ def add_whitelist(request, user, userid):
|
||||||
if user.is_whitelisted():
|
if user.is_whitelisted():
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
"Attention, cet utilisateur a deja un accès gracieux actif"
|
_("Warning: this user already has an active whitelist.")
|
||||||
)
|
)
|
||||||
return form(
|
return form(
|
||||||
{'userform': whitelist, 'action_name': 'Ajouter une whitelist'},
|
{'userform': whitelist, 'action_name': _("Add a whitelist")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -469,10 +470,10 @@ def edit_whitelist(request, whitelist_instance, **_kwargs):
|
||||||
if whitelist.is_valid():
|
if whitelist.is_valid():
|
||||||
if whitelist.changed_data:
|
if whitelist.changed_data:
|
||||||
whitelist.save()
|
whitelist.save()
|
||||||
messages.success(request, "Whitelist modifiée")
|
messages.success(request, _("The whitelist was edited."))
|
||||||
return redirect(reverse('users:index'))
|
return redirect(reverse('users:index'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': whitelist, 'action_name': 'Editer une whitelist'},
|
{'userform': whitelist, 'action_name': _("Edit a whitelist")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -484,7 +485,7 @@ def del_whitelist(request, whitelist, **_kwargs):
|
||||||
""" Supprime un acces gracieux"""
|
""" Supprime un acces gracieux"""
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
whitelist.delete()
|
whitelist.delete()
|
||||||
messages.success(request, "L'accés gracieux a été supprimé")
|
messages.success(request, _("The whitelist was deleted."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(whitelist.user.id)}
|
kwargs={'userid': str(whitelist.user.id)}
|
||||||
|
@ -508,7 +509,7 @@ def add_emailaddress(request, user, userid):
|
||||||
)
|
)
|
||||||
if emailaddress.is_valid():
|
if emailaddress.is_valid():
|
||||||
emailaddress.save()
|
emailaddress.save()
|
||||||
messages.success(request, "Local email account created")
|
messages.success(request, _("The local email account was created."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(userid)}
|
kwargs={'userid': str(userid)}
|
||||||
|
@ -516,7 +517,7 @@ def add_emailaddress(request, user, userid):
|
||||||
return form(
|
return form(
|
||||||
{'userform': emailaddress,
|
{'userform': emailaddress,
|
||||||
'showCGU': False,
|
'showCGU': False,
|
||||||
'action_name': 'Add a local email account'},
|
'action_name': _("Add a local email account")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -533,7 +534,7 @@ def edit_emailaddress(request, emailaddress_instance, **_kwargs):
|
||||||
if emailaddress.is_valid():
|
if emailaddress.is_valid():
|
||||||
if emailaddress.changed_data:
|
if emailaddress.changed_data:
|
||||||
emailaddress.save()
|
emailaddress.save()
|
||||||
messages.success(request, "Local email account modified")
|
messages.success(request, _("The local email account was edited."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(emailaddress_instance.user.id)}
|
kwargs={'userid': str(emailaddress_instance.user.id)}
|
||||||
|
@ -541,8 +542,7 @@ def edit_emailaddress(request, emailaddress_instance, **_kwargs):
|
||||||
return form(
|
return form(
|
||||||
{'userform': emailaddress,
|
{'userform': emailaddress,
|
||||||
'showCGU': False,
|
'showCGU': False,
|
||||||
'action_name': 'Edit a local email account',
|
'action_name': _("Edit a local email account")},
|
||||||
},
|
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -554,7 +554,7 @@ def del_emailaddress(request, emailaddress, **_kwargs):
|
||||||
"""Delete a local email account"""
|
"""Delete a local email account"""
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
emailaddress.delete()
|
emailaddress.delete()
|
||||||
messages.success(request, "Local email account deleted")
|
messages.success(request, _("The local email account was deleted."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(emailaddress.user.id)}
|
kwargs={'userid': str(emailaddress.user.id)}
|
||||||
|
@ -578,7 +578,7 @@ def edit_email_settings(request, user_instance, **_kwargs):
|
||||||
if email_settings.is_valid():
|
if email_settings.is_valid():
|
||||||
if email_settings.changed_data:
|
if email_settings.changed_data:
|
||||||
email_settings.save()
|
email_settings.save()
|
||||||
messages.success(request, "Email settings updated")
|
messages.success(request, _("The email settings were edited."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(user_instance.id)}
|
kwargs={'userid': str(user_instance.id)}
|
||||||
|
@ -587,7 +587,7 @@ def edit_email_settings(request, user_instance, **_kwargs):
|
||||||
{'userform': email_settings,
|
{'userform': email_settings,
|
||||||
'showCGU': False,
|
'showCGU': False,
|
||||||
'load_js_file': '/static/js/email_address.js',
|
'load_js_file': '/static/js/email_address.js',
|
||||||
'action_name': 'Edit the email settings'},
|
'action_name': _("Edit the email settings")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -601,10 +601,10 @@ def add_school(request):
|
||||||
school = SchoolForm(request.POST or None)
|
school = SchoolForm(request.POST or None)
|
||||||
if school.is_valid():
|
if school.is_valid():
|
||||||
school.save()
|
school.save()
|
||||||
messages.success(request, "L'établissement a été ajouté")
|
messages.success(request, _("The school was added."))
|
||||||
return redirect(reverse('users:index-school'))
|
return redirect(reverse('users:index-school'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': school, 'action_name': 'Ajouter'},
|
{'userform': school, 'action_name': _("Add a school")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -619,10 +619,10 @@ def edit_school(request, school_instance, **_kwargs):
|
||||||
if school.is_valid():
|
if school.is_valid():
|
||||||
if school.changed_data:
|
if school.changed_data:
|
||||||
school.save()
|
school.save()
|
||||||
messages.success(request, "Établissement modifié")
|
messages.success(request, _("The school was edited."))
|
||||||
return redirect(reverse('users:index-school'))
|
return redirect(reverse('users:index-school'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': school, 'action_name': 'Editer'},
|
{'userform': school, 'action_name': _("Edit a school")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -641,15 +641,15 @@ def del_school(request, instances):
|
||||||
for school_del in school_dels:
|
for school_del in school_dels:
|
||||||
try:
|
try:
|
||||||
school_del.delete()
|
school_del.delete()
|
||||||
messages.success(request, "L'établissement a été supprimé")
|
messages.success(request, _("The school was deleted."))
|
||||||
except ProtectedError:
|
except ProtectedError:
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
"L'établissement %s est affecté à au moins un user, \
|
_("The school %s is assigned to at least one user,"
|
||||||
vous ne pouvez pas le supprimer" % school_del)
|
" impossible to delete it.") % school_del)
|
||||||
return redirect(reverse('users:index-school'))
|
return redirect(reverse('users:index-school'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': school, 'action_name': 'Supprimer'},
|
{'userform': school, 'action_name': _("Delete")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -662,10 +662,10 @@ def add_shell(request):
|
||||||
shell = ShellForm(request.POST or None)
|
shell = ShellForm(request.POST or None)
|
||||||
if shell.is_valid():
|
if shell.is_valid():
|
||||||
shell.save()
|
shell.save()
|
||||||
messages.success(request, "Le shell a été ajouté")
|
messages.success(request, _("The shell was added."))
|
||||||
return redirect(reverse('users:index-shell'))
|
return redirect(reverse('users:index-shell'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': shell, 'action_name': 'Ajouter'},
|
{'userform': shell, 'action_name': _("Add a shell")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -679,10 +679,10 @@ def edit_shell(request, shell_instance, **_kwargs):
|
||||||
if shell.is_valid():
|
if shell.is_valid():
|
||||||
if shell.changed_data:
|
if shell.changed_data:
|
||||||
shell.save()
|
shell.save()
|
||||||
messages.success(request, "Le shell a été modifié")
|
messages.success(request, _("The shell was edited."))
|
||||||
return redirect(reverse('users:index-shell'))
|
return redirect(reverse('users:index-shell'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': shell, 'action_name': 'Editer'},
|
{'userform': shell, 'action_name': _("Edit a shell")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -694,7 +694,7 @@ def del_shell(request, shell, **_kwargs):
|
||||||
"""Destruction d'un shell"""
|
"""Destruction d'un shell"""
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
shell.delete()
|
shell.delete()
|
||||||
messages.success(request, "Le shell a été détruit")
|
messages.success(request, _("The shell was deleted."))
|
||||||
return redirect(reverse('users:index-shell'))
|
return redirect(reverse('users:index-shell'))
|
||||||
return form(
|
return form(
|
||||||
{'objet': shell, 'objet_name': 'shell'},
|
{'objet': shell, 'objet_name': 'shell'},
|
||||||
|
@ -711,10 +711,10 @@ def add_listright(request):
|
||||||
listright = NewListRightForm(request.POST or None)
|
listright = NewListRightForm(request.POST or None)
|
||||||
if listright.is_valid():
|
if listright.is_valid():
|
||||||
listright.save()
|
listright.save()
|
||||||
messages.success(request, "Le droit/groupe a été ajouté")
|
messages.success(request, _("The group of rights was added."))
|
||||||
return redirect(reverse('users:index-listright'))
|
return redirect(reverse('users:index-listright'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': listright, 'action_name': 'Ajouter'},
|
{'userform': listright, 'action_name': _("Add a group of rights")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -732,10 +732,10 @@ def edit_listright(request, listright_instance, **_kwargs):
|
||||||
if listright.is_valid():
|
if listright.is_valid():
|
||||||
if listright.changed_data:
|
if listright.changed_data:
|
||||||
listright.save()
|
listright.save()
|
||||||
messages.success(request, "Droit modifié")
|
messages.success(request, _("The group of rights was edited."))
|
||||||
return redirect(reverse('users:index-listright'))
|
return redirect(reverse('users:index-listright'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': listright, 'action_name': 'Editer'},
|
{'userform': listright, 'action_name': _("Edit a group of rights")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -752,15 +752,16 @@ def del_listright(request, instances):
|
||||||
for listright_del in listright_dels:
|
for listright_del in listright_dels:
|
||||||
try:
|
try:
|
||||||
listright_del.delete()
|
listright_del.delete()
|
||||||
messages.success(request, "Le droit/groupe a été supprimé")
|
messages.success(request, _("The group of rights was"
|
||||||
|
" deleted."))
|
||||||
except ProtectedError:
|
except ProtectedError:
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
"Le groupe %s est affecté à au moins un user, \
|
_("The group of rights %s is assigned to at least one"
|
||||||
vous ne pouvez pas le supprimer" % listright_del)
|
" user, impossible to delete it.") % listright_del)
|
||||||
return redirect(reverse('users:index-listright'))
|
return redirect(reverse('users:index-listright'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': listright, 'action_name': 'Supprimer'},
|
{'userform': listright, 'action_name': _("Delete")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -784,8 +785,8 @@ def mass_archive(request):
|
||||||
with transaction.atomic(), reversion.create_revision():
|
with transaction.atomic(), reversion.create_revision():
|
||||||
user.archive()
|
user.archive()
|
||||||
user.save()
|
user.save()
|
||||||
reversion.set_comment("Archivage")
|
reversion.set_comment(_("Archiving"))
|
||||||
messages.success(request, "%s users ont été archivés" % len(
|
messages.success(request, _("%s users were archived.") % len(
|
||||||
to_archive_list
|
to_archive_list
|
||||||
))
|
))
|
||||||
return redirect(reverse('users:index'))
|
return redirect(reverse('users:index'))
|
||||||
|
@ -1034,18 +1035,17 @@ def reset_password(request):
|
||||||
email=userform.cleaned_data['email']
|
email=userform.cleaned_data['email']
|
||||||
)
|
)
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
messages.error(request, "Cet utilisateur n'existe pas")
|
messages.error(request, _("The user doesn't exist."))
|
||||||
return form(
|
return form(
|
||||||
{'userform': userform, 'action_name': 'Réinitialiser'},
|
{'userform': userform, 'action_name': _("Reset")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
user.reset_passwd_mail(request)
|
user.reset_passwd_mail(request)
|
||||||
messages.success(request, "Un mail pour l'initialisation du mot\
|
messages.success(request, _("An email to reset the password was sent."))
|
||||||
de passe a été envoyé")
|
|
||||||
redirect(reverse('index'))
|
redirect(reverse('index'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': userform, 'action_name': 'Réinitialiser'},
|
{'userform': userform, 'action_name': _("Reset")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -1059,7 +1059,7 @@ def process(request, token):
|
||||||
if req.type == Request.PASSWD:
|
if req.type == Request.PASSWD:
|
||||||
return process_passwd(request, req)
|
return process_passwd(request, req)
|
||||||
else:
|
else:
|
||||||
messages.error(request, "Entrée incorrecte, contactez un admin")
|
messages.error(request, _("Error: please contact an admin."))
|
||||||
redirect(reverse('index'))
|
redirect(reverse('index'))
|
||||||
|
|
||||||
|
|
||||||
|
@ -1071,12 +1071,12 @@ def process_passwd(request, req):
|
||||||
if u_form.is_valid():
|
if u_form.is_valid():
|
||||||
with transaction.atomic(), reversion.create_revision():
|
with transaction.atomic(), reversion.create_revision():
|
||||||
u_form.save()
|
u_form.save()
|
||||||
reversion.set_comment("Réinitialisation du mot de passe")
|
reversion.set_comment(_("Password reset"))
|
||||||
req.delete()
|
req.delete()
|
||||||
messages.success(request, "Le mot de passe a changé")
|
messages.success(request, _("The password was changed."))
|
||||||
return redirect(reverse('index'))
|
return redirect(reverse('index'))
|
||||||
return form(
|
return form(
|
||||||
{'userform': u_form, 'action_name': 'Changer le mot de passe'},
|
{'userform': u_form, 'action_name': _("Change the password")},
|
||||||
'users/user.html',
|
'users/user.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -1111,7 +1111,7 @@ def ml_std_members(request, ml_name):
|
||||||
members = all_has_access().values('email').distinct()
|
members = all_has_access().values('email').distinct()
|
||||||
# Unknown mailing
|
# Unknown mailing
|
||||||
else:
|
else:
|
||||||
messages.error(request, "Cette mailing n'existe pas")
|
messages.error(request, _("The mailing list doesn't exist."))
|
||||||
return redirect(reverse('index'))
|
return redirect(reverse('index'))
|
||||||
seria = MailingMemberSerializer(members, many=True)
|
seria = MailingMemberSerializer(members, many=True)
|
||||||
return JSONResponse(seria.data)
|
return JSONResponse(seria.data)
|
||||||
|
@ -1135,7 +1135,7 @@ def ml_club_admins(request, ml_name):
|
||||||
try:
|
try:
|
||||||
club = Club.objects.get(mailing=True, pseudo=ml_name)
|
club = Club.objects.get(mailing=True, pseudo=ml_name)
|
||||||
except Club.DoesNotExist:
|
except Club.DoesNotExist:
|
||||||
messages.error(request, "Cette mailing n'existe pas")
|
messages.error(request, _("The mailing list doesn't exist."))
|
||||||
return redirect(reverse('index'))
|
return redirect(reverse('index'))
|
||||||
members = club.administrators.all().values('email').distinct()
|
members = club.administrators.all().values('email').distinct()
|
||||||
seria = MailingMemberSerializer(members, many=True)
|
seria = MailingMemberSerializer(members, many=True)
|
||||||
|
@ -1150,7 +1150,7 @@ def ml_club_members(request, ml_name):
|
||||||
try:
|
try:
|
||||||
club = Club.objects.get(mailing=True, pseudo=ml_name)
|
club = Club.objects.get(mailing=True, pseudo=ml_name)
|
||||||
except Club.DoesNotExist:
|
except Club.DoesNotExist:
|
||||||
messages.error(request, "Cette mailing n'existe pas")
|
messages.error(request, _("The mailing list doesn't exist."))
|
||||||
return redirect(reverse('index'))
|
return redirect(reverse('index'))
|
||||||
members = (
|
members = (
|
||||||
club.administrators.all().values('email').distinct() |
|
club.administrators.all().values('email').distinct() |
|
||||||
|
@ -1158,3 +1158,4 @@ def ml_club_members(request, ml_name):
|
||||||
)
|
)
|
||||||
seria = MailingMemberSerializer(members, many=True)
|
seria = MailingMemberSerializer(members, many=True)
|
||||||
return JSONResponse(seria.data)
|
return JSONResponse(seria.data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue