comparison sat/plugins/plugin_comp_file_sharing.py @ 3367:90aee1f2d07c

component file sharing: added missing `owner` filtering in `_retrieveFiles`
author Goffi <goffi@goffi.org>
date Sun, 20 Sep 2020 14:04:22 +0200
parents e3bdfecaf1b0
children be6d91572633
comparison
equal deleted inserted replaced
3366:e09cb08166a3 3367:90aee1f2d07c
52 C.PI_TYPE: C.PLUG_TYPE_ENTRY_POINT, 52 C.PI_TYPE: C.PLUG_TYPE_ENTRY_POINT,
53 C.PI_PROTOCOLS: [], 53 C.PI_PROTOCOLS: [],
54 C.PI_DEPENDENCIES: [ 54 C.PI_DEPENDENCIES: [
55 "FILE", 55 "FILE",
56 "FILE_SHARING_MANAGEMENT", 56 "FILE_SHARING_MANAGEMENT",
57 "XEP-0106",
57 "XEP-0234", 58 "XEP-0234",
58 "XEP-0260", 59 "XEP-0260",
59 "XEP-0261", 60 "XEP-0261",
60 "XEP-0264", 61 "XEP-0264",
61 "XEP-0329", 62 "XEP-0329",
516 def _retrieveFiles( 517 def _retrieveFiles(
517 self, client, session, content_data, content_name, file_data, file_elt 518 self, client, session, content_data, content_name, file_data, file_elt
518 ): 519 ):
519 """This method retrieve a file on request, and send if after checking permissions""" 520 """This method retrieve a file on request, and send if after checking permissions"""
520 peer_jid = session["peer_jid"] 521 peer_jid = session["peer_jid"]
522 owner = client.getOwnerFromJid(session['local_jid'])
521 try: 523 try:
522 found_files = yield self.host.memory.getFiles( 524 found_files = yield self.host.memory.getFiles(
523 client, 525 client,
524 peer_jid=peer_jid, 526 peer_jid=peer_jid,
525 name=file_data.get("name"), 527 name=file_data.get("name"),
526 file_hash=file_data.get("file_hash"), 528 file_hash=file_data.get("file_hash"),
527 hash_algo=file_data.get("hash_algo"), 529 hash_algo=file_data.get("hash_algo"),
528 path=file_data.get("path"), 530 path=file_data.get("path"),
529 namespace=file_data.get("namespace"), 531 namespace=file_data.get("namespace"),
532 owner=owner,
530 ) 533 )
531 except exceptions.NotFound: 534 except exceptions.NotFound:
532 found_files = None 535 found_files = None
533 except exceptions.PermissionError: 536 except exceptions.PermissionError:
534 log.warning( 537 log.warning(