Merge pull request #23031 from ankush/perm_search
fix: enforce perms on global search
This commit is contained in:
commit
2375f2ee05
1 changed files with 4 additions and 2 deletions
|
|
@ -446,7 +446,9 @@ def search(text, start=0, limit=20, doctype=""):
|
|||
results = []
|
||||
sorted_results = []
|
||||
|
||||
allowed_doctypes = get_doctypes_for_global_search()
|
||||
allowed_doctypes = set(get_doctypes_for_global_search()) & set(frappe.get_user().get_can_read())
|
||||
if not allowed_doctypes or (doctype and doctype not in allowed_doctypes):
|
||||
return []
|
||||
|
||||
for word in set(text.split("&")):
|
||||
word = word.strip()
|
||||
|
|
@ -464,7 +466,7 @@ def search(text, start=0, limit=20, doctype=""):
|
|||
|
||||
if doctype:
|
||||
query = query.where(global_search.doctype == doctype)
|
||||
elif allowed_doctypes:
|
||||
else:
|
||||
query = query.where(global_search.doctype.isin(allowed_doctypes))
|
||||
|
||||
if cint(start) > 0:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue