Check if account exists before accessing
This commit is contained in:
parent
14501db8de
commit
c3697b44e8
2 changed files with 9 additions and 5 deletions
|
|
@ -1484,7 +1484,7 @@ class CmdName(ObjManipCommand):
|
||||||
obj = None
|
obj = None
|
||||||
if self.lhs_objs:
|
if self.lhs_objs:
|
||||||
objname = self.lhs_objs[0]["name"]
|
objname = self.lhs_objs[0]["name"]
|
||||||
if objname.startswith("*"):
|
if objname.startswith("*") and caller.account:
|
||||||
# account mode
|
# account mode
|
||||||
obj = caller.account.search(objname.lstrip("*"))
|
obj = caller.account.search(objname.lstrip("*"))
|
||||||
if obj:
|
if obj:
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,8 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
||||||
if "clearall" in switches:
|
if "clearall" in switches:
|
||||||
caller.nicks.clear()
|
caller.nicks.clear()
|
||||||
caller.account.nicks.clear()
|
if caller.account:
|
||||||
|
caller.account.nicks.clear()
|
||||||
caller.msg("Cleared all nicks.")
|
caller.msg("Cleared all nicks.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -789,15 +790,18 @@ class CmdAccess(COMMAND_DEFAULT_CLASS):
|
||||||
hierarchy_full = settings.PERMISSION_HIERARCHY
|
hierarchy_full = settings.PERMISSION_HIERARCHY
|
||||||
string = "\n|wPermission Hierarchy|n (climbing):\n %s" % ", ".join(hierarchy_full)
|
string = "\n|wPermission Hierarchy|n (climbing):\n %s" % ", ".join(hierarchy_full)
|
||||||
|
|
||||||
if self.caller.account.is_superuser:
|
if caller.account and caller.account.is_superuser:
|
||||||
cperms = "<Superuser>"
|
cperms = "<Superuser>"
|
||||||
pperms = "<Superuser>"
|
pperms = "<Superuser>"
|
||||||
else:
|
else:
|
||||||
cperms = ", ".join(caller.permissions.all())
|
cperms = ", ".join(caller.permissions.all())
|
||||||
pperms = ", ".join(caller.account.permissions.all())
|
if caller.account:
|
||||||
|
pperms = ", ".join(caller.account.permissions.all())
|
||||||
|
else:
|
||||||
|
pperms = "<No account>"
|
||||||
|
|
||||||
string += "\n|wYour access|n:"
|
string += "\n|wYour access|n:"
|
||||||
string += f"\nCharacter |c{caller.key}|n: {cperms}"
|
string += f"\nCharacter |c{caller.key}|n: {cperms}"
|
||||||
if utils.inherits_from(caller, DefaultObject):
|
if utils.inherits_from(caller, DefaultObject) and caller.account:
|
||||||
string += f"\nAccount |c{caller.account.key}|n: {pperms}"
|
string += f"\nAccount |c{caller.account.key}|n: {pperms}"
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue