コード例 #1
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def setUp(self):
     av = user.Avatar()
     self._conf = conference.Conference(av)
     self._track1 = self._conf.newTrack()
     self._track2 = self._conf.newTrack()
     self._track3 = self._conf.newTrack()
     submitter = user.Avatar()
     submitter.setId("submitter")
     self._abstract = self._conf.getAbstractMgr().newAbstract(submitter)
コード例 #2
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def setUp(self):
     av = user.Avatar()
     self._conf = conference.Conference(av)
     self._ctOral = conference.ContributionType("oral", "", self._conf)
     self._conf.addContribType(self._ctOral)
     self._track1 = self._conf.newTrack()
     self._track2 = self._conf.newTrack()
     self._track3 = self._conf.newTrack()
     submitter = user.Avatar()
     submitter.setId("submitter")
     self._abstract = self._conf.getAbstractMgr().newAbstract(submitter)
コード例 #3
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testCannotAccWithdrawn(self):
     #tests that a withdrawn abstract cannot be accepted
     self._abstract.withdraw(None, "hola")
     cm = user.Avatar()
     cm.setId("cm")
     self.assertRaises(errors.MaKaCError, self._abstract.accept, cm,
                       self._track1, self._ctOral)
コード例 #4
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testNormal(self):
     #tests the normal flow of events of the withdrawal TC
     av = user.Avatar()
     self._abstract.withdraw(av, "hola")
     self.assert_(
         isinstance(self._abstract.getCurrentStatus(),
                    review.AbstractStatusWithdrawn))
コード例 #5
0
ファイル: users.py プロジェクト: arturodr/indico
 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)
コード例 #6
0
ファイル: mapfinal.py プロジェクト: lukasnellen/indico
def createUser(name, email, org, password):
    #has problem that if no email exists and 2 users with same name will clash
    #perhaps change getUser() to check for same name if no email exist.
    #problem being that more than one person can have same name. Email unique.
    dummy = user.Avatar()
    #sets the user properties
    if name == '':  #if there is no username makes the email address appear in it's place
        dummy.setName(email)
    else:
        dummy.setName(name)
    dummy.setEmail(email)
    dummy.setOrganisation(org)
    ah.add(dummy)
    avatar = ah.getById(dummy.id)
    if email != '':  #creates the identity and sets the password for chairs etc.
        id = user.LocalIdentity(name, password, avatar)
    else:  #user with no email address - identity not created
        return avatar
    ih = user.AuthenticatorMgr()
    try:
        ih.add(id)
    except (UserError):
        pass
    avatar.activateAccount()
    return avatar
コード例 #7
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()))
コード例 #8
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testNormal(self):
     #tests the abstract recovery normal flow
     av = user.Avatar()
     self._abstract.withdraw(av)
     self._abstract.recover()
     self.assert_(
         isinstance(self._abstract.getCurrentStatus(),
                    review.AbstractStatusSubmitted))
コード例 #9
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testIdCollission(self):
     #checks that no collission with contributions can happen regarding
     #   the ids
     contrib = conference.Contribution()
     self._conf.addContribution(contrib)
     res1 = user.Avatar()
     res1.setId("res1")
     abstract = self._conf.getAbstractMgr().newAbstract(res1)
     #accepting an abstract for a certain track
     self._abstract.accept(res1, self._track1, self._ctOral)
     self.assert_(contrib.getId() != abstract.getId())
コード例 #10
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testAcceptForNonProposedTrack(self):
     #an abstract can be accepted for a track for which it is not proposed
     self._abstract.setTracks([self._track1, self._track2])
     self.assert_(not self._track3.hasAbstract(self._abstract))
     res1 = user.Avatar()
     res1.setId("res1")
     self._abstract.accept(res1, self._track3, self._ctOral)
     #check the status is changed to accept
     status = self._abstract.getCurrentStatus()
     self.assert_(isinstance(status, review.AbstractStatusAccepted))
     #check the track
     self.assert_(status.getTrack() == self._track3)
     #check the track list contains the track for which it was accepted
     self.assert_(self._track3.hasAbstract(self._abstract))
