Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0329.py @ 3365:626046010a2d
plugin XEP-0329: fix filtering by owner on components
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 20 Sep 2020 11:03:24 +0200 |
parents | 02583a401e51 |
children | e09cb08166a3 |
comparison
equal
deleted
inserted
replaced
3364:d24252df91ee | 3365:626046010a2d |
---|---|
731 return files | 731 return files |
732 | 732 |
733 # affiliations # | 733 # affiliations # |
734 | 734 |
735 async def _parseElement(self, client, iq_elt, element, namespace): | 735 async def _parseElement(self, client, iq_elt, element, namespace): |
736 from_jid = jid.JID(iq_elt['from']) | 736 peer_jid, owner = self._compParseJids(client, iq_elt) |
737 elt = next(iq_elt.elements(namespace, element)) | 737 elt = next(iq_elt.elements(namespace, element)) |
738 path = Path("/", elt['path']) | 738 path = Path("/", elt['path']) |
739 if len(path.parts) < 2: | 739 if len(path.parts) < 2: |
740 raise RootPathException | 740 raise RootPathException |
741 namespace = elt.getAttribute('namespace') | 741 namespace = elt.getAttribute('namespace') |
742 files_data = await self.host.memory.getFiles( | 742 files_data = await self.host.memory.getFiles( |
743 client, | 743 client, |
744 peer_jid=from_jid, | 744 peer_jid=peer_jid, |
745 path=str(path.parent), | 745 path=str(path.parent), |
746 name=path.name, | 746 name=path.name, |
747 namespace=namespace, | 747 namespace=namespace, |
748 owner=owner, | |
748 ) | 749 ) |
749 if len(files_data) != 1: | 750 if len(files_data) != 1: |
750 client.sendError(iq_elt, 'item-not-found') | 751 client.sendError(iq_elt, 'item-not-found') |
751 raise exceptions.CancelError | 752 raise exceptions.CancelError |
752 file_data = files_data[0] | 753 file_data = files_data[0] |
753 return from_jid, elt, path, namespace, file_data | 754 return peer_jid, elt, path, namespace, file_data |
754 | 755 |
755 def _affiliationsGet(self, service_jid_s, namespace, path, profile): | 756 def _affiliationsGet(self, service_jid_s, namespace, path, profile): |
756 client = self.host.getClient(profile) | 757 client = self.host.getClient(profile) |
757 service = jid.JID(service_jid_s) | 758 service = jid.JID(service_jid_s) |
758 d = defer.ensureDeferred(self.affiliationsGet( | 759 d = defer.ensureDeferred(self.affiliationsGet( |