parent
06588f6695
commit
0a5701d627
2 changed files with 7 additions and 5 deletions
|
|
@ -3091,7 +3091,8 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
|
||||||
return
|
return
|
||||||
# we have a prototype, check access
|
# we have a prototype, check access
|
||||||
prototype = prototypes[0]
|
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.")
|
caller.msg("You don't have access to use this prototype.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ def delete_prototype(prototype_key, caller=None):
|
||||||
stored_prototype = stored_prototype[0]
|
stored_prototype = stored_prototype[0]
|
||||||
if caller:
|
if caller:
|
||||||
if not stored_prototype.access(caller, 'edit'):
|
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))
|
"delete prototype {}.".format(caller, prototype_key))
|
||||||
stored_prototype.delete()
|
stored_prototype.delete()
|
||||||
return True
|
return True
|
||||||
|
|
@ -374,14 +374,14 @@ def list_prototypes(caller, key=None, tags=None, show_non_use=False, show_non_ed
|
||||||
display_tuples = []
|
display_tuples = []
|
||||||
for prototype in sorted(prototypes, key=lambda d: d.get('prototype_key', '')):
|
for prototype in sorted(prototypes, key=lambda d: d.get('prototype_key', '')):
|
||||||
lock_use = caller.locks.check_lockstring(
|
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:
|
if not show_non_use and not lock_use:
|
||||||
continue
|
continue
|
||||||
if prototype.get('prototype_key', '') in _MODULE_PROTOTYPES:
|
if prototype.get('prototype_key', '') in _MODULE_PROTOTYPES:
|
||||||
lock_edit = False
|
lock_edit = False
|
||||||
else:
|
else:
|
||||||
lock_edit = caller.locks.check_lockstring(
|
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:
|
if not show_non_edit and not lock_edit:
|
||||||
continue
|
continue
|
||||||
ptags = []
|
ptags = []
|
||||||
|
|
@ -713,7 +713,8 @@ def check_permission(prototype_key, action, default=True):
|
||||||
lockstring = prototype.get("prototype_locks")
|
lockstring = prototype.get("prototype_locks")
|
||||||
|
|
||||||
if lockstring:
|
if lockstring:
|
||||||
return check_lockstring(None, lockstring, default=default, access_type=action)
|
return check_lockstring(None, lockstring,
|
||||||
|
default=default, access_type=action)
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue