fix: Only apply perm query to non-admin users
This commit is contained in:
parent
57c991f055
commit
13162d8fbd
2 changed files with 2 additions and 5 deletions
|
|
@ -259,8 +259,8 @@ def _run_with_permission_query(query: "Query", doctype: str) -> list[dict]:
|
|||
Note: Works only if 'WHERE' is the last clause in the query
|
||||
"""
|
||||
permission_query = DatabaseQuery(doctype, frappe.session.user).get_permission_query_conditions()
|
||||
if permission_query:
|
||||
return frappe.db.sql(f"{query} AND {permission_query}", as_dict=True) # nosemgrep
|
||||
if permission_query and frappe.session.user != "Administrator":
|
||||
return frappe.db.sql(f"{query} AND {permission_query}", as_dict=True)
|
||||
return query.run(as_dict=True)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,3 @@ class TestBootData(FrappeTestCase):
|
|||
# Test user must not see admin user's report
|
||||
self.assertNotIn("Test Admin Report", allowed_reports)
|
||||
self.assertIn("Test User Report", allowed_reports)
|
||||
|
||||
self.addCleanup(frappe.db.rollback)
|
||||
self.addCleanup(frappe.set_user, "Administrator")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue