Pārlūkot izejas kodu

fix: check permlevel only if > 0

(cherry picked from commit 4c4d9ac60e)
version-14
Sagar Vora pirms 2 gadiem
committed by Mergify
vecāks
revīzija
63f2cf51d5
1 mainītis faili ar 10 papildinājumiem un 12 dzēšanām
  1. +10
    -12
      frappe/permissions.py

+ 10
- 12
frappe/permissions.py Parādīt failu

@@ -675,15 +675,15 @@ def has_child_table_permission(
raise_exception=True,
parent_doctype=None,
):
if child_doc:
if isinstance(child_doc, str):
child_doc = frappe.db.get_value(
child_doctype,
child_doc,
("parent", "parenttype", "parentfield"),
as_dict=True,
)
if isinstance(child_doc, str):
child_doc = frappe.db.get_value(
child_doctype,
child_doc,
("parent", "parenttype", "parentfield"),
as_dict=True,
)

if child_doc:
parent_doctype = child_doc.parenttype

if not parent_doctype:
@@ -707,10 +707,8 @@ def has_child_table_permission(
if (
child_doc
and child_doc.parentfield
and (
parent_meta.get_field(child_doc.parentfield).permlevel
not in parent_meta.get_permlevel_access(ptype)
)
and (permlevel := parent_meta.get_field(child_doc.parentfield).permlevel) > 0
and permlevel not in parent_meta.get_permlevel_access(ptype)
):
push_perm_check_log(
_("Insufficient Permission Level for {0}").format(frappe.bold(parent_doctype))


Notiek ielāde…
Atcelt
Saglabāt