• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/lib/helper/messageaccess.php
  • Класс: BitrixMailHelperMessageAccess
  • Вызов: MessageAccess::checkAccessForCalendarEvent
static function checkAccessForCalendarEvent(int $calendarEventId, int $userId): bool
{
	if (MainLoader::includeModule('calendar'))
	{
		$attendeeIds = [];
		$entry = CCalendarEvent::getEventForViewInterface($calendarEventId);

		if ($entry && isset($entry['ATTENDEE_LIST']))
		{
			foreach($entry['ATTENDEE_LIST'] as $attendee)
			{
				$attendeeId = (int)$attendee['id'];
				if ($attendeeId > 0)
				{
					$attendeeIds[] = $attendeeId;
				}
			}
		}

		if (in_array($userId, $attendeeIds, true))
		{
			return true;
		}
	}

	return false;
}