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
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
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
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