コード例 #11
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testTackJudgementClearing(self):
     #tests that after recovering an abstract which had some judgements
     #   they are cleared.
     tc = user.Avatar()
     tc.setId("tc")
     self._abstract.proposeToAccept(tc, self._track1, "oral")
     self._abstract.proposeToAccept(tc, self._track3, "oral")
     self._abstract.withdraw(tc)
     self._abstract.recover()
     self.assert_(self._abstract.hasTrack(self._track1))
     self.assert_(self._abstract.hasTrack(self._track3))
     self.assert_(self._track1.hasAbstract(self._abstract))
     self.assert_(self._track3.hasAbstract(self._abstract))
     self.assert_(self._abstract.getNumJudgements() == 2)
コード例 #12
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testAccepted(self):
     #tests that it is possible to withdraw an accepted abstract and that it
     #   provokes the withdrawal of the associated contribution
     av = user.Avatar()
     self._abstract.accept(av, self._track1, self._ctOral)
     contrib = self._abstract.getContribution()
     self.assert_(
         not isinstance(contrib, conference.ContribStatusWithdrawn))
     self._abstract.withdraw(av, "hola")
     absStatus = self._abstract.getCurrentStatus()
     contribStatus = contrib.getCurrentStatus()
     self.assert_(isinstance(absStatus, review.AbstractStatusWithdrawn))
     self.assert_(
         isinstance(contribStatus, conference.ContribStatusWithdrawn))
コード例 #13
0
 def testAddAndRemoveSubCategories(self):
     #checks that the conference counter works fine when adding a new
     #   sub-category
     croot=conference.Category()
     c1=conference.Category()
     c2=conference.Category()
     croot._addSubCategory(c2)
     creator=user.Avatar()
     conf0=conference.Conference(creator)
     conf0.setId("0")
     conf1=conference.Conference(creator)
     conf1.setId("1")
     c1._addConference(conf0)
     c1._addConference(conf1)
     self.assert_(croot.getNumConferences()==0)
     self.assert_(c1.getNumConferences()==2)
     self.assert_(c2.getNumConferences()==0)
     croot._addSubCategory(c1)
     self.assert_(croot.getNumConferences()==2)
     self.assert_(c1.getNumConferences()==2)
     self.assert_(c2.getNumConferences()==0)
     c1_1=conference.Category()
     c1._addSubCategory(c1_1)
     self.assert_(croot.getNumConferences()==2)
     self.assert_(c1.getNumConferences()==2)
     self.assert_(c1_1.getNumConferences()==2)
     self.assert_(c2.getNumConferences()==0)
     c1_1.move(c2)
     self.assert_(croot.getNumConferences()==2)
     self.assert_(c1.getNumConferences()==0)
     self.assert_(c1_1.getNumConferences()==2)
     self.assert_(c2.getNumConferences()==2)
     croot._removeSubCategory(c1)
     self.assert_(croot.getNumConferences()==2)
     self.assert_(c1.getNumConferences()==0)
     self.assert_(c1_1.getNumConferences()==2)
     self.assert_(c2.getNumConferences()==2)
     c2._removeSubCategory(c1_1)
     self.assert_(croot.getNumConferences()==0)
     self.assert_(c1.getNumConferences()==0)
     self.assert_(c1_1.getNumConferences()==2)
     self.assert_(c2.getNumConferences()==0)
コード例 #14
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testSimpleSubmission(self):
     submitter = user.Avatar()
     submitter.setId("submitter")
     #creation of a new abstract
     a = self._conf.getAbstractMgr().newAbstract(submitter)
     #setting of abstract tracks
     a.setTracks([self._track1, self._track2])
     #checking that the abstract is in the conference and its status is
     # submitted
     self.assert_(a in self._conf.getAbstractMgr().getAbstractList())
     self.assert_(
         isinstance(a.getCurrentStatus(), review.AbstractStatusSubmitted))
     #checking that the abstract tracks are correctly set up
     self.assert_(a.isProposedForTrack(self._track1))
     self.assert_(a.isProposedForTrack(self._track2))
     self.assert_(not a.isProposedForTrack(self._track3))
     #checking that the abstract is included in the track abstract list
     self.assert_(a.isProposedForTrack(self._track1))
     self.assert_(a.isProposedForTrack(self._track2))
     self.assert_(not a.isProposedForTrack(self._track3))
     #checking that the submitter is the abstract submitter
     self.assert_(a.isSubmitter(submitter))
