Exemple #1
0
def create_acc(tags,user,passwd,dbtagli,acclist,role):
    if len(tags)>0 and len(user)>0 and len(passwd)>0:
        account = Db_account(tags=tags,user=user,passwd=passwd,role=role)
        account.save()
    dbli = Db_name.objects.filter(dbtag__in=dbtagli)
    userli = User.objects.filter(username__in=acclist)
    for i in dbli:
        try:
            account.dbname.add(i)
        except Exception,e:
            pass
Exemple #2
0
def create_acc(tags, user, passwd, dbtagli, acclist, role):
    if len(tags) > 0 and len(user) > 0 and len(passwd) > 0:
        account = Db_account(tags=tags, user=user, passwd=passwd, role=role)
        account.save()
    dbli = Db_name.objects.filter(dbtag__in=dbtagli)
    userli = User.objects.filter(username__in=acclist)
    for i in dbli:
        try:
            account.dbname.add(i)
        except Exception, e:
            pass
Exemple #3
0
        dbname = Db_name(dbtag=newdbtag, dbname=newdbname)
        dbname.save()
        dbname.instance.add(insname)
    #for rollback
    except Exception, e:
        info = "CREATE dbname Failed!"
        if flag == 1:
            insname.delete()
        return info
    tags = newdbtag + '+p'
    py = prpcrypt()
    if len(newname_all) > 0 and len(newpass_all) > 0:
        try:
            newpass_all = py.encrypt(newpass_all)
            all_account = Db_account(tags=tags,
                                     user=newname_all,
                                     passwd=newpass_all,
                                     role='all')
            all_account.save()
            all_account.account.add(user)
            all_account.dbname.add(dbname)
        # for rollback
        except Exception, e:
            info = "CREATE Failed!"
            dbname.delete()
            if flag == 1:
                insname.delete()
            return info
    else:
        flag = 3

    if len(newname_admin) > 0 and len(newpass_admin) > 0:
Exemple #4
0
    try:
        user = User.objects.get(username=func.public_user)
        dbname = Db_name(dbtag=newdbtag,dbname=newdbname)
        dbname.save()
        dbname.instance.add(insname)
    #for rollback
    except Exception,e:
        info = "CREATE dbname Failed!"
        if flag == 1:
            insname.delete()
        return info
    tags = newdbtag + '+p'
    if len(newname_all) >0 and len(newpass_all)>0:
        try:
            all_account = Db_account(tags=tags, user=newname_all, passwd=newpass_all, role='all')
            all_account.save()
            all_account.account.add(user)
            all_account.dbname.add(dbname)
        # for rollback
        except Exception, e:
            info = "CREATE Failed!"
            dbname.delete()
            if flag == 1 :
                insname.delete()
            return info
    else :
        flag = 3

    if len(newname_admin)>0 and len(newpass_admin)>0:
        try: