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