projects
/
mudpy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add restricted debug mode
[mudpy.git]
/
mudpy
/
misc.py
diff --git
a/mudpy/misc.py
b/mudpy/misc.py
index
babd42f
..
3968039
100644
(file)
--- 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."""
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."""
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)
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)
# 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)
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:
class User: