def _process(self):
     av = None
     if self._userId != "":
         av = user.AvatarHolder().getById(self._userId)
     elif self._email != "":
         try:
             av = user.AvatarHolder().match({"email": self._email},
                                            exact=1)[0]
         except IndexError:
             pass
     if av:
         mail.send_login_info(av, self._conf)
     self._redirect(urlHandlers.UHConfSignIn.getURL(self._conf))
Esempio n. 2
0
    def create(self, li):
        # first, check if authentication is OK
        data = NiceChecker().check(li.getLogin(), li.getPassword())
        if not data:
            return None

        if (data["ccid"] == '') and (data['email'] == ""):
            return None

        if not data:
            # cannot get user data
            return None
        # Search if user already exist, using email address
        import MaKaC.user as user
        ah = user.AvatarHolder()
        userList = ah.match({"email":data["mail"]}, forceWithoutExtAuth=True)
        if len(userList) == 0:
            # User doesn't exist, create it
            try:
                av = user.Avatar()
                av.setName(data.get('cn', "No name"))
                av.setSurName(data.get('sn', "No Surname"))
                av.setOrganisation(data.get('homeinstitute', "No institute"))
                av.setEmail(data['mail'])
                av.setTelephone(data.get('telephonenumber',""))
                ah.add(av)
            except KeyError, e:
                raise MaKaCError( _("NICE account does not contain the mandatory data to create \
                                  an Indico account. You can create an Indico \
                                  account manually in order to use your NICE login")%(urlHandlers.UHUserRegistration.getURL()))
Esempio n. 3
0
 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)
Esempio n. 4
0
 def _process(self):
     from MaKaC.common.Configuration import Config
     from MaKaC.externUsers import ExtUserHolder
     from urllib import urlencode
     euh = ExtUserHolder()
     ah = user.AvatarHolder()
     newIdentityList = []
     for id in self._identityList:
         newId = id
         for authId in Config.getInstance().getAuthenticatorList():
             if id[:len(authId)] == authId:
                 dict = euh.getById(authId).getById(id.split(':')[1])
                 av = user.Avatar(dict)
                 newId = ah.add(av)
                 identity = dict["identity"](dict["login"], av)
                 try:
                     dict["authenticator"].add(identity)
                 except:
                     pass
                 av.activateAccount()
         newIdentityList.append("selectedPrincipals=%s" % newId)
     if self._addURL.find("?") != -1:
         targetURL = self._addURL + "&" + urlencode(
             self._params) + "&" + "&".join(newIdentityList)
     else:
         targetURL = self._addURL + "?" + urlencode(
             self._params) + "&" + "&".join(newIdentityList)
     self._redirect(targetURL)
Esempio n. 5
0
 def _getAnswer(self):
     for reviewer in self._reviewerList:
         ah = user.AvatarHolder()
         av = ah.getById(reviewer["id"])
         self._conf.getTrackById(self._trackId).addCoordinator(av)
     return fossilize(
         self._conf.getTrackById(self._trackId).getCoordinatorList())
Esempio n. 6
0
 def _process( self ):
     choice = self._target.getConference().getConfPaperReview().getChoice()
     if choice == 2 or choice == 4:
         self._target.getReviewManager().addReviewer(user.AvatarHolder().getById(self._reviewer))
         self._redirect( urlHandlers.UHContributionModifReviewing.getURL( self._target ) )
     else:
         raise MaKaCError("Reviewing mode does not allow content reviewing")
Esempio n. 7
0
    def _process(self):

        if self.setPrin:
            self.prin = self.newPrin

        elif self.setToMerge:
            self.toMerge = self.newToMerge

        elif self.cancel:
            pass

        elif self.selectPrin:
            p = admins.WPUserMergeSelectPrin(self, self.prin, self.toMerge)
            return p.display(**self._getRequestParams())

        elif self.selectToMerge:
            p = admins.WPUserMergeSelectToMerge(self, self.prin, self.toMerge)
            return p.display(**self._getRequestParams())

        elif self.merge:
            if self.prin and self.toMerge:
                ah = user.AvatarHolder()
                ah.mergeAvatar(self.prin, self.toMerge)
                url = urlHandlers.UHUserMerge.getURL()
                url.addParam("prinId", self.prin.getId())
                self._redirect(url)
                return _("[Done]")

        p = admins.WPUserMerge(self, self.prin, self.toMerge)
        return p.display()
Esempio n. 8
0
 def _process(self):
     try:
         ah = user.AvatarHolder()
         us = ah.match({'email': '*****@*****.**'})[0]
         self._event = self._cat.newConference(us)
         self._event.setTitle(self._title)
         self._event.setDescription(self._description)
         sd = self._startdate.split("/")
         st = self._stime.split(":")
         sdate = datetime(int(sd[2]), int(sd[1]), int(sd[0]), int(st[0]),
                          int(st[1]))
         ed = self._enddate.split("/")
         et = self._etime.split(":")
         edate = datetime(int(ed[2]), int(ed[1]), int(ed[0]), int(et[0]),
                          int(et[1]))
         self._event.setDates(sdate, edate)
         chair = conference.ConferenceChair()
         chair.setFamilyName(self._speaker)
         chair.setEmail(self._speakeremail)
         self._event.addChair(chair)
         self._event.setAccessKey(self._accessPassword)
         self._event.setModifKey(self._modifyPassword)
     except MaKaCError, e:
         self._statusValue = "ERROR"
         self._message = e.getMsg()
Esempio n. 9
0
 def _checkParams(self, params):
     RHTrackCoordination._checkParams(self, params)
     selIds = self._normaliseListParam(params.get("selectedPrincipals", []))
     ah = user.AvatarHolder()
     self._coordinators = []
     for id in selIds:
         self._coordinators.append(ah.getById(id))
Esempio n. 10
0
 def _checkParams(self):
     ConferenceReviewingPRMBase._checkParams(self)
     userId = self._params.get("user", None)
     if userId:
         self._user = user.AvatarHolder().getById(userId)
     else:
         raise ServiceError("ERR-REV4", _("No user id specified"))
Esempio n. 11
0
 def _checkParams(self):
     self._pm = ParameterManager(self._params)
     userId = self._pm.extract("userId", None)
     if userId is not None:
         ah = user.AvatarHolder()
         self._target = ah.getById(userId)
     else:
         raise ServiceError("ERR-U5", _("User id not specified"))
Esempio n. 12
0
 def _process(self):
     choice = self._target.getConference().getConfPaperReview().getChoice()
     if choice == 2 or choice == 4:
         self._rm.addReviewer(user.AvatarHolder().getById(self._reviewer))
         self._redirect(
             url_for('event_mgmt.contributionReviewing', self.contrib))
     else:
         raise MaKaCError("Reviewing mode does not allow content reviewing")
Esempio n. 13
0
 def _checkParams(self, params):
     RHLinkModifBase._checkParams(self, params)
     selAllowedId = self._normaliseListParam(
         params.get("selectedPrincipals", []))
     ah = user.AvatarHolder()
     self._allowed = []
     for id in selAllowedId:
         self._allowed.append(ah.getById(id))
Esempio n. 14
0
 def _checkParams(self, params):
     if "userId" not in params or params["userId"].strip() == "":
         raise MaKaCError(_("user id not specified"))
     ah = user.AvatarHolder()
     self._target = self._avatar = ah.getById(params["userId"])
     if self._avatar == None:
         raise NotFoundError(
             "The user id does not match any existing user.")
Esempio n. 15
0
 def _checkParams(self):
     ServiceBase._checkParams(self)
     self._pm = ParameterManager(self._params)
     userId = self._pm.extract("userId", pType=str, allowEmpty=True)
     if userId is not None:
         ah = user.AvatarHolder()
         self._target = ah.getById(userId)
     else:
         self._target = self._aw.getUser()
