X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=blobdiff_plain;f=mudpy%2Fmisc.py;h=3968039fff7d240a8ca2b05e5aa91bd69984b4bc;hp=babd42f04dd6e7e4612dec3a43caa5bb5629dad4;hb=2c533eb48672110a04d6c4850d3e103d6294ee8d;hpb=b27c62e7d11d4c221666e7e0241a8ea51902be88 diff --git a/mudpy/misc.py b/mudpy/misc.py index babd42f..3968039 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -186,7 +186,8 @@ class Element: def is_restricted(self): """Boolean check whether command is administrative or debugging.""" - return(self.get("administrative", False)) + return( + self.get("administrative", False) or self.get("debugging", False)) def is_admin(self): """Boolean check whether an actor is controlled by an admin owner.""" @@ -199,6 +200,10 @@ class Element: if command not in self.universe.groups["command"].values(): return(False) + # debugging commands are not allowed outside debug mode + if command.get("debugging") and not self.universe.debug_mode(): + return(False) + # avatars of administrators can run any command if self.is_admin(): return(True) @@ -481,6 +486,10 @@ class Universe: if fallback not in self.files: mudpy.data.Data(fallback, self, flags=flags) + def debug_mode(self): + """Boolean method to indicate whether unsafe debugging is enabled.""" + return self.groups["mudpy"]["limit"].get("debug", False) + class User: