def iter_people(cls, event): req = Request.find_latest_for_event(event, AVRequest.name) if not req or req.state != RequestState.accepted or 'recording' not in req.data[ 'services']: return if event.type == 'lecture': for link in event.person_links: yield SpeakerPersonInfo(link.full_name, link.email or None, data={ 'type': 'lecture_speaker', 'id': link.id, 'person_id': link.person_id }) else: contribs = [x[0] for x in get_selected_contributions(req)] for contrib in contribs: for link in contrib.person_links: if not link.is_speaker: continue yield SpeakerPersonInfo(link.full_name, link.email or None, data={ 'type': 'contribution', 'contribution': contribution_id(contrib), 'id': link.id, 'person_id': link.person_id })
def _process_args(self): RHManageEventBase._process_args(self) try: self.definition = get_request_definitions()[request.view_args['type']] except KeyError: raise NotFound self.request = Request.find_latest_for_event(self.event, self.definition.name) if self._require_request and not self.request: raise NotFound
def _checkParams(self, params): RHConferenceModifBase._checkParams(self, params) try: self.definition = get_request_definitions()[request.view_args['type']] except KeyError: raise NotFound self.request = Request.find_latest_for_event(self.event_new, self.definition.name) if self._require_request and not self.request: raise NotFound
def _on_event_update(self, event, **kwargs): changes = kwargs['changes'] if not changes.viewkeys() & {'location_data', 'start_dt', 'end_dt'}: return request = Request.find_latest_for_event(event, RoomAssistanceRequest.name) if not request or request.state != RequestState.accepted: return if 'location_data' in changes and not event_has_room_with_support_attached( event): request.definition.reject( request, { 'comment': render_plugin_template('auto_reject_no_supported_room.txt') }, User.get_system_user()) request.data = dict(request.data, occurrences=[]) flash( _("The new event location is not in the list of the rooms supported by the room assistance team. " "Room assistance request has been rejected and support will not be provided." ), 'warning') if changes.viewkeys() & {'start_dt', 'end_dt'}: tz = pytz.timezone(config.DEFAULT_TIMEZONE) occurrences = { dateutil.parser.parse(occ).astimezone(tz) for occ in request.data['occurrences'] } req_dates = {occ.date() for occ in occurrences} event_dates = set(event.iter_days()) old_dates = req_dates - event_dates has_overlapping_dates = req_dates & event_dates if not has_overlapping_dates: request.definition.reject( request, { 'comment': render_plugin_template( 'auto_reject_no_overlapping_dates.txt') }, User.get_system_user()) request.data = dict(request.data, occurrences=[]) flash( _("The new event dates don't overlap with the existing room assistance request for this event. " "Room assistance request has been rejected and support will not be provided." ), 'warning') elif old_dates and has_overlapping_dates: new_data = dict(request.data) new_data['occurrences'] = [ occ.astimezone(pytz.utc).isoformat() for occ in occurrences if occ.date() in req_dates & event_dates ] request.data = new_data flash( _("Room assistance had been requested for days that are not between the updated start/end " "dates. Support will not be provided on these days anymore." ), 'warning')
def _get_event_webcast_url(self, event): req = Request.find_latest_for_event(event, AVRequest.name) if not req or req.state != RequestState.accepted or 'webcast' not in req.data['services']: return None url = req.data.get('custom_webcast_url') or self.settings.get('webcast_url') try: return url.format(event_id=event.id) except Exception: self.logger.exception('Could not build webcast URL') return None
def _process(self): definitions = get_request_definitions() if not definitions: raise NotFound requests = Request.find_latest_for_event(self.event) if self.protection_overridden: definitions = {name: def_ for name, def_ in definitions.iteritems() if def_.can_be_managed(session.user)} requests = {name: req for name, req in requests.iteritems() if req.definition and req.definition.can_be_managed(session.user)} return WPRequestsEventManagement.render_template('events/requests/event_requests.html', self.event, definitions=definitions, requests=requests)
def _get_vc_assistance_request_link(self, event, **kwargs): from definition import VCAssistanceRequest req = Request.find_latest_for_event(event, VCAssistanceRequest.name) support_email = VCAssistanceRequestPlugin.settings.get('support_email') return render_plugin_template( 'vc_assistance_request_link.html', event=event, name=VCAssistanceRequest.name, request_accepted=req is not None and req.state == RequestState.accepted, has_capable_vc_room_attached=has_vc_rooms_attached_to_capable( event), support_email=support_email)
def _event_updated(self, event, changes, **kwargs): req = Request.find_latest_for_event(event, VCAssistanceRequest.name) if not req or req.state != RequestState.accepted: return if 'start_dt' in changes and not start_time_within_working_hours( event): flash( _("The new event start time is out of working hours so videoconference assistance cannot be " "provided."), 'warning') if 'location_data' in changes and not has_vc_rooms_attached_to_capable( event): flash( _("The new event location doesn't have videoconference capabilities so videoconference " "assistance cannot be provided."), 'warning')
def _register_event_change(self, event): req = Request.find_latest_for_event(event, AVRequest.name) if not req: return g.setdefault('av_request_changes', set()).add(req)
def get_last_request(event): """Return the last CERN Acess request for the event.""" from indico_cern_access.definition import CERNAccessRequestDefinition return Request.find_latest_for_event(event, CERNAccessRequestDefinition.name)