コード例 #15
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testSimpleReallocation(self):
     tc1 = user.Avatar()
     tc1.setId("tc1")
     self._abstract.proposeForOtherTracks( tc1, self._track1, "test", \
         [self._track2, self._track3] )
     self.assert_(self._abstract.hasTrack(self._track1))
     self.assert_(self._abstract.hasTrack(self._track2))
     self.assert_(self._abstract.hasTrack(self._track3))
     self.assert_(self._abstract.getNumJudgements() == 1)
     t1jud = self._abstract.getTrackJudgement(self._track1)
     self.assert_(isinstance(t1jud, review.AbstractReallocation))
     self.assert_(t1jud.getResponsible() == tc1)
     self.assert_(self._track2 in t1jud.getProposedTrackList())
     self.assert_(self._track3 in t1jud.getProposedTrackList())
     self.assert_(self._track1 not in t1jud.getProposedTrackList())
     status = self._abstract.getCurrentStatus()
     self.assert_(isinstance(status, review.AbstractStatusUnderReview))
     t2_tl = self._abstract.getReallocationTargetedList(self._track2)
     self.assert_(t1jud in t2_tl)
     t3_tl = self._abstract.getReallocationTargetedList(self._track3)
     self.assert_(t1jud in t3_tl)
     t1_tl = self._abstract.getReallocationTargetedList(self._track1)
     self.assert_(t1jud not in t1_tl)
コード例 #16
0
ファイル: LDAPAuthentication.py プロジェクト: arturodr/indico
    def create(self, li):
        Logger.get('auth.ldap').info("create '%s'" % li.getLogin())
        # first, check if authentication is OK
        data = LDAPChecker().check(li.getLogin(), li.getPassword())
        if not 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()
                name = data.get('cn')
                av.setName(name.split()[0])
                av.setSurName(name.split()[-1])
                av.setOrganisation(data.get('o', ""))
                av.setEmail(data['mail'])
                if 'postalAddress' in data:
                    av.setAddress(fromLDAPmultiline(data.get('postalAddress')))
                #av.setTelephone(data.get('telephonenumber',""))
                ah.add(av)
                av.activateAccount()
            except KeyError:
                raise MaKaCError("LDAP account does not contain the mandatory"
                                 "data to create an Indico account.")
        else:
            # user founded
            av = userList[0]
        #now create the nice identity for the user
        na = LDAPAuthenticator()
        id = na.createIdentity(li, av)
        na.add(id)
        return av
コード例 #17
0
 def testBasicAddAndRemoveConferences(self):
     #creation of basic category structure over which perform the tests
     croot=conference.Category()
     c1=conference.Category()
     croot._addSubCategory(c1)
     c2=conference.Category()
     croot._addSubCategory(c2)
     c1_1=conference.Category()
     c1._addSubCategory(c1_1)
     #checks adding a conference increases the conference number of the 
     #   involved categories
     creator=user.Avatar()
     conf1=conference.Conference(creator)
     conf1.setId("0")
     c1_1._addConference(conf1)
     self.assert_(c1_1.getNumConferences()==1)
     self.assert_(c1.getNumConferences()==1)
     self.assert_(c2.getNumConferences()==0)
     self.assert_(croot.getNumConferences()==1)
     conf2=conference.Conference(creator)
     conf2.setId("1")
     c2._addConference(conf2)
     self.assert_(c1_1.getNumConferences()==1)
     self.assert_(c1.getNumConferences()==1)
     self.assert_(c2.getNumConferences()==1)
     self.assert_(croot.getNumConferences()==2)
     c1_1.removeConference(conf1)
     self.assert_(c1_1.getNumConferences()==0)
     self.assert_(c1.getNumConferences()==0)
     self.assert_(c2.getNumConferences()==1)
     self.assert_(croot.getNumConferences()==1)
     c2.removeConference(conf2)
     self.assert_(c1_1.getNumConferences()==0)
     self.assert_(c1.getNumConferences()==0)
     self.assert_(c2.getNumConferences()==0)
     self.assert_(croot.getNumConferences()==0)
