Modification de la récupération d'un utilisateur GLPI
This commit is contained in:
@ -204,7 +204,7 @@ for device in devices:
|
||||
loggerDouble.error(f"{count} devices matching airwatch device {device.FriendlyName} (Airwatch id={device.Id}) in GLPI (GLPI ids = {', '.join(deviceID)}), skipping this device...")
|
||||
continue
|
||||
if(count == 0):
|
||||
deviceIDTrash, dataTrash, countTrash = glpiapi.GetDevice(device, trashbin=True)
|
||||
deviceIDTrash, dataTrash, countTrash = glpiapi.GetDevice(device)
|
||||
if(countTrash > 1):
|
||||
loggerDouble.error(f"{countTrash} devices matching airwatch device {device.FriendlyName} (Airwatch id={device.Id}) in GLPI trashbin (GLPI ids = {', '.join(deviceIDTrash)}), skipping this device...")
|
||||
elif(countTrash == 1):
|
||||
@ -230,9 +230,11 @@ for device in devices:
|
||||
logger.info(f"Updating {deviceID} on GLPI")
|
||||
glpiapi.UpdateInventory(inventory.Json())
|
||||
|
||||
#if(data['70'] == None and device.User != settings["AIRWATCH"]["StagingUser"]):
|
||||
#logger.info(f"Updating user from {data['70']} to {device.User} in GLPI (id={deviceID})")
|
||||
#glpiapi.UpdateUser(deviceID, device.User)
|
||||
if(data['70'] == None and device.User != settings["AIRWATCH"]["StagingUser"]):
|
||||
userID, userData, userCount = glpiapi.GetUser(device.User)
|
||||
if(userCount == 1):
|
||||
logger.info(f"Updating user from {data['70']} to {device.User} in GLPI (id={deviceID})")
|
||||
glpiapi.UpdateUser(deviceID, userID)
|
||||
|
||||
if(data['5'] != device.SerialNumber):
|
||||
logger.info(f"Updating serial number from {data['5']} to {device.SerialNumber} in GLPI (id={deviceID})")
|
||||
|
||||
Reference in New Issue
Block a user