def _checkParams(self): pManager = ParameterManager(self._params) self._userMail = pManager.extract("userMail", pType=str, allowEmpty=True) self._code = pManager.extract("code", pType=str, allowEmpty=True) self._message = pManager.extract("message", pType=str, allowEmpty=True) self._inner = pManager.extract("inner", pType=str, allowEmpty=True) self._requestInfo = pManager.extract("requestInfo", pType=dict)
def _checkParams(self): CategoryControlUserListBase._checkParams(self) pm = ParameterManager(self._params) self._principals = [ principal_from_fossil(f, allow_pending=True) for f in pm.extract("userList", pType=list, allowEmpty=False) ] self._sendEmailManagers = pm.extract("sendEmailManagers", pType=bool, allowEmpty=True, defaultValue=True)
def _checkParams(self): """ Gets a reference to the material, using the id as the key, and gets the properties to change """ MaterialModifBase._checkParams(self) matId = self._params.get("materialId", None) self._newProperties = self._params.get("materialInfo", None) self._newUserList = self._newProperties['userList'] materialPM = ParameterManager(self._newProperties) self._title = materialPM.extract('title', pType=str, allowEmpty=True, defaultValue="NO TITLE ASSIGNED") self._description = materialPM.extract('description', pType=str, allowEmpty=True) self._protection = materialPM.extract('protection', pType=int) self._hidden = materialPM.extract('hidden', pType=int) self._accessKey = materialPM.extract('accessKey', pType=str, allowEmpty=True)
def _checkParams(self): ConferenceReviewingPRMBase._checkParams(self) self._dueDateToChange = self._params.get("dueDateToChange") pm = ParameterManager(self._params.get('value'), timezone=self._conf.getTimezone()) self._date = pm.extract('date', pType=datetime.datetime) self._apply = pm.extract('applyToContributions', pType=bool)
def _checkParams(self): AbstractReviewingBase._checkParams(self) pm = ParameterManager(self._params) self._trackId = pm.extract("track", pType=str, allowEmpty=False) self._reviewerId = pm.extract("userId", pType=str, allowEmpty=True, defaultValue=None) if (self._reviewerId == None): self._reviewerId = pm.extract("user", pType=str, allowEmpty=False)
def _checkParams_POST(self): defaultArrivalOffset = [-2, 0] defaultDepartureOffset = [1, 3] post_pm = ParameterManager(decode(request.data)) self._arrivalOffsetDates = post_pm.extract( 'arrivalOffsetDates', pType=list, allowEmpty=False, defaultValue=defaultArrivalOffset) self._departureOffsetDates = post_pm.extract( 'departureOffsetDates', pType=list, allowEmpty=False, defaultValue=defaultDepartureOffset) self._items = post_pm.extract('items', pType=list, allowEmpty=False) if (len(self._arrivalOffsetDates) != 2 or self._arrivalOffsetDates[0] == '' or self._arrivalOffsetDates[1] == ''): self._arrivalOffsetDates = defaultArrivalOffset if (len(self._departureOffsetDates) != 2 or self._departureOffsetDates[0] == '' or self._departureOffsetDates[1] == ''): self._departureOffsetDates = defaultDepartureOffset
def _checkParams(self): ConferenceChairPersonBase._checkParams(self) pm = ParameterManager(self._params) self._userData = pm.extract("userData", pType=dict, allowEmpty=False) self._chairId = pm.extract("userId", pType=str, allowEmpty=False) if self._userData.get("email", "") != "" and self._isEmailAlreadyUsed(): raise ServiceAccessError(_("The email address is already used by another chairperson. Chairperson not modified."))
def _checkParams(self): ConferenceListModificationBase._checkParams(self) pm = ParameterManager(self._params) self._selTypes = pm.extract("selTypes", pType=list, allowEmpty=True, defaultValue=[]) # ids of selected types self._selTracks = pm.extract("selTracks", pType=list, allowEmpty=True, defaultValue=[]) # ids of selected tracks self._selSessions = pm.extract( "selSessions", pType=list, allowEmpty=True, defaultValue=[]) # ids of selected sessions self._typeShowNoValue = self._params.get("typeShowNoValue", True) self._trackShowNoValue = self._params.get("trackShowNoValue", True) self._sessionShowNoValue = self._params.get("sessionShowNoValue", True) self._showWithoutTeam = self._params.get("showWithoutTeam", True) self._showWithReferee = self._params.get("showWithReferee", False) self._showWithEditor = self._params.get("showWithEditor", False) self._showWithReviewer = self._params.get("showWithReviewer", False) self._showWithMaterial = self._params.get("showWithMaterial", False) self._showWithoutMaterial = self._params.get("showWithoutMaterial", False)
def _checkParams(self): AbstractReviewingBase._checkParams(self) pm = ParameterManager(self._params) self._trackId = pm.extract("track", pType=str, allowEmpty=False) self._reviewerList = pm.extract("userList", pType=list, allowEmpty=False)
def _checkParams(self): ConferenceModifBase._checkParams(self) pm = ParameterManager(self._params) submitterId = pm.extract("submitterId", pType=str, allowEmpty=False) abstractId = pm.extract("abstractId", pType=str, allowEmpty=False) self._abstract = self._conf.getAbstractMgr().getAbstractById(abstractId) self._submitter = user.AvatarHolder().getById(submitterId)
def _checkParams(self): CollaborationBase._checkParams(self) pm = ParameterManager(self._params) self._bookingType = pm.extract("type", pType=str, allowEmpty=False) self._query = pm.extract("query", pType=str, allowEmpty=False) self._limit = pm.extract("limit", pType=int, allowEmpty=True, defaultValue=None) self._offset = pm.extract("offset", pType=int, allowEmpty=True, defaultValue=0)
def _checkParams(self): CategoryControlUserListBase._checkParams(self) pm = ParameterManager(self._params) self._userList = pm.extract("userList", pType=list, allowEmpty=False) self._sendEmailManagers = pm.extract("sendEmailManagers", pType=bool, allowEmpty=True, defaultValue=True)
def _checkParams(self): pManager = ParameterManager(self._params) self._userMail = pManager.extract("userMail", pType=str, allowEmpty=True) self._code = pManager.extract("code", pType=str, allowEmpty=True) self._message = pManager.extract("message", pType=str, allowEmpty=True) inner = self._params.get('inner', '') self._inner = '\n'.join(inner) if isinstance(inner, list) else inner self._requestInfo = pManager.extract("requestInfo", pType=dict)
def _checkParams(self): AbstractReviewingBase._checkParams(self) pm = ParameterManager(self._params) self._value = pm.extract("value", pType=str, allowEmpty=False) # value is the question id self._keepJud = pm.extract( "keepJud", pType=bool, allowEmpty=False) # keep the previous judgements of the question
class AgentModificationService(AdminService): def _checkParams(self): self._pm = ParameterManager(self._params) self._id = self._pm.extract('id', pType=str) self._name = self._pm.extract('name', pType=str) self._description = self._pm.extract('description', pType=str) self._specificParams = self._params['specific']
def _checkParams(self): pm = ParameterManager(self._params) self._reportNumber = pm.extract("reportNumber", pType=str, allowEmpty=False) self._reportNumberSystem = pm.extract("reportNumberSystem", pType=str, allowEmpty=False)
class AgentModificationService(AdminService): def _checkParams(self): self._pm = ParameterManager(self._params) self._id = self._pm.extract("id", pType=str) self._name = self._pm.extract("name", pType=str) self._description = self._pm.extract("description", pType=str) self._specificParams = self._params["specific"]
def _checkParams(self): SessionChairListBase._checkParams(self) pm = ParameterManager(self._params) self._chairId = pm.extract("userId", pType=str, allowEmpty=False) self._kindOfUser = pm.extract("kindOfUser", pType=str, allowEmpty=True, defaultValue=None)
def _checkParams(self): ConferenceModifBase._checkParams(self) pm = ParameterManager(self._params.get("value"), timezone=self._conf.getTimezone()) self._startDate = pm.extract("startDate", pType=datetime.datetime) self._endDate = pm.extract("endDate", pType=datetime.datetime)
def _checkParams(self): AdminService._checkParams(self) pm = ParameterManager(self._params) self._title = pm.extract("title", pType=str, allowEmpty=False) self._type = pm.extract("type", pType=str, allowEmpty=False) self._content = pm.extract("content", pType=str, allowEmpty=True)
def _checkParams(self): params = self._params or {} # if params is not specified it's an empty list pManager = ParameterManager(params) self._userMail = pManager.extract("userMail", pType=str, allowEmpty=True) self._code = pManager.extract("code", pType=str, allowEmpty=True) self._message = pManager.extract("message", pType=str, allowEmpty=True) inner = params.get("inner", "") self._inner = "\n".join(inner) if isinstance(inner, list) else inner self._requestInfo = pManager.extract("requestInfo", pType=dict, allowEmpty=True)
def _checkParams(self): ConferenceModifBase._checkParams(self) pm = ParameterManager(self._params.get('value'), timezone=self._conf.getTimezone()) self._startDate = pm.extract('startDate', pType=datetime.datetime) self._endDate = pm.extract('endDate', pType=datetime.datetime)
def _checkParams_POST(self): post_pm = ParameterManager(decode(request.data)) self._sectionHeader = {} self._sectionHeader["title"] = post_pm.extract('title', pType=str, allowEmpty=False) self._sectionHeader["description"] = post_pm.extract('description', pType=str, allowEmpty=True)
def _checkParams(self): params = self._params or {} # if params is not specified it's an empty list pManager = ParameterManager(params) self._userMail = pManager.extract("userMail", pType=str, allowEmpty=True) self._code = pManager.extract("code", pType=str, allowEmpty=True) self._message = pManager.extract("message", pType=str, allowEmpty=True) inner = params.get('inner', '') self._inner = '\n'.join(inner) if isinstance(inner, list) else inner self._requestInfo = pManager.extract("requestInfo", pType=dict, allowEmpty=True)
class SendElectronicAgreement(ConferenceModifBase): def _checkParams(self): ConferenceModifBase._checkParams(self) self._pm = ParameterManager(self._params) self.uniqueIdList = self._pm.extract("uniqueIdList", list, False, []) fromMail = self._pm.extract("from", dict, False, {}) self.fromEmail = fromMail['email'] self.fromName = fromMail['name'] self.content = self._pm.extract("content", str, False, "") p_cc = self._pm.extract("cc", str, True, "").strip() self.cc = setValidEmailSeparators(p_cc).split(',') if p_cc else [] self.emailToList = [] manager = self._conf.getCSBookingManager() for uniqueId in self.uniqueIdList: spk = manager.getSpeakerWrapperByUniqueId(uniqueId) if spk.getStatus() not in [SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE]: self.emailToList.extend(manager.getSpeakerEmailByUniqueId(uniqueId, self._aw.getUser())) def processContent(self, speakerWrapper): fullUrl = UHCollaborationElectronicAgreementForm().getURL(self._conf.getId(), speakerWrapper.getUniqueIdHash()) url = "<a href='%s'>%s</a>"%(fullUrl, fullUrl) talkTitle = speakerWrapper.getContribution().getTitle() if speakerWrapper.getContribution() else self._conf.getTitle() mailEnv = dict(url=url, talkTitle = talkTitle, name= speakerWrapper.getObject().getDirectFullName()) return permissive_format(self.content, mailEnv) def _getAnswer(self): report = "" i = 0 for email in self.emailToList: i += 1 if i != len(self.emailToList): report += "%s, "%email else: report += "%s."%email #{url} and {talkTitle} are mandatory to send the EA link if self.content.find('{url}') == -1: report = "url_error" elif self.content.find('{talkTitle}') == -1: report = "talkTitle_error" else: manager = self._conf.getCSBookingManager() for uniqueId in self.uniqueIdList: sw = manager.getSpeakerWrapperByUniqueId(uniqueId) if sw.getStatus() not in [SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE]: sw.setStatus(SpeakerStatusEnum.PENDING) subject = """[Indico] Electronic Agreement: '%s'"""%(self._conf.getTitle()) notification = ElectronicAgreementNotification([sw.getObject().getEmail()], self.cc, self.fromEmail, self.fromName, self.processContent(sw), subject) GenericMailer.sendAndLog(notification, self._conf, "MaKaC/plugins/Collaboration/RecordingRequest/collaboration.py", None) return report
def _checkParams(self): ConferenceModifBase._checkParams(self) pm = ParameterManager(self._params) submitterId = pm.extract("submitterId", pType=str, allowEmpty=False) abstractId = pm.extract("abstractId", pType=str, allowEmpty=False) self._abstract = self._conf.getAbstractMgr().getAbstractById(abstractId) self._submitter = user.AvatarHolder().getById(submitterId) if self._submitter is None: raise NoReportError(_("The user that you are changing does not exist anymore in the database"))
def _checkParams(self): ServiceBase._checkParams(self) pm = ParameterManager(self._params) self._tz = pm.extract("timezone", pType=str, allowEmpty=False) pm.setTimezone(self._tz) self._sDate = pm.extract("sDate", pType=datetime.datetime, allowEmpty=False) self._eDate = pm.extract("eDate", pType=datetime.datetime, allowEmpty=False)
def _checkParams(self): ConferenceModifBase._checkParams(self) pm = ParameterManager(self._params) self._chairperson = self._conf.getChairById(pm.extract("userId", pType=str, allowEmpty=False)) if self._chairperson == None: raise ServiceAccessError(_("The user that you are trying to delete does not exist.")) if self._chairperson.getEmail() == "": raise ServiceAccessError(_("It is not possible to grant submission rights to a participant without an email address. Please set an email address.")) self._action = pm.extract("action", pType=str, allowEmpty=False)
def _checkParams(self): ConferenceChairPersonBase._checkParams(self) pm = ParameterManager(self._params) self._userList = pm.extract("userList", pType=list, allowEmpty=False) self._submissionRights = pm.extract("presenter-grant-submission", pType=bool, allowEmpty=False) # Check if there is already a user with the same email for person in self._userList: if self._isEmailAlreadyUsed(person["email"]): raise ServiceAccessError(_("A user with the email address %s is already in the Chairpersons list. Chairperson(s) not added.") % person["email"])
class SendElectronicAgreement(ConferenceModifBase): def _checkParams(self): ConferenceModifBase._checkParams(self) self._pm = ParameterManager(self._params) self.uniqueIdList = self._pm.extract("uniqueIdList", list, False, []) fromMail = self._pm.extract("from", dict, False, {}) self.fromEmail = fromMail["email"] self.fromName = fromMail["name"] self.content = self._pm.extract("content", str, False, "") p_cc = self._pm.extract("cc", str, True, "").strip() self.cc = setValidEmailSeparators(p_cc).split(",") if p_cc else [] self.emailToList = [] manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId()) for uniqueId in self.uniqueIdList: spk = manager.getSpeakerWrapperByUniqueId(uniqueId) if spk.getStatus() not in [SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE]: self.emailToList.extend(manager.getSpeakerEmailByUniqueId(uniqueId, self._aw.getUser())) def processContent(self, speakerWrapper): fullUrl = UHCollaborationElectronicAgreementForm().getURL(self._conf.getId(), speakerWrapper.getUniqueIdHash()) url = "<a href='%s'>%s</a>" % (fullUrl, fullUrl) talkTitle = ( speakerWrapper.getContribution().getTitle() if speakerWrapper.getContribution() else self._conf.getTitle() ) mailEnv = dict(url=url, talkTitle=talkTitle, name=speakerWrapper.getObject().getDirectFullName()) return permissive_format(self.content, mailEnv) def _getAnswer(self): report = ", ".join(self.emailToList) + "." # {url} and {talkTitle} are mandatory to send the EA link if self.content.find("{url}") == -1: report = "url_error" elif self.content.find("{talkTitle}") == -1: report = "talkTitle_error" else: manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId()) for uniqueId in self.uniqueIdList: sw = manager.getSpeakerWrapperByUniqueId(uniqueId) if sw.getStatus() not in [SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE]: sw.setStatus(SpeakerStatusEnum.PENDING) subject = """[Indico] Electronic Agreement: '%s'""" % (self._conf.getTitle()) notification = ElectronicAgreementNotification( [sw.getObject().getEmail()], self.cc, self.fromEmail, self.fromName, self.processContent(sw), subject, ) GenericMailer.sendAndLog(notification, self._conf, MODULE_NAME) return report
def _checkParams(self): pm = ParameterManager(self._params) self._conferenceID = pm.extract("conference", pType=str, allowEmpty = False) self._target = ConferenceHolder().getById(self._conferenceID) pm = ParameterManager(self._params.get('chatroomParams')) self._title = pm.extract('title', pType=str, allowEmpty = False) self._createdInLocalServer = pm.extract('createdInLocalServer', pType=bool, allowEmpty = True) self._showRoom = pm.extract('showRoom', pType=bool, allowEmpty = True)
def _checkParams(self): ConferenceModifBase._checkParams(self) pm = ParameterManager(self._params.get('value'), timezone=self._conf.getTimezone()) try: self._startDate = pm.extract('startDate', pType=datetime.datetime) self._endDate = pm.extract('endDate', pType=datetime.datetime) except ValueError, e: raise NoReportError("Warning", e.message)
def _checkParams_POST(self): post_pm = ParameterManager(decode(request.data)) self._introSentence = post_pm.extract('introSentence', pType=str, allowEmpty=False) self._selectionType = post_pm.extract('selectionType', pType=str, allowEmpty=False) self._items = post_pm.extract('items', pType=list, allowEmpty=False) self._mandatory = post_pm.extract('mandatory', pType=bool)
def _checkParams(self): AdminService._checkParams(self) pm = ParameterManager(self._params) self._userId = pm.extract("userId", pType=str, allowEmpty=False) self._av = AvatarHolder().getById(self._userId) if self._av == None: raise ServiceError("ER-U0", _("Cannot find user with id %s") % self._userId)
class ContributionParticipantsBase(ContributionModifBase): def _checkParams(self): ContributionModifBase._checkParams(self) self._pm = ParameterManager(self._params) self._kindOfList = self._pm.extract("kindOfList", pType=str, allowEmpty=False) def _isEmailAlreadyUsed(self, email): participantList = [] if self._kindOfList in ("prAuthor", "coAuthor"): participantList = self._contribution.getPrimaryAuthorList() + self._contribution.getCoAuthorList() elif self._kindOfList == "speaker": participantList = self._contribution.getSpeakerList() for part in participantList: if email == part.getEmail(): return True return False def _getParticipantsList(self, participantList): result = [] for part in participantList: partFossil = fossilize(part) # var to control if we have to show the entry in the author menu to allow add submission rights isSubmitter = False av = AvatarHolder().match({"email": part.getEmail()}, searchInAuthenticators=False, exact=True) if not av: if part.getEmail() in self._contribution.getSubmitterEmailList(): isSubmitter = True elif (av[0] in self._contribution.getSubmitterList() or self._conf.getPendingQueuesMgr().isPendingSubmitter(part)): isSubmitter = True partFossil["showSubmitterCB"] = not isSubmitter result.append(partFossil) return result
def _checkParams(self): pm = ParameterManager(self._params) userId = pm.extract("userId", str, False, "") self._currentUser = self.getAW().getUser() self._target = self._avatar = user.AvatarHolder().getById(userId) if self._target == None: raise ServiceAccessError((_("The user with does not exist")))
def _checkParams(self): AbstractReviewingBase._checkParams(self) pm = ParameterManager(self._params) # we need to do like this because the value sent is an str (inherit of InlineEditWidget) self._value = pm.extract("value", pType=dict, allowEmpty=False) self._min = int(self._value["min"]) self._max = int(self._value["max"])
class UserPersonalDataBase(UserModifyBase): _dataTypes = ["title", "surName", "name", "fullName", "straightFullName", "organisation", "email", "secondaryEmails", "address", "telephone", "fax"] def _checkParams(self): self._pm = ParameterManager(self._params) userId = self._pm.extract("userId", None) if userId is not None: ah = AvatarHolder() self._user = self._avatar = self._target = ah.getById(userId) else: raise ServiceError("ERR-U5", _("User id not specified")) self._dataType = self._pm.extract("dataType", pType=str, allowEmpty=False) if self._dataType not in self._dataTypes: raise ServiceError("ERR-U7", _("Data argument is not valid"))
def _checkParams(self): ConferenceModifBase._checkParams(self) pm = ParameterManager(self._params) self._principals = [ principal_from_fossil(f, allow_pending=True, legacy=False) for f in pm.extract("userList", pType=list, allowEmpty=False) ]
class AgentOperationBase(AdminService): def _checkParams(self): self._pm = ParameterManager(self._params) AdminService._checkParams(self) self._id = self._pm.extract("id", pType=str) self._sm = SyncManager.getDBInstance() self._agent = self._sm.getAllAgents()[self._id]
def _checkParams(self): SessionChairListBase._checkParams(self) pm = ParameterManager(self._params) self._principals = [ principal_from_fossil(f, allow_pending=True) for f in pm.extract("userList", pType=list, allowEmpty=False) ]
class ContributionParticipantsBase(ContributionModifBase): def _checkParams(self): ContributionModifBase._checkParams(self) self._pm = ParameterManager(self._params) self._kindOfList = self._pm.extract("kindOfList", pType=str, allowEmpty=False) def _isEmailAlreadyUsed(self, email): participantList = [] if self._kindOfList in ("prAuthor", "coAuthor"): participantList = self._contribution.getPrimaryAuthorList() + self._contribution.getCoAuthorList() elif self._kindOfList == "speaker": participantList = self._contribution.getSpeakerList() for part in participantList: if email == part.getEmail(): return True return False def _getParticipantsList(self, participantList): result = [] for part in participantList: partFossil = fossilize(part) # var to control if we have to show the entry in the author menu to allow add submission rights isSubmitter = False av = AvatarHolder().match({"email": part.getEmail()}, forceWithoutExtAuth=True, exact=True) if not av: if part.getEmail() in self._contribution.getSubmitterEmailList(): isSubmitter = True elif (av[0] in self._contribution.getSubmitterList() or self._conf.getPendingQueuesMgr().isPendingSubmitter(part)): isSubmitter = True partFossil["showSubmitterCB"] = not isSubmitter result.append(partFossil) return result
def _checkParams(self): AdminService._checkParams(self) pm = ParameterManager(self._params) self._userId = pm.extract("userId", pType=str, allowEmpty=False) self._av = AvatarHolder().getById(self._userId) if self._av == None: raise NoReportError(_("The user that you are trying to login as does not exist anymore in the database"))
class AgentOperationBase(AdminService): def _checkParams(self): self._pm = ParameterManager(self._params) AdminService._checkParams(self) self._id = self._pm.extract('id', pType=str) self._sm = SyncManager.getDBInstance() self._agent = self._sm.getAllAgents()[self._id]
def _checkParams(self): AdminService._checkParams(self) pm = ParameterManager(self._params) user_id = pm.extract("userId", pType=int, allowEmpty=False) self._user = User.get(user_id) if self._user is None: raise NoReportError(_("The user that you are trying to login as does not exist anymore in the database"))
def _checkParams(self): CollaborationBase._checkParams(self) if 'bookingParams' in self._params: pm = ParameterManager(self._params) self._bookingParams = pm.extract("bookingParams", pType=dict, allowEmpty = True) else: raise CollaborationException(_("Custom parameters for plugin ") + str(self._type) + _(" not set when trying to create a booking on meeting ") + str(self._conf.getId() ))