mirror of
https://github.com/evennia/evennia.git
synced 2026-03-21 15:26:30 +01:00
Adjusted checks for Object/Account to prevent conflicts.
This commit is contained in:
parent
b4a3bae6a9
commit
30bfc36beb
9 changed files with 12 additions and 14 deletions
|
|
@ -2739,7 +2739,7 @@ class CmdExamine(ObjManipCommand):
|
|||
all_cmdsets = [(cmdset.key, cmdset) for cmdset in current_cmdset.merged_from]
|
||||
# we always at least try to add account- and session sets since these are ignored
|
||||
# if we merge on the object level.
|
||||
if hasattr(obj, "account") and obj.account:
|
||||
if hasattr(obj, "has_account") and obj.account:
|
||||
# get Attribute-cmdsets if they exist
|
||||
all_cmdsets.extend([(cmdset.key, cmdset) for cmdset in obj.account.cmdset.all()])
|
||||
if obj.sessions.count():
|
||||
|
|
|
|||
|
|
@ -723,6 +723,6 @@ class CmdAccess(COMMAND_DEFAULT_CLASS):
|
|||
|
||||
string += "\n|wYour access|n:"
|
||||
string += f"\nCharacter |c{caller.key}|n: {cperms}"
|
||||
if hasattr(caller, "account"):
|
||||
if hasattr(caller, "has_account"):
|
||||
string += f"\nAccount |c{caller.account.key}|n: {pperms}"
|
||||
caller.msg(string)
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ class DefaultChannel(ChannelDB, metaclass=TypeclassBase):
|
|||
|
||||
"""
|
||||
has_sub = self.subscriptions.has(subscriber)
|
||||
if not has_sub and hasattr(subscriber, "account"):
|
||||
if not has_sub and hasattr(subscriber, "has_account"):
|
||||
# it's common to send an Object when we
|
||||
# by default only allow Accounts to subscribe.
|
||||
has_sub = self.subscriptions.has(subscriber.account)
|
||||
|
|
|
|||
|
|
@ -646,8 +646,6 @@ class SubscriptionHandler:
|
|||
from django.core.exceptions import ObjectDoesNotExist
|
||||
|
||||
try:
|
||||
if hasattr(obj, "account") and obj.account:
|
||||
obj = obj.account
|
||||
if not obj.is_connected:
|
||||
continue
|
||||
except ObjectDoesNotExist:
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@ def is_ooc(accessing_obj, accessed_obj, *args, **kwargs):
|
|||
function will still return True.
|
||||
"""
|
||||
obj = accessed_obj.obj if hasattr(accessed_obj, "obj") else accessed_obj
|
||||
account = obj.account if hasattr(obj, "account") else obj
|
||||
account = obj.account if hasattr(obj, "has_account") else obj
|
||||
if not account:
|
||||
return True
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -553,7 +553,7 @@ class LockHandler:
|
|||
if not no_superuser_bypass and (
|
||||
(hasattr(accessing_obj, "is_superuser") and accessing_obj.is_superuser)
|
||||
or (
|
||||
hasattr(accessing_obj, "account")
|
||||
hasattr(accessing_obj, "has_account")
|
||||
and hasattr(accessing_obj.account, "is_superuser")
|
||||
and accessing_obj.account.is_superuser
|
||||
)
|
||||
|
|
@ -627,7 +627,7 @@ class LockHandler:
|
|||
if no_superuser_bypass and (
|
||||
(hasattr(accessing_obj, "is_superuser") and accessing_obj.is_superuser)
|
||||
or (
|
||||
hasattr(accessing_obj, "account")
|
||||
hasattr(accessing_obj, "has_account")
|
||||
and hasattr(accessing_obj.account, "is_superuser")
|
||||
and accessing_obj.account.is_superuser
|
||||
)
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ class TypedObject(SharedMemoryModel):
|
|||
result (bool): If the permstring is passed or not.
|
||||
|
||||
"""
|
||||
if hasattr(self, "account"):
|
||||
if hasattr(self, "has_account"):
|
||||
if (
|
||||
self.account
|
||||
and self.account.is_superuser
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ class CmdEvMenuNode(Command):
|
|||
if _restore(caller):
|
||||
return
|
||||
orig_caller = caller
|
||||
caller = caller.account if hasattr(caller, "account") else None
|
||||
caller = caller.account if hasattr(caller, "has_account") else None
|
||||
menu = caller.ndb._evmenu if caller else None
|
||||
if not menu:
|
||||
if caller and _restore(caller):
|
||||
|
|
@ -1497,7 +1497,7 @@ class CmdGetInput(Command):
|
|||
caller = self.caller
|
||||
try:
|
||||
getinput = caller.ndb._getinput
|
||||
if not getinput and hasattr(caller, "account"):
|
||||
if not getinput and (hasattr(caller, "has_account")):
|
||||
getinput = caller.account.ndb._getinput
|
||||
if getinput:
|
||||
caller = caller.account
|
||||
|
|
@ -1618,7 +1618,7 @@ class CmdYesNoQuestion(Command):
|
|||
|
||||
def _clean(self, caller):
|
||||
del caller.ndb._yes_no_question
|
||||
if not caller.cmdset.has(YesNoQuestionCmdSet) and hasattr(caller, "account"):
|
||||
if not caller.cmdset.has(YesNoQuestionCmdSet) and hasattr(caller, "has_account"):
|
||||
caller.account.cmdset.remove(YesNoQuestionCmdSet)
|
||||
else:
|
||||
caller.cmdset.remove(YesNoQuestionCmdSet)
|
||||
|
|
@ -1628,7 +1628,7 @@ class CmdYesNoQuestion(Command):
|
|||
caller = self.caller
|
||||
try:
|
||||
yes_no_question = caller.ndb._yes_no_question
|
||||
if not yes_no_question and hasattr(caller, "account"):
|
||||
if not yes_no_question and hasattr(caller, "has_account"):
|
||||
yes_no_question = caller.account.ndb._yes_no_question
|
||||
caller = caller.account
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class CmdMore(Command):
|
|||
Implement the command
|
||||
"""
|
||||
more = self.caller.ndb._more
|
||||
if not more and hasattr(self.caller, "account"):
|
||||
if not more and hasattr(self.caller, "has_account"):
|
||||
more = self.caller.account.ndb._more
|
||||
if not more:
|
||||
self.caller.msg("Error in loading the pager. Contact an admin.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue