コード例 #1
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def GetStudentsByLab(strLab):
    res = ValuesAD()
    res.Status = StatusVLAB()
    res.Values = []
    res.Status.Messages = []
    res.Status.StatusOK = True

    xcp = XCPMethods(logging=res.Status, conf=config)
    resOK = xcp.ConnectXCP()
    if not resOK:
        return res

    xcp.ReadConfs()

    xvp = XVPMethods(logging=res.Status, conf=config)
    xvp.ConnectDB()
    if not xvp.SQLConnect:
        return
    xvp.sqlCur = xvp.SQLConnect.cursor()
    pool = xcp.GetPoolName()

    for obj in xcp.GetVMsByLab(strLab):
        for user in xvp.GetUsersByVMUUIDWithoutGroups(pool, obj['uuid']):
            res.Values.append(user)

    return res
コード例 #2
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def GetUsersVM(uuid):
    res = ValuesAD()
    res.Status = StatusVLAB()
    res.Values = []
    res.Status.Messages = []
    res.Status.StatusOK = True

    xcp = XCPMethods(logging=res.Status, conf=config)
    resOK = xcp.ConnectXCP()
    if not resOK:
        return res

    xvp = XVPMethods(logging=res.Status, conf=config)
    xvp.ConnectDB()
    if not xvp.SQLConnect:
        return
    xvp.sqlCur = xvp.SQLConnect.cursor()

    objs = xcp.GetGroupsByUUID(uuid)
    if not objs:
        res.Status.StatusOK = False
        return res

    pool = xcp.GetPoolName()

    for obj in xvp.GetUsersByVMUUID(pool, uuid, objs):
        res.Values.append(obj)

    return res
コード例 #3
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def GetStudentsByLab(strLab):
    res = ValuesAD()
    res.Status = StatusVLAB()
    res.Values = []
    res.Status.Messages = []
    res.Status.StatusOK = True

    xcp = XCPMethods(logging=res.Status, conf=config)
    resOK = xcp.ConnectXCP()
    if not resOK:
        return res

    xcp.ReadConfs()

    xvp = XVPMethods(logging=res.Status, conf=config)
    xvp.ConnectDB()
    if not xvp.SQLConnect:
        return
    xvp.sqlCur = xvp.SQLConnect.cursor()
    pool = xcp.GetPoolName()

    for obj in xcp.GetVMsByLab(strLab):
        for user in xvp.GetUsersByVMUUIDWithoutGroups(pool, obj["uuid"]):
            res.Values.append(user)

    return res
コード例 #4
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def GetUsersVM(uuid):
    res = ValuesAD()
    res.Status = StatusVLAB()
    res.Values = []
    res.Status.Messages = []
    res.Status.StatusOK = True

    xcp = XCPMethods(logging=res.Status, conf=config)
    resOK = xcp.ConnectXCP()
    if not resOK:
        return res

    xvp = XVPMethods(logging=res.Status, conf=config)
    xvp.ConnectDB()
    if not xvp.SQLConnect:
        return
    xvp.sqlCur = xvp.SQLConnect.cursor()

    objs = xcp.GetGroupsByUUID(uuid)
    if not objs:
        res.Status.StatusOK = False
        return res

    pool = xcp.GetPoolName()

    for obj in xvp.GetUsersByVMUUID(pool, uuid, objs):
        res.Values.append(obj)

    return res
コード例 #5
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def GetStudentsByGroup(group):
    res = ValuesAD()
    res.Status = StatusVLAB()
    res.Values = []
    res.Status.Messages = []
    res.Status.StatusOK = True

    ad = LDAPMethods(logging=res.Status, conf=config)
    ad.InitAD()

    for obj in ad.GetAdUsers(group):
        res.Values.append(obj)

    return res
コード例 #6
0
ファイル: VLABMethod.py プロジェクト: spbstu/XCPWebService
def GetStudentsByGroup(group):
    res = ValuesAD()
    res.Status = StatusVLAB()
    res.Values = []
    res.Status.Messages = []
    res.Status.StatusOK = True

    ad = LDAPMethods(logging=res.Status, conf=config)
    ad.InitAD()

    for obj in ad.GetAdUsers(group):
        res.Values.append(obj)

    return res