From a8603975a11d564d78ff0e019d76f82ecaf1b9cc Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 1 Oct 2017 16:51:41 +0200 Subject: [PATCH] Merge back fixes into master --- evennia/commands/default/account.py | 2 +- evennia/commands/default/general.py | 2 +- evennia/objects/objects.py | 11 ++++++++--- evennia/typeclasses/models.py | 4 ++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/evennia/commands/default/account.py b/evennia/commands/default/account.py index 01b7066fe3..e45e2a9347 100644 --- a/evennia/commands/default/account.py +++ b/evennia/commands/default/account.py @@ -824,7 +824,7 @@ class CmdQuell(COMMAND_DEFAULT_CLASS): """Perform the command""" account = self.account permstr = account.is_superuser and " (superuser)" or "(%s)" % (", ".join(account.permissions.all())) - if self.cmdstring == '@unquell': + if self.cmdstring in ('unquell', '@unquell'): if not account.attributes.get('_quell'): self.msg("Already using normal Account permissions %s." % permstr) else: diff --git a/evennia/commands/default/general.py b/evennia/commands/default/general.py index c5075b8744..6a30e3813c 100644 --- a/evennia/commands/default/general.py +++ b/evennia/commands/default/general.py @@ -67,7 +67,7 @@ class CmdLook(COMMAND_DEFAULT_CLASS): caller.msg("You have no location to look at!") return else: - target = caller.search(self.args, use_dbref=caller.check_permstring("Builders")) + target = caller.search(self.args) if not target: return self.msg(caller.at_look(target)) diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index 4479da8af7..f9b9510670 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -292,7 +292,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): candidates=None, nofound_string=None, multimatch_string=None, - use_dbref=True): + use_dbref=None): """ Returns an Object matching a search string/condition @@ -343,8 +343,9 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): caller's contents (inventory). nofound_string (str): optional custom string for not-found error message. multimatch_string (str): optional custom string for multimatch error header. - use_dbref (bool, optional): if False, treat a given #dbref strings as a - normal string rather than database ids. + use_dbref (bool or None, optional): if True/False, active/deactivate the use of + #dbref as valid global search arguments. If None, check against a permission + ('Builder' by default). Returns: match (Object, None or list): will return an Object/None if `quiet=False`, @@ -360,6 +361,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): """ is_string = isinstance(searchdata, basestring) + if is_string: # searchdata is a string; wrap some common self-references if searchdata.lower() in ("here", ): @@ -367,6 +369,9 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): if searchdata.lower() in ("me", "self",): return [self] if quiet else self + if use_dbref is None: + use_dbref = self.locks.check_lockstring(self, "_dummy:perm(Builder)") + if use_nicks: # do nick-replacement on search searchdata = self.nicks.nickreplace(searchdata, categories=("object", "account"), include_account=True) diff --git a/evennia/typeclasses/models.py b/evennia/typeclasses/models.py index 8a20ba9148..c156aa2ac6 100644 --- a/evennia/typeclasses/models.py +++ b/evennia/typeclasses/models.py @@ -575,6 +575,10 @@ class TypedObject(SharedMemoryModel): ppos = _PERMISSION_HIERARCHY.index(perm) return any(True for hpos, hperm in enumerate(_PERMISSION_HIERARCHY) if hperm in perms and hpos > ppos) + # we ignore pluralization (english only) + if perm.endswith("s"): + return self.check_permstring(perm[:-1]) + return False #