コード例 #1
0
ファイル: loginservice.py プロジェクト: cash2one/gncloud
def createteam_list(user_id, team_name, team_code, author_id, sql_session):
    if (sql_session.query(GnTeam).filter(
            GnTeam.team_name == team_name).one_or_none() == None):
        if (sql_session.query(GnTeam).filter(
                GnTeam.team_code == team_code).one_or_none() == None):
            vm = GnTeam(
                team_code=team_code,
                team_name=team_name,
                author_id=author_id,
                cpu_quota=4,
                mem_quota=4294967296,
                disk_quota=42949672960,
                create_date=datetime.datetime.now().strftime('%Y%m%d%H%M%S'))
            tm = GnUserTeam(
                user_id=user_id,
                team_code=team_code,
                comfirm='Y',
                apply_date=datetime.datetime.now().strftime('%Y%m%d%H%M%S'),
                approve_date=datetime.datetime.now().strftime('%Y%m%d%H%M%S'),
                team_owner='owner')
            db_session.add(vm)
            db_session.add(tm)
            db_session.commit()
            return 'success'
        else:
            return 'team_code'
    else:
        return 'team_name'
コード例 #2
0
ファイル: loginservice.py プロジェクト: cash2one/gncloud
def teamsignup_list(comfirm, user_id):
    if (comfirm == 'N'):
        com = db_session.query(GnUserTeam).filter(
            GnUserTeam.user_id == user_id).all()
        com.comfirm = 'Y'
        db_session.commit()
    return 1
コード例 #3
0
ファイル: loginservice.py プロジェクト: cash2one/gncloud
def signup_team(team_code, user_id, sql_session):
    list = sql_session.query(GnUserTeam).filter(
        GnUserTeam.user_id == user_id).one_or_none()
    if (list == None):
        vm = GnUserTeam(
            user_id=user_id,
            team_code=team_code,
            comfirm='N',
            apply_date=datetime.datetime.now().strftime('%Y%m%d%H%M%S'),
            team_owner='user')
        db_session.add(vm)
        db_session.commit()
        return 1
    return 2
コード例 #4
0
ファイル: loginservice.py プロジェクト: cash2one/gncloud
def select_putsys(team_name, team_code, team_cpu, team_memory,
                  team_disk):  #팀 시스템 수정 / cpu / memory / disk
    lit = db_session.query(GnTeam).filter(GnTeam.team_code == team_code).one()
    try:
        if team_name != "":
            lit.team_name = team_name
        if team_cpu != "":
            lit.cpu_quota = team_cpu
        if team_memory != "":
            lit.mem_quota = convertsize(team_memory)
        if team_disk != "":
            lit.disk_quota = convertsize(team_disk)
        db_session.commit()
        return True
    except:
        return False
コード例 #5
0
ファイル: loginservice.py プロジェクト: cash2one/gncloud
def sign_up(user_name, user_id, password, password_re):
    check = db_session.query(GnUser).filter(
        GnUser.user_id == user_id).one_or_none()
    if (password == password_re):
        if (check == None):
            password_sha = convertToHashValue(password_re)
            sign_up_info = GnUser(
                user_id=user_id,
                password=password_sha,
                user_name=user_name,
                tel="-",
                email="-",
                start_date=datetime.datetime.now().strftime('%Y%m%d%H%M%S'))
            db_session.add(sign_up_info)
            db_session.commit()
            return 'success'
        else:
            return 'user_id'
    else:
        return 'password'
コード例 #6
0
ファイル: loginservice.py プロジェクト: cash2one/gncloud
def select_put(team_name, team_code):  #팀 수정
    lit = db_session.query(GnTeam).filter(GnTeam.team_code == team_code).one()
    lit.team_name = team_name
    db_session.commit()
    return True
コード例 #7
0
ファイル: loginservice.py プロジェクト: cash2one/gncloud
def team_delete(id, code):
    db_session.query(GnUserTeam).filter(GnUserTeam.user_id == id).filter(
        GnUserTeam.team_code == code).delete()
    db_session.commit()
    return True