Esempio n. 16
0
def deleteUsers(start, number):#debug method to delete large number of users, starting with id = start and consecutive 'number' of ids
    ah = user.AvatarHolder()
    for i in range(number):
        x = i + start
        try:
            ah.remove(ah.getById(x))
            #print x
        except IndexError:
            pass
Esempio n. 17
0
 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"))
Esempio n. 18
0
 def _getAnswer(self):
     av = user.AvatarHolder().match({"email": self._secondaryEmai},
                                    forceWithoutExtAuth=True)
     if av and av[0] != self._user:
         raise NoReportError(
             _("The email address %s is already used by another user.") %
             self._secondaryEmai)
     self._user.addSecondaryEmail(self._secondaryEmail)
     return True
Esempio n. 19
0
    def _checkParams(self):
        LoggedOnlyService._checkParams(self)

        self._userList = []

        for userData in self._params['value']:
            self._userList.append(user.AvatarHolder().getById(userData['id']))

        self._target = self.getAW().getUser()
Esempio n. 20
0
    def _process( self ):
        if self.merge:
            if self.prin and self.toMerge:
                ah = user.AvatarHolder()
                ah.mergeAvatar(self.prin, self.toMerge)
                url = urlHandlers.UHUserMerge.getURL()
                url.addParam("prinId", self.prin.getId())
                self._redirect(url)
                return _("[Done]")

        p = admins.WPUserMerge( self, self.prin, self.toMerge )
        return p.display()
Esempio n. 21
0
    def _checkParams(self, params):
        if not session.user:
            # Let checkProtection deal with it.. no need to raise an exception here
            # if no user is specified
            return

        if not params.setdefault('userId', session.get('_avatarId')):
            raise MaKaCError(_("user id not specified"))

        ah = user.AvatarHolder()
        self._target = self._avatar = ah.getById(params['userId'])
        if self._avatar is None:
            raise NotFoundError("The user id does not match any existing user.")
Esempio n. 22
0
    def _checkParams( self, params ):
        ah = user.AvatarHolder()
        self._params = params
        RHAdminBase._checkParams( self, params )

        self.prin = ah.getById(self._params.get("prinId", None))
        self.toMerge = ah.getById(self._params.get("toMergeId", None))

        self.merge = False
        if self._params.get("merge", None):
            self.merge = True
            if self.prin is not None and self.toMerge is not None and self.prin == self.toMerge:
                raise FormValuesError(_("One cannot merge a user with him/herself"))
Esempio n. 23
0
 def _checkParams(self):
     self._pm = ParameterManager(self._params)
     userId = self._pm.extract("userId", None)
     if userId is not None:
         ah = user.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 not self._dataType in self._dataTypes:
         raise ServiceError("ERR-U7", _("Data argument is not valid"))
Esempio n. 24
0
 def _process(self):
     params = self._getRequestParams()
     if "selectedPrincipals" in params:
         ah = user.AvatarHolder()
         authIndex = self._target.getConference().getAuthorIndex()
         for id in self._normaliseListParam(params["selectedPrincipals"]):
             spk = conference.SubContribParticipation()
             if id[:9] == "*author*:":
                 id = id[9:]
                 spk.setDataFromAuthor(authIndex.getById(id)[0])
             else:
                 spk.setDataFromAvatar(ah.getById(id))
             self._target.newSpeaker(spk)
     self._redirect(
         urlHandlers.UHSubContributionModification.getURL(self._target))
Esempio n. 25
0
    def _process(self):

        av = user.AvatarHolder().getById(self._userId)

        if not av:
            raise MaKaCError(_("The user id specified does not exist"))

        for sMail in av.getPendingSecondaryEmails():
            if md5(sMail).hexdigest() == self._key:
                av.removePendingSecondaryEmail(sMail)
                av.addSecondaryEmail(sMail)
                p = adminPages.WPUserActiveSecondaryEmail(self, av, sMail)
                return p.display()
        else:
            raise MaKaCError(_("The email has already being confirmed or the key is wrong"))
Esempio n. 26
0
    def _checkParams(self, params):
        admins.RHAdminBase._checkParams(self, params)
        self._params = params
        self._userId = None
        self._av = None

        self._returnURL = urlHandlers.UHWelcome.getURL()
        if "returnURL" in params.keys():
            self._returnURL = params["returnURL"]

        if "selectedPrincipals" in params.keys():
            self._userId = params["selectedPrincipals"]
            try:
                self._av = user.AvatarHolder().getById(self._userId)
            except:
                raise MaKaCError("can't found user with id %s" % self._userId)
Esempio n. 27
0
 def _checkParams(self, params):
     RHConferenceBaseDisplay._checkParams( self, params )
     if "contribId" in params:
         contrib = self._conf.getContributionById(params.get("contribId",""))
     if "chairId" in params:
         chairid=params.get("chairId","")
         self._to = self._conf.getChairById(chairid).getEmail()
     if "authorId" in params:
         authid = params.get("authorId", "")
         self._to = contrib.getAuthorById(authid).getEmail()
     fromId = params.get("from","")
     self._from = (user.AvatarHolder()).getById(fromId).getEmail()
     self._cc = self._from
     self._subject=params.get("subject","")
     self._body = params.get("body","")
     self._send = params.has_key("OK")
Esempio n. 28
0
    def retrieveUsers(params, fieldName="userList"):
        pm = ParameterManager(params)
        userList = pm.extract(fieldName, pType=list, allowEmpty = True)
        avatars = []
        newUsers = []
        editedAvatars = []

        for userDict in userList:
            id = userDict['id']
            if str(id).startswith('newUser'):
                newUsers.append(userDict)
            elif str(id).startswith('edited'):
                editedAvatars.append((user.AvatarHolder().getById(id[6:]), userDict))
            else:
                avatars.append(principal_from_fossil(userDict, allow_pending=True))

        return avatars, newUsers, editedAvatars
Esempio n. 29
0
    def _checkParams(self, params):
        ah = user.AvatarHolder()
        self._params = params
        RHAdminBase._checkParams(self, params)

        self.prin = None
        if self._params.get("prinId", None) and self._params["prinId"] != "":
            self.prin = ah.getById(self._params["prinId"])

        self.toMerge = None
        if self._params.get("toMergeId",
                            None) and self._params["toMergeId"] != "":
            self.toMerge = ah.getById(self._params["toMergeId"])

        self.selectPrin = False
        if self._params.get("selectPrin", None):
            self.selectPrin = True

        self.selectToMerge = False
        if self._params.get("selectToMerge", None):
            self.selectToMerge = True

        self.merge = False
        if self._params.get("merge", None):
            self.merge = True
        self.cancel = False
        self.setPrin = False
        self.newPrin = None
        if self._params.get("setPrin", None):
            if self._params.get("selectedPrincipals", None):
                self.setPrin = True
                self.newPrin = ah.getById(
                    self._params.get("selectedPrincipals", ""))
            else:
                self.cancel = True

        self.setToMerge = False
        self.newToMerge = None
        if self._params.get("setToMerge", None):
            if self._params.get("selectedPrincipals", None):
                self.setToMerge = True
                self.newToMerge = ah.getById(
                    self._params.get("selectedPrincipals", ""))
            else:
                self.cancel = True
Esempio n. 30
0
 def _process(self):
     av = user.AvatarHolder().getById(self._userId)
     if av.isActivated():
         p = conferences.WPConfAccountAlreadyActivated(self, self._conf, av)
         return p.display()
         #return "your account is already activated"
     if av.isDisabled():
         p = conferences.WPConfAccountDisabled(self, self._conf, av)
         return p.display()
         #return "your account is disabled. please, ask to enable it"
     elif self._key == av.getKey():
         av.activateAccount()
         p = conferences.WPConfAccountActivated(self, self._conf, av,
                                                self._returnURL)
         return p.display()
         #return "Your account is activate now"
     else:
         return "Wrong key. Please, ask for a new one"