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, "password": password,
"displayName": displayName, "displayName": displayName,
"email":email, "email":email,
"groups[]":groups "groups[]":groups,
"quota": 104857600
} }
headers = { headers = {

View File

@ -1204,15 +1204,17 @@ def getUserQuotaData(userdata):
quotadata = [int(s) for s in re.findall('<quota>(.+?)</quota>', r.text)] quotadata = [int(s) for s in re.findall('<quota>(.+?)</quota>', r.text)]
inuse = [int(s) for s in re.findall('<used>(.+?)</used>', r.text)] inuse = [int(s) for s in re.findall('<used>(.+?)</used>', r.text)]
i = int(math.floor(math.log(quotadata[0], 1024))) quotadata_value = quotadata[0]
p = math.pow(1024, i) valuequota_MB = 0
# s for textlabel counter = 0
s = round(quotadata[0] / p, 2) while(quotadata_value > 9999 or counter > 3):
quotadata_value = quotadata_value / 1024
counter += 1
valuequota_MB = round(quotadata_value, 0)
# PERCENT # PERCENT
percent = (100 / int(quotadata[0]))*int(inuse[0]) 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(valuequota_MB).split(".")[0]]
return [quotadata[0], inuse[0], str(round(percent, 0)).replace(",", "."), str(s).split(".")[0]]