Make the 'exec' prototype key only usable for Immortals from the command line. Also fixes a bug in the check_permission method that made it not honor quelling.

This commit is contained in:
Griatch 2016-08-21 23:59:56 +02:00
parent 89568b5277
commit faa3dca2d0
2 changed files with 10 additions and 3 deletions

View file

@ -2597,6 +2597,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
self.caller.msg(string)
return
if isinstance(prototype, basestring):
# A prototype key
keystr = prototype
@ -2605,7 +2606,13 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
string = "No prototype named '%s'." % keystr
self.caller.msg(string + _show_prototypes(prototypes))
return
elif not isinstance(prototype, dict):
elif isinstance(prototype, dict):
# we got the prototype on the command line. We must make sure to not allow
# the 'exec' key unless we are immortals or higher.
if "exec" in prototype and not self.caller.check_permstring("Immortals"):
self.caller.msg("Spawn aborted: You don't have access to use the 'exec' prototype key.")
return
else:
self.caller.msg("The prototype must be a prototype key or a Python dictionary.")
return

View file

@ -525,10 +525,10 @@ class TypedObject(SharedMemoryModel):
"""
if hasattr(self, "player"):
if self.player and self.player.is_superuser:
if self.player and self.player.is_superuser and not self.player.attributes.get("_quell"):
return True
else:
if self.is_superuser:
if self.is_superuser and not self.attributes.get("_quell"):
return True
if not permstring: