mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge pull request #2929 from audiodude/funcparser-search-check
Fix access control check in $search() function
This commit is contained in:
commit
ea877bb13e
2 changed files with 3 additions and 1 deletions
|
|
@ -1162,7 +1162,7 @@ def funcparser_callable_search(*args, caller=None, access="control", **kwargs):
|
|||
)
|
||||
|
||||
for target in targets:
|
||||
if not target.access(caller, target, access):
|
||||
if not target.access(caller, access):
|
||||
raise ParsingError("$search Cannot add found entity - access failure.")
|
||||
|
||||
return list(targets) if return_list else targets[0]
|
||||
|
|
|
|||
|
|
@ -528,6 +528,7 @@ class TestCallableSearch(test_resources.BaseEvenniaTest):
|
|||
"""
|
||||
string = "$search(TestAccount, type=account)"
|
||||
expected = self.account
|
||||
self.account.locks.add("control:id(%s)" % self.char1.dbref)
|
||||
|
||||
ret = self.parser.parse(string, caller=self.char1, return_str=False, raise_errors=True)
|
||||
self.assertEqual(expected, ret)
|
||||
|
|
@ -539,6 +540,7 @@ class TestCallableSearch(test_resources.BaseEvenniaTest):
|
|||
"""
|
||||
string = "$search(Script, type=script)"
|
||||
expected = self.script
|
||||
self.script.locks.add("control:id(%s)" % self.char1.dbref)
|
||||
|
||||
ret = self.parser.parse(string, caller=self.char1, return_str=False, raise_errors=True)
|
||||
self.assertEqual(expected, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue