From 0a5701d6275c80cfbd43afa81055e324cabc06d7 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 26 Oct 2018 20:07:05 +0200 Subject: [PATCH] Give default permissions to spawn/edit prototypes. Resolves #1687. --- evennia/commands/default/building.py | 3 ++- evennia/prototypes/prototypes.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 503a9c15e9..7b77ae0faa 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -3091,7 +3091,8 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS): return # we have a prototype, check access prototype = prototypes[0] - if not caller.locks.check_lockstring(caller, prototype.get('prototype_locks', ''), access_type='spawn'): + if not caller.locks.check_lockstring( + caller, prototype.get('prototype_locks', ''), access_type='spawn', default=True): caller.msg("You don't have access to use this prototype.") return diff --git a/evennia/prototypes/prototypes.py b/evennia/prototypes/prototypes.py index fc8edb55ab..833316cf59 100644 --- a/evennia/prototypes/prototypes.py +++ b/evennia/prototypes/prototypes.py @@ -258,7 +258,7 @@ def delete_prototype(prototype_key, caller=None): stored_prototype = stored_prototype[0] if caller: if not stored_prototype.access(caller, 'edit'): - raise PermissionError("{} does not have permission to " + raise PermissionError("{} needs explicit 'edit' permissions to " "delete prototype {}.".format(caller, prototype_key)) stored_prototype.delete() return True @@ -374,14 +374,14 @@ def list_prototypes(caller, key=None, tags=None, show_non_use=False, show_non_ed display_tuples = [] for prototype in sorted(prototypes, key=lambda d: d.get('prototype_key', '')): lock_use = caller.locks.check_lockstring( - caller, prototype.get('prototype_locks', ''), access_type='spawn') + caller, prototype.get('prototype_locks', ''), access_type='spawn', default=True) if not show_non_use and not lock_use: continue if prototype.get('prototype_key', '') in _MODULE_PROTOTYPES: lock_edit = False else: lock_edit = caller.locks.check_lockstring( - caller, prototype.get('prototype_locks', ''), access_type='edit') + caller, prototype.get('prototype_locks', ''), access_type='edit', default=True) if not show_non_edit and not lock_edit: continue ptags = [] @@ -713,7 +713,8 @@ def check_permission(prototype_key, action, default=True): lockstring = prototype.get("prototype_locks") if lockstring: - return check_lockstring(None, lockstring, default=default, access_type=action) + return check_lockstring(None, lockstring, + default=default, access_type=action) return default