Add backdoor to login as other users (in debug mode only)
This commit is contained in:
parent
b49db39080
commit
fb775de923
6 changed files with 53 additions and 7 deletions
|
|
@ -1,7 +1,6 @@
|
|||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
from django.contrib.auth.models import User, AnonymousUser
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
|
@ -137,7 +136,7 @@ class PermissionBackend(ModelBackend):
|
|||
if sess is not None and sess.session_key is None:
|
||||
return False
|
||||
|
||||
if user_obj.is_superuser and get_current_session().get("permission_mask", -1) >= 42:
|
||||
if user_obj.is_superuser and sess.get("permission_mask", -1) >= 42:
|
||||
return True
|
||||
|
||||
if obj is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue