Skip to content

Commit

Permalink
fix: cannot access tabSingles when permissions enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Dec 13, 2024
1 parent 02453f2 commit 0d34cd2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions insights/insights/doctype/insights_table_v3/insights_table_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ def apply_user_permissions(t, data_source, table_name):
):
return t

if table_name == "tabSingles":
single_doctypes = frappe.get_all(
"DocType", filters={"issingle": 1}, pluck="name"
)
allowed_doctypes = get_valid_perms()
allowed_doctypes = [p.parent for p in allowed_doctypes if p.read]
allowed_single_doctypes = set(single_doctypes) & set(allowed_doctypes)
if len(allowed_single_doctypes) == len(single_doctypes):
return t
return t.filter(t.doctype.isin(allowed_single_doctypes))

doctype = table_name.replace("tab", "")
allowed_docs = get_allowed_documents(doctype)

Expand Down

0 comments on commit 0d34cd2

Please sign in to comment.