newuserdata

This commit is contained in:
Holger Trampe 2021-10-22 18:38:41 +02:00
parent 6cfba1a083
commit 40a19424ca
3 changed files with 12 additions and 9 deletions

View File

@ -235,7 +235,8 @@ def NCAddUser(request):
"password": password,
"displayName": displayName,
"email":email,
"groups[]":groups
"groups[]":groups,
"quota": 104857600
}
headers = {

View File

@ -1203,16 +1203,18 @@ def getUserQuotaData(userdata):
quotadata = [int(s) for s in re.findall('<quota>(.+?)</quota>', r.text)]
inuse = [int(s) for s in re.findall('<used>(.+?)</used>', r.text)]
i = int(math.floor(math.log(quotadata[0], 1024)))
p = math.pow(1024, i)
# s for textlabel
s = round(quotadata[0] / p, 2)
quotadata_value = quotadata[0]
valuequota_MB = 0
counter = 0
while(quotadata_value > 9999 or counter > 3):
quotadata_value = quotadata_value / 1024
counter += 1
valuequota_MB = round(quotadata_value, 0)
# PERCENT
percent = (100 / int(quotadata[0]))*int(inuse[0])
# TODO: Hier werden GB nicht korrekt umgerechnet in MB
return [quotadata[0], inuse[0], str(round(percent, 0)).replace(",", "."), str(s).split(".")[0]]
return [quotadata[0], inuse[0], str(round(percent, 0)).replace(",", "."), str(valuequota_MB).split(".")[0]]