Some calendar APIs allow us to pass a list of userids to retrieve events (e.g. calendar_get_legacy_events) but, internally, calendar local APIs make direct use of $USER to calculate priorities, events overrides and event types restrictions, examples of this are:
- Core *_is_event_visible implementations in core (both assign and feedback modules) contain uses of $USER and methods calls that internally rely on $USER
- get_raw_events_legacy_implementation, totally coupled to $USER and overriding its $courses argument
- external functions APIs do not have $user argument
- some new calendar local APIs do not have $user either (some of them have, although it may not be used because of other code restrictions)
Would be nice to fix public interfaces (that is why I'm flagging this as a bug) and also to keep internal vs external consistency by adding $user arguments everywhere. This would be really helpful for analytics as we would have another way to detect activities that required action. Most of the changes these points would require would fix #1 point above. This issue is related to
MDL-58768 (#2 point above)
Calendar api docs page (https://docs.moodle.org/dev/Calendar_API#calendar_get_legacy_events.28.29) includes references to calendar_get_legacy_events, which $users filter does not work properly as $USER is used internally. I am adding a note there about it.