Wie auch kurz schon in diesem Post von mir erwähnt, habe ich das Problem, dass der Sync-Status von Mobilgeräten nicht richtig angezeigt wird. Versand und Empfang von E-Mails funktioniert soweit.
(Community Version grommunio-admin-api-1.4.19.c40ffb3-lp153.68.1.noarch
und grommunio-sync-0.1.60-lp153.51.1.noarch
)
Das tritt bei Mailboxen auf, die sowohl frisch erstellt als auch schon mehrere Updates mitgemacht haben.
In der Admin API hab ich nun etwas gegraben - da dürfte es diese Zeile sein:
https://github.com/grommunio/admin-api/blob/b96add2d54c81f1e00ab1b959b35d63048cb2b65/endpoints/domain/users.py#L236 -
sollte aus meiner Sicht lauten: return json.loads(data)["data"]
Wahscheinlich ist es im grommunio Web ein ähnliches Problem beim lesen der JSON Struktur, hier bin ich aber nicht so weit in den Code eingestiegen.
hier auch ein 'proof of concept':
#!/usr/bin/python3
pwd = '/usr/share/grommunio-admin-api'
userID = 2
import sys, os
sys.path.insert(1, pwd)
os.chdir(pwd)
from orm.users import Users, UserDevices
from services import Service
from base64 import b64decode
import json
user = Users.query.filter(Users.ID == userID).with_entities(Users.username, Users.maildir).first()
print('Operating on {}'.format(user.username))
print(' Devices')
for device in UserDevices.query.filter(UserDevices.userID == userID).with_entities(UserDevices.deviceID, UserDevices.status):
print(' - {}: {}'.format(device.deviceID, device.status))
print(' Sync State')
props = ("deviceid", "devicetype", "useragent", "deviceuser", "firstsynctime", "lastupdatetime", "asversion")
with Service('exmdb') as exmdb:
client = exmdb.ExmdbQueries(exmdb.host, exmdb.port, user.maildir, True)
data = client.getSyncData(user.maildir, "GS-SyncState")
for device, state in data.items():
decoded_state = json.loads(b64decode(state))["data"]
stateobj = {prop: decoded_state[prop] for prop in props}
stateobj["foldersSyncable"] = len(decoded_state["contentdata"])
stateobj["foldersSynced"] = len([folder for folder in decoded_state["contentdata"].values() if 1 in folder])
stateobj["wipeStatus"] = 0
print(' - {}: {}'.format(device, stateobj))`
liefert einerseits
Traceback (most recent call last):
File "./sync_states.py", line 28, in <module>
decoded_state = json.loads(b64decode(state))["data"]["devices"][user.username]["data"]
KeyError: 'devices'
oder mit entsprechender Änderung
Sync State
- androidc1203304709: {'deviceid': 'androidc1203304709', 'devicetype': 'Android', 'useragent': 'Android-Mail/2021.10.31.408626191.Release', 'deviceuser': 'user@domain', 'firstsynctime': 1637183056, 'lastupdatetime': 1637833921, 'asversion': '14.1', 'foldersSyncable': 16, 'foldersSynced': 0, 'wipeStatus': 0}
- androidc1207721459: {'deviceid': 'androidc1207721459', 'devicetype': 'SonyH', 'useragent': 'SonyH4413/9-EAS-2.0', 'deviceuser': 'user@domain', 'firstsynctime': 1633798304, 'lastupdatetime': 1637161695, 'asversion': '14.1', 'foldersSyncable': 16, 'foldersSynced': 0, 'wipeStatus': 0}