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:
Griatch 2013-05-14 13:55:03 +02:00
parent 7a8e53b3bd
commit 77a0b47859
3 changed files with 11 additions and 8 deletions

View file

@ -1547,6 +1547,7 @@ class CmdExamine(ObjManipCommand):
else:
if self.player_mode:
db_attr = [(attr.key, attr.value) for attr in PlayerAttribute.objects.filter(db_obj=obj)]
print "player mode:", db_attr
else:
db_attr = [(attr.key, attr.value) for attr in ObjAttribute.objects.filter(db_obj=obj)]
try:
@ -1683,10 +1684,14 @@ class CmdExamine(ObjManipCommand):
obj_name = objdef['name']
obj_attrs = objdef['attrs']
self.player_mode = "player" in self.switches or obj_name.startswith('*')
self.player_mode = utils.inherits_from(caller, "src.players.player.Player") or \
"player" in self.switches or obj_name.startswith('*')
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:
obj = caller.search(obj_name)
if not obj:

View file

@ -260,10 +260,7 @@ class LockHandler(object):
before the login process has yet been fully finalized)
"""
#print "_superuser_character:", hasattr(obj, "get_attribute") and obj.get_attribute("_superuser_character")
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)))))
self.lock_bypass = hasattr(obj, "is_superuser") and obj.is_superuser
def add(self, lockstring, log_obj=None):
"""

View file

@ -496,7 +496,8 @@ class ObjectDB(TypedObject):
#@property
def __is_superuser_get(self):
"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)
# contents