mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-09 11:26:27 +00:00
users can change their shell
This commit is contained in:
parent
65fed7455c
commit
ba31a94c20
4 changed files with 37 additions and 8 deletions
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.7 on 2018-08-13 17:18
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('preferences', '0048_auto_20180811_1515'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='optionaluser',
|
||||||
|
name='self_change_shell',
|
||||||
|
field=models.BooleanField(default=False, help_text='Users can change their shell'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -85,6 +85,10 @@ class OptionalUser(AclMixin, PreferencesModel):
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True
|
||||||
)
|
)
|
||||||
|
self_change_shell = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="Users can change their shell"
|
||||||
|
)
|
||||||
local_email_accounts_enabled = models.BooleanField(
|
local_email_accounts_enabled = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
help_text="Enable local email accounts for users"
|
help_text="Enable local email accounts for users"
|
||||||
|
|
|
@ -45,10 +45,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ useroptions.self_adhesion|tick }}</td>
|
<td>{{ useroptions.self_adhesion|tick }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Champ gpg fingerprint</th>
|
|
||||||
<td>{{ useroptions.gpg_fingerprint|tick }}</td>
|
|
||||||
<th>Shell par défaut des utilisateurs</th>
|
<th>Shell par défaut des utilisateurs</th>
|
||||||
<td>{{ useroptions.shell_default }}</td>
|
<td>{{ useroptions.shell_default }}</td>
|
||||||
|
<th>Les utilisateurs peuvent changer leur shell</th>
|
||||||
|
<td>{{ useroptions.self_change_shell|tick }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Creations d'adhérents par tous</th>
|
<th>Creations d'adhérents par tous</th>
|
||||||
|
@ -56,6 +57,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<th>Creations de clubs par tous</th>
|
<th>Creations de clubs par tous</th>
|
||||||
<td>{{ useroptions.all_can_create_club|tick }}</td>
|
<td>{{ useroptions.all_can_create_club|tick }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Champ gpg fingerprint</th>
|
||||||
|
<td>{{ useroptions.gpg_fingerprint|tick }}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h5>Comptes mails</h5>
|
<h5>Comptes mails</h5>
|
||||||
|
|
|
@ -832,18 +832,18 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
|
||||||
"Droit requis pour changer l'état"
|
"Droit requis pour changer l'état"
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
def can_change_shell(self, user_request, *_args, **_kwargs):
|
||||||
def can_change_shell(user_request, *_args, **_kwargs):
|
|
||||||
""" Check if a user can change a shell
|
""" Check if a user can change a shell
|
||||||
|
|
||||||
:param user_request: The user who request
|
:param user_request: The user who request
|
||||||
:returns: a message and a boolean which is True if the user has
|
:returns: a message and a boolean which is True if the user has
|
||||||
the right to change a shell
|
the right to change a shell
|
||||||
"""
|
"""
|
||||||
return (
|
if not ((self == user_request and OptionalUser.get_cached_value('self_change_shell'))
|
||||||
user_request.has_perm('users.change_user_shell'),
|
or user_request.has_perm('users.change_user_shell')):
|
||||||
"Droit requis pour changer le shell"
|
return False, u"Droit requis pour changer le shell"
|
||||||
)
|
else:
|
||||||
|
return True, None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_change_local_email_redirect(user_request, *_args, **_kwargs):
|
def can_change_local_email_redirect(user_request, *_args, **_kwargs):
|
||||||
|
|
Loading…
Reference in a new issue