Inconsistent Custom Role behavior between Page and Report permissions

Frappe uses two different implementation on how it reads the Custom Role DocType for the Page and the Report. As for the Page, it extends the roles in the Custom Role Document with the Roles in the Page itself, while the roles in the Custom Role Document overrides the roles for the report. Is that intentional?

report.py ( frappe/frappe/core/doctype/report/report.py at develop · frappe/frappe · GitHub ):

def is_permitted(self):
	"""Return True if `Has Role` is not set or the user is allowed."""
	from frappe.utils import has_common

	allowed = [d.role for d in frappe.get_all("Has Role", fields=["role"], filters={"parent": self.name})]

	custom_roles = get_custom_allowed_roles("report", self.name)
	if custom_roles:
		allowed = custom_roles

	if not allowed:
		return True

	if has_common(frappe.get_roles(), allowed):
		return True

In page.py ( frappe/frappe/core/doctype/page/page.py at 5a94ce857600ef1fef23774601a0cfd442837735 · frappe/frappe · GitHub ):

def is_permitted(self):
“”“Return True if Has Role is not set or the user is allowed.”“”
from frappe.utils import has_common

allowed = [d.role for d in frappe.get_all("Has Role", fields=["role"], filters={"parent": self.name})]

custom_roles = get_custom_allowed_roles("page", self.name)
allowed.extend(custom_roles)

if not allowed:
	return True

roles = frappe.get_roles()

if has_common(roles, allowed):
	return True ``