Insufficient permission for System Manager

I am the system manager. I am not able to access an event created by an employee and allocated to another employee.

I get this error:

I can access the TODO and assignment for event doctype.
(allocated to is not my email address)

What might be causing this ?

Yes I am also getting problems in this.

We are also including all necessary employees in the event participants list but still they are not able to access the event.

Did anyone find any solution of access permission of events?

The reason is the permission filter implemented in get_permission_query_conditions() in the Event doctype (‘frappe/desk/doctype/event/event.py‘).

Current logic restricts visible events to:

  • Events with event_type = 'Public'

  • Events where the user is the owner

  • Events where the user is listed in Event Participants

Suggested Improvement

Allow System Manager to bypass this restriction.

Example modification:

def get_permission_query_conditions(user):
	if not user:
		user = frappe.session.user

	# Allow System Manager to view all events
	if "System Manager" in frappe.get_roles(user):
		return None

	query = f"""(`tabEvent`.`event_type`='Public' or `tabEvent`.`owner`={frappe.db.escape(user)})"""

	query += f""" or exists (
		select 'x'
		from `tabEvent Participants` ep
		where ep.parent=`tabEvent`.name
		and ep.email={frappe.db.escape(user)}
	)"""

	return query

Returning None removes the additional filter, allowing System Manager to see all records as expected for an administrative role.

1 Like