def _extend_top_menu(self, sender, **kwargs): if not session.user or not is_av_manager(session.user): return return TopMenuItem('services-cern-audiovisual', _('Webcast/Recording'), url_for_plugin('audiovisual.request_list'), section='services')
def _update_contribution_fields(self): if self.event.type == 'lecture': # lectures don't have contributions del self.all_contributions del self.contributions else: choices = self.contributions.choices = [] disabled_contribs = self.contributions._disabled_contributions = [] contributions = self.contributions._contributions = {} is_manager = is_av_manager(session.user) selected = set(self.request.data.get( 'contributions', [])) if self.request else set() for contrib, capable, custom_room in get_contributions(self.event): is_subcontrib = isinstance(contrib, SubContribution) id_ = contribution_id(contrib) contributions[id_] = contrib line = Markup( render_template('audiovisual:contribution_list_entry.html', contrib=contrib, is_subcontrib=is_subcontrib, capable=capable, custom_room=custom_room)) if not capable and not is_manager and contrib.id not in selected: disabled_contribs.append((contrib, line)) else: choices.append((id_, line))
def _apply_changes(self, sender, **kwargs): # we are using after_request to avoid spam in case someone changes many contribution times if 'av_request_changes' not in g: return for req in g.av_request_changes: identifiers = get_data_identifiers(req) if req.state == RequestState.accepted and identifiers['dates'][ 0] != req.data['identifiers']['dates'][0]: notify_rescheduled_request(req) if not compare_data_identifiers( identifiers['locations'], req.data['identifiers']['locations']): if (not count_capable_contributions(req.event)[0] and req.state in {RequestState.accepted, RequestState.pending} and not is_av_manager(req.created_by_user)): janitor = User.get_system_user() data = dict(req.data, comment=render_plugin_template( 'auto_reject_no_capable_contribs.txt')) req.definition.reject(req, data, janitor) elif req.state == RequestState.accepted: notify_relocated_request(req) req.data['identifiers'] = identifiers flag_modified(req, 'data')
def _can_access_event(self, sender, user, **kwargs): if user is not None and is_av_manager(user): return True
def can_be_managed(cls, user): return is_av_manager(user)
def can_access_api(cls, user, event): return super(SpeakerReleaseAgreement, cls).can_access_api( user, event) or is_av_manager(user)
def _check_access(self): RHProtected._check_access(self) if not is_av_manager(session.user): raise Forbidden
def can_access_api(cls, user, event): return super().can_access_api(user, event) or is_av_manager(user)