fix: Show background jobs only to permitted users

This commit is contained in:
Suraj Shetty 2023-04-17 12:03:43 +05:30
parent 52d284ff0f
commit cdb943d49a
2 changed files with 6 additions and 6 deletions

View file

@ -34,9 +34,7 @@ $.extend(frappe.perm, {
doctype_perm: {},
has_perm: (doctype, permlevel, ptype, doc) => {
if (!permlevel) permlevel = 0;
has_perm: (doctype, permlevel = 0, ptype = "read", doc) => {
const perms = frappe.perm.get_perm(doctype, doc);
return !!perms?.[permlevel]?.[ptype];
},

View file

@ -137,9 +137,11 @@ frappe.ui.toolbar.Toolbar = class {
__("Generate Tracking URL")
);
frappe.search.utils.make_function_searchable(function () {
frappe.set_route("List", "RQ Job");
}, __("Background Jobs"));
if (frappe.perm.has_perm("RQ Job")) {
frappe.search.utils.make_function_searchable(function () {
frappe.set_route("List", "RQ Job");
}, __("Background Jobs"));
}
}
}