Allow for removing "Guest" from permission hierarchy without messing up access. Resolve #3247

This commit is contained in:
Griatch 2023-08-06 22:51:18 +02:00
parent abc55276c6
commit 4d8ca48bd7
2 changed files with 4 additions and 4 deletions

View file

@ -8,6 +8,7 @@
- Fix: Webclient was not giving a proper error when sending an unknown outputfunc to it.
- Fix: Make `py` command always send strings unless `client_raw` flag is set.
- Fix: `Script.start` with an integer `start_delay` caused a traceback.
- Fix: Removing "Guest" from the permission-hierarchy setting messed up access.
- Docs: Remove doc pages for Travis/TeamCity CI tools, they were both very much
out of date, and Travis is not free for OSS anymore.
- Docs: A lot fixes of typos and bugs in tutorials.

View file

@ -17,7 +17,6 @@ a certain object type.
from ast import literal_eval
from django.conf import settings
from evennia.utils import utils
_PERMISSION_HIERARCHY = [pe.lower() for pe in settings.PERMISSION_HIERARCHY]
@ -127,7 +126,7 @@ def perm(accessing_obj, accessed_obj, *args, **kwargs):
hpos_target = None
if permission in _PERMISSION_HIERARCHY:
hpos_target = _PERMISSION_HIERARCHY.index(permission)
if permission.endswith("s") and permission[:-1] in _PERMISSION_HIERARCHY:
elif permission.endswith("s") and permission[:-1] in _PERMISSION_HIERARCHY:
hpos_target = _PERMISSION_HIERARCHY.index(permission[:-1])
if hpos_target is not None:
# hieratchy match
@ -142,7 +141,7 @@ def perm(accessing_obj, accessed_obj, *args, **kwargs):
for hpos, hperm in enumerate(_PERMISSION_HIERARCHY)
if hperm in perms_account_single
]
hpos_account = hpos_account and hpos_account[-1] or -1
hpos_account = hpos_account[-1] if hpos_account else -1
if not account or is_quell:
# only get the object-level perms if there is no account or quelling
@ -152,7 +151,7 @@ def perm(accessing_obj, accessed_obj, *args, **kwargs):
for hpos, hperm in enumerate(_PERMISSION_HIERARCHY)
if hperm in perms_object_single
]
hpos_object = hpos_object and hpos_object[-1] or -1
hpos_object = hpos_object[-1] if hpos_object else -1
if account and is_quell:
# quell mode: use smallest perm from account and object