コード例 #18
0
 def _process(self):
     save = False
     authManager = AuthenticatorMgr()
     minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
     self._params["msg"] = ""
     if self._save:
         save = True
         #check submited data
         if not self._params.get("name", ""):
             self._params["msg"] += _("You must enter a name.") + "<br>"
             save = False
         if not self._params.get("surName", ""):
             self._params["msg"] += _("You must enter a surname.") + "<br>"
             save = False
         if not self._params.get("organisation", ""):
             self._params["msg"] += _(
                 "You must enter the name of your organisation.") + "<br>"
             save = False
         if not self._params.get("email", ""):
             self._params["msg"] += _(
                 "You must enter an email address.") + "<br>"
             save = False
         if not self._params.get("login", ""):
             self._params["msg"] += _("You must enter a login.") + "<br>"
             save = False
         if not self._params.get("password", ""):
             self._params["msg"] += _(
                 "You must define a password.") + "<br>"
             save = False
         if self._params.get("password", "") != self._params.get(
                 "passwordBis", ""):
             self._params["msg"] += _(
                 "You must enter the same password twice.") + "<br>"
             save = False
         if not authManager.isLoginAvailable(self._params.get("login", "")):
             self._params["msg"] += _(
                 "Sorry, the login you requested is already in use. Please choose another one."
             ) + "<br>"
             save = False
         if not self._validMail(self._params.get("email", "")):
             self._params["msg"] += _(
                 "You must enter a valid email address")
             save = False
     if save:
         #Data are OK, Now check if there is an existing user or create a new one
         ah = user.AvatarHolder()
         res = ah.match({"email": self._params["email"]},
                        exact=1,
                        searchInAuthenticators=False)
         if res:
             #we find a user with the same email
             a = res[0]
             #check if the user have an identity:
             if a.getIdentityList():
                 self._redirect(
                     urlHandlers.UHConfUserExistWithIdentity.getURL(
                         self._conf, a))
                 return
             else:
                 #create the identity to the user and send the comfirmation email
                 li = user.LoginInfo(self._params["login"],
                                     self._params["password"])
                 id = authManager.createIdentity(li, a, "Local")
                 authManager.add(id)
                 DBMgr.getInstance().commit()
                 if minfo.getModerateAccountCreation():
                     mail.sendAccountCreationModeration(a).send()
                 else:
                     mail.sendConfirmationRequest(a, self._conf).send()
                     if minfo.getNotifyAccountCreation():
                         mail.sendAccountCreationNotification(a).send()
         else:
             a = user.Avatar()
             _UserUtils.setUserData(a, self._params)
             ah.add(a)
             li = user.LoginInfo(self._params["login"],
                                 self._params["password"])
             id = authManager.createIdentity(li, a, "Local")
             authManager.add(id)
             DBMgr.getInstance().commit()
             if minfo.getModerateAccountCreation():
                 mail.sendAccountCreationModeration(a).send()
             else:
                 mail.sendConfirmationRequest(a).send()
                 if minfo.getNotifyAccountCreation():
                     mail.sendAccountCreationNotification(a).send()
         self._redirect(urlHandlers.UHConfUserCreated.getURL(self._conf, a))
     else:
         p = conferences.WPConfUserCreation(self, self._conf, self._params)
         return p.display()
コード例 #19
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def setUp(self):
     self._creator = user.Avatar()
     self._conf = conference.Conference(self._creator)
コード例 #20
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def setUp(self):
     av = user.Avatar()
     self._conf = conference.Conference(av)
     self._track1 = self._conf.newTrack()
     self._track2 = self._conf.newTrack()
     self._track3 = self._conf.newTrack()
