mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-21 19:03:11 +00:00
Fix permission check
This commit is contained in:
parent
24c000e743
commit
60a55ea1e0
2 changed files with 23 additions and 3 deletions
19
users/migrations/0091_auto_20200423_1256.py
Normal file
19
users/migrations/0091_auto_20200423_1256.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.28 on 2020-04-23 10:56
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0090_auto_20200421_1825'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
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_pseudo', 'Can edit the pseudo 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)'},
|
||||
),
|
||||
]
|
|
@ -252,6 +252,7 @@ class 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_pseudo", _("Can edit the pseudo of a user")),
|
||||
(
|
||||
"change_user_groups",
|
||||
_("Can edit the groups of rights of a user (critical permission)"),
|
||||
|
@ -1180,12 +1181,12 @@ class User(
|
|||
self.pk == user_request.pk
|
||||
and OptionalUser.get_cached_value("self_change_pseudo")
|
||||
)
|
||||
or user_request.has_perm("users.change_user_shell")
|
||||
or user_request.has_perm("users.change_user_pseudo")
|
||||
):
|
||||
return (
|
||||
False,
|
||||
_("You don't have the right to change the shell."),
|
||||
("users.change_user_shell",),
|
||||
_("You don't have the right to change the pseudo."),
|
||||
("users.change_user_pseudo",),
|
||||
)
|
||||
else:
|
||||
return True, None, None
|
||||
|
|
Loading…
Reference in a new issue