def cboxGetOpenFiles():
'''Returns a list of all currently opened files, for operations purposes only.
This call is protected by the same shared secret as the /wopi/cbox/open call.'''
req = flask.request
# first check if the shared secret matches ours
if 'Authorization' not in req.headers or req.headers['Authorization'] != 'Bearer ' + Wopi.ocsecret:
Wopi.log.warning('msg="cboxGetOpenFiles: unauthorized access attempt, missing authorization token" client="%s"' % req.remote_addr)
return 'Client not authorized', httplib.UNAUTHORIZED
# first convert the sets into lists, otherwise sets cannot be serialized in JSON format
jl = {}
for f in Wopi.openfiles.keys():
jl[f] = (Wopi.openfiles[f][0], tuple(Wopi.openfiles[f][1]))
# dump the current list of opened files in JSON format
Wopi.log.info('msg="cboxGetOpenFiles: returning list of open files" client="%s"' % req.remote_addr)
return flask.Response(json.dumps(jl), mimetype='application/json')
#
# The WOPI protocol implementation starts here
#
评论列表
文章目录