def testRightsFiltering(self): ''' Test if the managing rights are respected. ''' manager = self._conf.getCSBookingManager() # Test that person3 has not access to webcasted talks requestType = CollaborationTools.getRequestTypeUserCanManage( self._conf, self.person3) contributions = manager.getContributionSpeakerByType(requestType) for cont in contributions: for spk in contributions[cont]: sw = manager.getSpeakerWrapperByUniqueId("%s.%s" % (cont, spk.getId())) self.assert_(sw.getRequestType() == "recording" or sw.getRequestType() == "both") # Test that person4 has not access to recorded talks requestType = CollaborationTools.getRequestTypeUserCanManage( self._conf, self.person4) contributions = manager.getContributionSpeakerByType(requestType) for cont in contributions: for spk in contributions[cont]: sw = manager.getSpeakerWrapperByUniqueId("%s.%s" % (cont, spk.getId())) self.assert_(sw.getRequestType() == "webcast" or sw.getRequestType() == "both")
def export_eAgreements(self, aw): manager = self._conf.getCSBookingManager() requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, aw.getUser()) contributions = manager.getContributionSpeakerByType(requestType) for cont, speakers in contributions.items(): for spk in speakers: sw = manager.getSpeakerWrapperByUniqueId('%s.%s' % (cont, spk.getId())) if not sw: continue signed = None if sw.getStatus() in (SpeakerStatusEnum.FROMFILE, SpeakerStatusEnum.SIGNED): signed = True elif sw.getStatus() == SpeakerStatusEnum.REFUSED: signed = False yield { 'confId': sw.getConference().getId(), 'contrib': cont, 'type': sw.getRequestType(), 'status': sw.getStatus(), 'signed': signed, 'speaker': { 'id': spk.getId(), 'name': spk.getFullName(), 'email': spk.getEmail() } }
def getPaperAgreementURL(self): recordingFormURL = CollaborationTools.getOptionValue( "RecordingRequest", "ConsentFormURL") webcastFormURL = CollaborationTools.getOptionValue( "WebcastRequest", "ConsentFormURL") requestType = CollaborationTools.getRequestTypeUserCanManage( self._conf, self._user) #return recordingFormURL if requestType == 'recording' and recordingFormURL != '': return _("""<a href="%s">Paper version</a>.""" % recordingFormURL) elif requestType == 'webcast' and webcastFormURL != '': return _("""<a href="%s">Paper version</a>.""" % webcastFormURL) elif requestType == 'both': if recordingFormURL == webcastFormURL and recordingFormURL != '': #same link, same file return _("""<a href="%s">Paper version</a>.""" % recordingFormURL) elif recordingFormURL != '' and webcastFormURL != '': return _( """<a href="%s">Paper version</a> for the recording request or <a href="%s">Paper version</a> for the webcast request.""" % (recordingFormURL, webcastFormURL)) elif recordingFormURL != '': return _("""<a href="%s">Paper version</a>.""" % recordingFormURL) elif webcastFormURL != '': return _("""<a href="%s">Paper version</a>.""" % webcastFormURL) else: return _("""<No agreement link available>.""") else: return _("""<No agreement link available>.""")
def getTableContent(self): manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId()) # Here we check the rights again, and chose what contributions we should show requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, self._user) self._fromList = [{"name": self._user.getStraightFullName() , "email": email} for email in self._user.getEmails()] contributions = manager.getContributionSpeakerByType(requestType) return self.getListSorted(contributions)
def getTableContent(self): manager = self._conf.getCSBookingManager() # Here we check the rights again, and chose what contributions we should show requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, self._user) self._fromList = self._user.getEmails() contributions = manager.getContributionSpeakerByType(requestType) return self.getListSorted(contributions)
def getTableContent(self): manager = self._conf.getCSBookingManager() # Here we check the rights again, and chose what contributions we should show requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, self._user) self._fromList = [{"name": self._user.getStraightFullName() , "email": email} for email in self._user.getEmails()] contributions = manager.getContributionSpeakerByType(requestType) return self.getListSorted(contributions)
def testRightsFiltering(self): ''' Test if the managing rights are respected. ''' manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId()) # Test that person3 has not access to webcasted talks requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, self.person3) contributions = manager.getContributionSpeakerByType(requestType) for cont in contributions: for spk in contributions[cont]: sw = manager.getSpeakerWrapperByUniqueId("%s.%s"%(cont, spk.getId())) self.assert_(sw.getRequestType() == "recording" or sw.getRequestType() == "both") # Test that person4 has not access to recorded talks requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, self.person4) contributions = manager.getContributionSpeakerByType(requestType) for cont in contributions: for spk in contributions[cont]: sw = manager.getSpeakerWrapperByUniqueId("%s.%s"%(cont, spk.getId())) self.assert_(sw.getRequestType() == "webcast" or sw.getRequestType() == "both")
def export_eAgreements(self, aw): manager = self._conf.getCSBookingManager() requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, aw.getUser()) contributions = manager.getContributionSpeakerByType(requestType) for cont, speakers in contributions.items(): for spk in speakers: sw = manager.getSpeakerWrapperByUniqueId("%s.%s" % (cont, spk.getId())) if not sw: continue signed = None if sw.getStatus() in (SpeakerStatusEnum.FROMFILE, SpeakerStatusEnum.SIGNED): signed = True elif sw.getStatus() == SpeakerStatusEnum.REFUSED: signed = False yield { "confId": sw.getConference().getId(), "contrib": cont, "type": sw.getRequestType(), "status": sw.getStatus(), "signed": signed, "speaker": {"id": spk.getId(), "name": spk.getFullName(), "email": spk.getEmail()}, }
def getPaperAgreementURL(self): recordingFormURL = CollaborationTools.getOptionValue("RecordingRequest", "ConsentFormURL") webcastFormURL = CollaborationTools.getOptionValue("WebcastRequest", "ConsentFormURL") requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, self._user) #return recordingFormURL if requestType == 'recording' and recordingFormURL != '': return _("""<a href="%s">Paper version</a>."""%recordingFormURL) elif requestType == 'webcast' and webcastFormURL != '': return _("""<a href="%s">Paper version</a>."""%webcastFormURL) elif requestType == 'both': if recordingFormURL == webcastFormURL and recordingFormURL != '': #same link, same file return _("""<a href="%s">Paper version</a>."""%recordingFormURL) elif recordingFormURL != '' and webcastFormURL != '': return _("""<a href="%s">Paper version</a> for the recording request or <a href="%s">Paper version</a> for the webcast request."""%(recordingFormURL, webcastFormURL)) elif recordingFormURL != '': return _("""<a href="%s">Paper version</a>."""%recordingFormURL) elif webcastFormURL != '': return _("""<a href="%s">Paper version</a>."""%webcastFormURL) else: return _("""<No agreement link available>.""") else: return _("""<No agreement link available>.""")