コード例 #21
0
def runTests(host='localhost', port=FAKE_SERVICE_PORT,
             scenarios=[(2, 10)]):

    execTimes = []

    agent = InvenioBatchUploaderAgent('test1', 'test1', 'test',
                                      0, 'http://%s:%s' \
                                      % (host, port))

    ph = PluginsHolder()
    ph.reloadAllPlugins()
    ph.getPluginType('livesync').toggleActive()
    do = DummyObservable()

    do._notify('updateDBStructures', 'indico.ext.livesync',
                              None, None, None)

    sm = SyncManager.getDBInstance()

    sm.registerNewAgent(agent)

    cm = CategoryManager()

    avatar = user.Avatar()
    avatar.setName( "fake" )
    avatar.setSurName( "fake" )
    avatar.setOrganisation( "fake" )
    avatar.setLang( "en_GB" )
    avatar.setEmail( "*****@*****.**" )

    #registering user
    ah = user.AvatarHolder()
    ah.add(avatar)

    #setting up the login info
    li = user.LoginInfo("dummyuser", None)
    am = AuthenticatorMgr()
    userid = am.createIdentity( li, avatar, "Local" )
    am.add( userid )

    #activate the account
    avatar.activateAccount()

    #since the DB is empty, we have to add dummy user as admin
    minfo = HelperMaKaCInfo.getMaKaCInfoInstance()
    al = minfo.getAdminList()
    al.grant( avatar )

    dummy = avatar

    ContextManager.destroy()

    HelperMaKaCInfo.getMaKaCInfoInstance().setDefaultConference(DefaultConference())

    cm.getRoot()

    do._notify('requestStarted')

    home = cm.getById('0')

    # execute code
    for nconf in range(0, 1000):
        conf = home.newConference(dummy)
        conf.setTitle('Test Conference %s' % nconf)

    do._notify('requestFinished')

    time.sleep(1)

    # params won't be used
    task = LiveSyncUpdateTask(dateutil.rrule.MINUTELY)

    for scen in scenarios:

        print "Scenario %s workers, size = %s " % scen,

        # configure scenario
        InvenioBatchUploaderAgent.NUM_WORKERS = scen[0]
        InvenioBatchUploaderAgent.BATCH_SIZE = scen[1]

        ts = time.time()
        # just run it
        task.run()

        te = time.time()
        execTimes.append(te - ts)

        print "%s" % (te - ts)

        sm._track._pointers['test1'] = None

    for i in range(0, len(execTimes)):
        results[scenarios[i]] = execTimes[i]
コード例 #22
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def setUp(self):
     av = user.Avatar()
     self._conf = conference.Conference(av)
     self._tz = timezone('UTC')
     self._conf.setTimezone('UTC')
コード例 #23
0
ファイル: users.py プロジェクト: arturodr/indico
 def _process(self):
     save = False
     ih = AuthenticatorMgr()
     minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
     self._params["msg"] = ""
     if self._save:
         save = True
         #check submited data
         if not self._params.get("name", ""):
             self._params["msg"] += _("You must enter a name.") + "<br>"
             save = False
         if not self._params.get("surName", ""):
             self._params["msg"] += _("You must enter a surname.") + "<br>"
             save = False
         if not self._params.get("organisation", ""):
             self._params["msg"] += _(
                 "You must enter the name of your organisation.") + "<br>"
             save = False
         if not self._params.get("email", ""):
             self._params["msg"] += _(
                 "You must enter an email address.") + "<br>"
             save = False
         if not self._params.get("login", ""):
             self._params["msg"] += _("You must enter a login.") + "<br>"
             save = False
         if not self._params.get("password", ""):
             self._params["msg"] += _(
                 "You must define a password.") + "<br>"
             save = False
         if self._params.get("password", "") != self._params.get(
                 "passwordBis", ""):
             self._params["msg"] += _(
                 "You must enter the same password twice.") + "<br>"
             save = False
         if not ih.isLoginFree(self._params.get("login", "")):
             self._params["msg"] += _(
                 "Sorry, the login you requested is already in use. Please choose another one."
             ) + "<br>"
             save = False
         if not self._validMail(self._params.get("email", "")):
             self._params["msg"] += _(
                 "You must enter a valid email address")
             save = False
     if save:
         #Data are OK, Now check if there is an existing user or create a new one
         ah = user.AvatarHolder()
         res = ah.match({"email": self._params["email"]},
                        exact=1,
                        forceWithoutExtAuth=True)
         if res:
             #we find a user with the same email
             a = res[0]
             #check if the user have an identity:
             if a.getIdentityList():
                 self._redirect(
                     urlHandlers.UHUserExistWithIdentity.getURL(a))
                 return
             else:
                 #create the identity to the user and send the comfirmatio email
                 _UserUtils.setUserData(a, self._params)
                 li = user.LoginInfo(self._params["login"],
                                     self._params["password"])
                 id = ih.createIdentity(li, a, "Local")
                 ih.add(id)
                 DBMgr.getInstance().commit()
                 if minfo.getModerateAccountCreation():
                     mail.sendAccountCreationModeration(a).send()
                 else:
                     mail.sendConfirmationRequest(a).send()
                     if minfo.getNotifyAccountCreation():
                         mail.sendAccountCreationNotification(a).send()
         else:
             a = user.Avatar()
             _UserUtils.setUserData(a, self._params)
             ah.add(a)
             li = user.LoginInfo(self._params["login"],
                                 self._params["password"])
             id = ih.createIdentity(li, a, "Local")
             ih.add(id)
             DBMgr.getInstance().commit()
             if minfo.getModerateAccountCreation():
                 mail.sendAccountCreationModeration(a).send()
             else:
                 mail.sendConfirmationRequest(a).send()
                 if minfo.getNotifyAccountCreation():
                     mail.sendAccountCreationNotification(a).send()
         self._redirect(urlHandlers.UHUserCreated.getURL(a))
     else:
         cp = None
         if self._params.has_key("cpEmail"):
             ph = pendingQueues.PendingQueuesHolder()
             cp = ph.getFirstPending(self._params["cpEmail"])
         if self._aw.getUser() and self._aw.getUser() in minfo.getAdminList(
         ).getList():
             p = adminPages.WPUserCreation(self, self._params, cp)
         else:
             p = adminPages.WPUserCreationNonAdmin(self, self._params, cp)
         return p.display()
