This commit is contained in:
Holger Trampe 2021-10-23 14:25:15 +02:00
parent 0cce214a9b
commit ce0dd03bd7
1 changed files with 2 additions and 13 deletions

View File

@ -181,17 +181,7 @@ def getNCLoggedUserBySession(sid):
final_json = json.loads(js)
# New user login - set initial status
try:
if(final_json['ocs']['meta']['status'] == 'failure'):
nc_login_headers = {'Authorization' : 'Bearer ' + sid, 'OCS-APIREQUEST' : 'true'}
r = requests.get(settings.NEXTCLOUD_URL + "ocs/v2.php/apps/user_status/api/v1/user_status/status", headers=nc_login_headers, data={'statusType' : 'dnd'})
r = requests.get(settings.NEXTCLOUD_URL + "ocs/v2.php/apps/user_status/api/v1/user_status", headers=nc_login_headers)
xpars = xmltodict.parse(r.text)
js = json.dumps(xpars)
final_json = json.loads(js)
except:
if(final_json['ocs']['meta']['status'] == 'failure'):
nc_login_headers = {'Authorization' : 'Bearer ' + sid, 'OCS-APIREQUEST' : 'true'}
r = requests.get(settings.NEXTCLOUD_URL + "ocs/v2.php/apps/user_status/api/v1/user_status/status", headers=nc_login_headers, data={'statusType' : 'dnd'})
@ -201,6 +191,5 @@ def getNCLoggedUserBySession(sid):
js = json.dumps(xpars)
final_json = json.loads(js)
return final_json['ocs']['data']['userId']
return final_json['ocs']['data']['userId']