Exemple #1
0
def localIdentityMigration(dbi, withRBDB, prevVersion):
    """Generate the new password with a salt"""

    auth = LocalAuthenticator()
    total = len(auth.getList())
    for i, identity in enumerate(auth.getList()):
        print '\r  Processing %d/%d' % (i + 1, total),
        if not hasattr(identity, 'algorithm'):
            identity.setPassword(identity.password)
        if i % 1000 == 999:
            dbi.commit()
    print
    dbi.commit()
Exemple #2
0
def localIdentityMigration(dbi, withRBDB, prevVersion):
    """Generate the new password with a salt"""

    auth = LocalAuthenticator()
    total = len(auth.getList())
    for i, identity in enumerate(auth.getList()):
        print '\r  Processing %d/%d' % (i + 1, total),
        if not hasattr(identity, 'algorithm'):
            identity.setPassword(identity.password)
        if i % 1000 == 999:
            dbi.commit()
    print
    dbi.commit()
 def __init__(self):
     
     self.AuthenticatorList = []
     config = Config.getInstance()
     for  auth in config.getAuthenticatorList():
         if auth == "Local":
             self.AuthenticatorList.append( LocalAuthenticator() )
         if auth == "Nice":
             from MaKaC.authentication.NiceAuthentication import NiceAuthenticator
             self.AuthenticatorList.append( NiceAuthenticator() )
     self.create = True
from indico.core.db import DBMgr
DBMgr.getInstance().startRequest()

from MaKaC.user import AvatarHolder

ah = AvatarHolder()
#migrate dict to list
for av in ah.getValuesToList():
    if not isinstance(av.identities, list):
        av.identities = av.identities.values()

from MaKaC.authentication.NiceAuthentication import NiceAuthenticator, NiceIdentity
na = NiceAuthenticator()
from MaKaC.authentication.LocalAuthentication import LocalAuthenticator
la = LocalAuthenticator()


#sync authenticators identities to avatars identity list
for id in la.getValuesToList():
    u = id.getUser()
    if not id in u.getIdentityList():
        try:
            u.addIdentity(id)
        except:
            print u.getId()

for id in na.getValuesToList():
    u = id.getUser()
    if not id in u.getIdentityList():
        try:
from MaKaC.common import DBMgr
DBMgr.getInstance().startRequest()

from MaKaC.user import AvatarHolder

ah = AvatarHolder()
#migrate dict to list
for av in ah.getValuesToList():
    if not isinstance(av.identities, list):
        av.identities = av.identities.values()

from MaKaC.authentication.NiceAuthentication import NiceAuthenticator, NiceIdentity
na = NiceAuthenticator()
from MaKaC.authentication.LocalAuthentication import LocalAuthenticator
la = LocalAuthenticator()

#sync authenticators identities to avatars identity list
for id in la.getValuesToList():
    u = id.getUser()
    if not id in u.getIdentityList():
        try:
            u.addIdentity(id)
        except:
            print u.getId()

for id in na.getValuesToList():
    u = id.getUser()
    if not id in u.getIdentityList():
        try:
            u.addIdentity(id)