fix: dont accept filters in role_query (#31408)

This commit is contained in:
Sagar Vora 2025-03-05 06:43:07 +05:30 committed by GitHub
parent 5c5978f33a
commit 387dcebde1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View file

@ -36,7 +36,6 @@ frappe.ui.form.on("DocType", {
if (doc.custom && frappe.session.user != "Administrator") {
return {
query: "frappe.core.doctype.role.role.role_query",
filters: [["Role", "name", "!=", "All"]],
};
}
});

View file

@ -121,10 +121,14 @@ def get_users(role):
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def role_query(doctype, txt, searchfield, start, page_len, filters):
report_filters = [["Role", "name", "like", f"%{txt}%"], ["Role", "is_custom", "=", 0]]
if filters and isinstance(filters, list):
report_filters.extend(filters)
return frappe.get_all(
"Role", limit_start=start, limit_page_length=page_len, filters=report_filters, as_list=1
"Role",
limit_start=start,
limit_page_length=page_len,
filters=[
["Role", "name", "like", f"%{txt}%"],
["Role", "is_custom", "=", 0],
["Role", "name", "!=", "All"],
],
as_list=True,
)