Fixed some issues with the _superuser_character bypass as well as the is_superuser property on objects. Also fixed a bug with @examine that caused it to display object Attribute instead of Player Attributes when called from the ooc state.
This commit is contained in:
parent
7a8e53b3bd
commit
77a0b47859
3 changed files with 11 additions and 8 deletions
|
|
@ -1547,6 +1547,7 @@ class CmdExamine(ObjManipCommand):
|
||||||
else:
|
else:
|
||||||
if self.player_mode:
|
if self.player_mode:
|
||||||
db_attr = [(attr.key, attr.value) for attr in PlayerAttribute.objects.filter(db_obj=obj)]
|
db_attr = [(attr.key, attr.value) for attr in PlayerAttribute.objects.filter(db_obj=obj)]
|
||||||
|
print "player mode:", db_attr
|
||||||
else:
|
else:
|
||||||
db_attr = [(attr.key, attr.value) for attr in ObjAttribute.objects.filter(db_obj=obj)]
|
db_attr = [(attr.key, attr.value) for attr in ObjAttribute.objects.filter(db_obj=obj)]
|
||||||
try:
|
try:
|
||||||
|
|
@ -1683,10 +1684,14 @@ class CmdExamine(ObjManipCommand):
|
||||||
obj_name = objdef['name']
|
obj_name = objdef['name']
|
||||||
obj_attrs = objdef['attrs']
|
obj_attrs = objdef['attrs']
|
||||||
|
|
||||||
|
self.player_mode = utils.inherits_from(caller, "src.players.player.Player") or \
|
||||||
self.player_mode = "player" in self.switches or obj_name.startswith('*')
|
"player" in self.switches or obj_name.startswith('*')
|
||||||
if self.player_mode:
|
if self.player_mode:
|
||||||
obj = caller.search_player(obj_name.lstrip('*'))
|
try:
|
||||||
|
obj = caller.search_player(obj_name.lstrip('*'))
|
||||||
|
except AttributeError:
|
||||||
|
# this means we are calling examine from a player object
|
||||||
|
obj = caller.search(obj_name.lstrip('*'))
|
||||||
else:
|
else:
|
||||||
obj = caller.search(obj_name)
|
obj = caller.search(obj_name)
|
||||||
if not obj:
|
if not obj:
|
||||||
|
|
|
||||||
|
|
@ -260,10 +260,7 @@ class LockHandler(object):
|
||||||
before the login process has yet been fully finalized)
|
before the login process has yet been fully finalized)
|
||||||
"""
|
"""
|
||||||
#print "_superuser_character:", hasattr(obj, "get_attribute") and obj.get_attribute("_superuser_character")
|
#print "_superuser_character:", hasattr(obj, "get_attribute") and obj.get_attribute("_superuser_character")
|
||||||
self.lock_bypass = (hasattr(obj, "is_superuser") and obj.is_superuser
|
self.lock_bypass = hasattr(obj, "is_superuser") and obj.is_superuser
|
||||||
or ((hasattr(obj, "get_attribute") and obj.get_attribute("_superuser_character"))
|
|
||||||
and ((hasattr(obj, "player") and hasattr(obj.player, "is_superuser") and obj.player.is_superuser)
|
|
||||||
or (hasattr(obj, "get_player") and (not obj.get_player() or obj.get_player().is_superuser)))))
|
|
||||||
|
|
||||||
def add(self, lockstring, log_obj=None):
|
def add(self, lockstring, log_obj=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -496,7 +496,8 @@ class ObjectDB(TypedObject):
|
||||||
#@property
|
#@property
|
||||||
def __is_superuser_get(self):
|
def __is_superuser_get(self):
|
||||||
"Check if user has a player, and if so, if it is a superuser."
|
"Check if user has a player, and if so, if it is a superuser."
|
||||||
return any(_GA(self, "sessions")) and _GA(_GA(self, "db_player"), "is_superuser")
|
return (_GA(self, "db_player") and _GA(_GA(self, "db_player"), "is_superuser")
|
||||||
|
and _GA(self, "get_attribute")("_superuser_character"))
|
||||||
is_superuser = property(__is_superuser_get)
|
is_superuser = property(__is_superuser_get)
|
||||||
|
|
||||||
# contents
|
# contents
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue