fix: Conditionally show extra info for perm error (#21660)

This commit is contained in:
Ankush Menat 2023-07-12 22:22:34 +05:30 committed by GitHub
parent 154a6dd9ed
commit 14798146c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,10 +93,10 @@ def has_permission(
doc = frappe.get_doc(meta.name, doc)
perm = get_doc_permissions(doc, user=user, ptype=ptype).get(ptype)
if not perm:
push_perm_check_log(
_("User {0} does not have access to this document").format(frappe.bold(user))
+ f": {_(doc.doctype)} - {doc.name}"
)
msg = _("User {0} does not have access to this document").format(frappe.bold(user))
if frappe.has_permission(doc.doctype):
msg += f": {_(doc.doctype)} - {doc.name}"
push_perm_check_log(msg)
else:
if ptype == "submit" and not cint(meta.is_submittable):
push_perm_check_log(_("Document Type is not submittable"))