Merge pull request #19099 from resilient-tech/check-doctype

fix: ensure correct parenttype when retrieving roles
This commit is contained in:
Sagar Vora 2022-12-04 19:29:09 +00:00 committed by GitHub
commit 41c8a808d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -427,7 +427,9 @@ def get_roles(user=None, with_standard=True):
table = DocType("Has Role")
roles = (
frappe.qb.from_(table)
.where((table.parent == user) & (table.role.notin(["All", "Guest"])))
.where(
(table.parenttype == "User") & (table.parent == user) & (table.role.notin(["All", "Guest"]))
)
.select(table.role)
.run(pluck=True)
)