コード例 #24
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testBasicAcceptation(self):
     self._abstract.setTitle("test_title")
     self._abstract.setField("content", "test_content")
     self._abstract.setContribType(self._ctPoster)
     auth1 = self._abstract.newPrimaryAuthor()
     auth1.setData(firstName="test1_fn",
                   surName="test1_sn",
                   email="test1_email",
                   affiliation="test1_af",
                   address="test1_add",
                   telephone="test1_phone",
                   fax="test1_fax",
                   title="test1_title")
     self._abstract.addSpeaker(auth1)
     auth2 = self._abstract.newCoAuthor()
     auth2.setData(firstName="test2_fn",
                   surName="test2_sn",
                   email="test2_email",
                   affiliation="test2_af",
                   address="test2_add",
                   telephone="test2_phone",
                   fax="test2_fax",
                   title="test2_title")
     #accepting an abstract for a certain track
     self._abstract.setTracks([self._track1, self._track2])
     res1 = user.Avatar()
     res1.setId("res1")
     self._abstract.accept(res1, self._track1, self._ctOral)
     #check the status is changed to accept
     status = self._abstract.getCurrentStatus()
     self.assert_(isinstance(status, review.AbstractStatusAccepted))
     #check the track
     self.assert_(status.getTrack() == self._track1)
     #check that a contribution has been created and has exactly the same
     #   data
     contrib = status.getContribution()
     self.assert_(contrib.getId() == self._abstract.getId())
     self.assert_(contrib.getConference() == self._conf)
     self.assert_(contrib.getAbstract() == self._abstract)
     self.assert_(contrib in self._conf.getContributionList())
     self.assert_(contrib.getTrack() == status.getTrack())
     self.assert_(contrib.getTitle() == "test_title")
     self.assert_(contrib.getDescription() == "test_content")
     self.assert_(contrib.getType() == self._ctOral)
     c_auth = contrib.getPrimaryAuthorList()[0]
     self.assert_(c_auth.getTitle() == auth1.getTitle())
     self.assert_(c_auth.getFirstName() == auth1.getFirstName())
     self.assert_(c_auth.getFamilyName() == auth1.getSurName())
     self.assert_(c_auth.getEmail() == auth1.getEmail())
     self.assert_(c_auth.getAffiliation() == auth1.getAffiliation())
     self.assert_(c_auth.getAddress() == auth1.getAddress())
     self.assert_(c_auth.getPhone() == auth1.getTelephone())
     self.assert_(len(contrib.getSpeakerList()) == 1)
     self.assert_(contrib.isSpeaker(c_auth))
     c_auth = contrib.getCoAuthorList()[0]
     self.assert_(c_auth.getTitle() == auth2.getTitle())
     self.assert_(c_auth.getFirstName() == auth2.getFirstName())
     self.assert_(c_auth.getFamilyName() == auth2.getSurName())
     self.assert_(c_auth.getEmail() == auth2.getEmail())
     self.assert_(c_auth.getAffiliation() == auth2.getAffiliation())
     self.assert_(c_auth.getAddress() == auth2.getAddress())
     self.assert_(c_auth.getPhone() == auth2.getTelephone())
コード例 #25
0
ファイル: testCFA.py プロジェクト: lukasnellen/indico
 def testCannotRejWithdrawn(self):
     #tests that a withdrawn abstract cannot be rejected
     self._abstract.withdraw(None, "hola")
     cm = user.Avatar()
     cm.setId("cm")
     self.assertRaises(errors.MaKaCError, self._abstract.reject, cm)