annotate libervia/server/restricted_bridge.py @ 1505:a169cbc315f0

server: don't wait anymore for libervia app to be fully started: following change in backend, libervia app are started and the loading workflow continue immediately, the proxy is created only when the app is known to be actually started (through the `application_started` signal or a flag received when starting the application). This avoid stopping the loading of website for a long time, or breaking when a timeout is reached.
author Goffi <goffi@goffi.org>
date Sat, 04 Mar 2023 18:37:17 +0100
parents e739600267cd
children 106bae41f5c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1287
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/env python3
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
2
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3 # Libervia: a SàT frontend
1396
822bd0139769 date update
Goffi <goffi@goffi.org>
parents: 1391
diff changeset
4 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
1287
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
5
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # This program is free software: you can redistribute it and/or modify
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # it under the terms of the GNU Affero General Public License as published by
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # the Free Software Foundation, either version 3 of the License, or
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # (at your option) any later version.
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # This program is distributed in the hope that it will be useful,
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # GNU Affero General Public License for more details.
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16 # You should have received a copy of the GNU Affero General Public License
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
18
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
19 from sat.tools.common import data_format
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
20 from sat.core import exceptions
1287
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 from libervia.server.constants import Const as C
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
23
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
24 class RestrictedBridge:
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
25 """Bridge with limited access, which can be used in browser
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
26
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
27 Only a few method are implemented, with potentially dangerous argument controlled.
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 Security limit is used
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
29 """
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
30
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
31 def __init__(self, host):
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
32 self.host = host
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
33 self.security_limit = C.SECURITY_LIMIT
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
34
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
35 def noServiceProfile(self, profile):
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
36 """Raise an error if service profile is used"""
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
37 if profile == C.SERVICE_PROFILE:
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
38 raise exceptions.PermissionError(
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
39 "This action is not allowed for service profile"
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
40 )
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
41
1329
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
42 async def getContacts(self, profile):
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
43 return await self.host.bridgeCall("getContacts", profile)
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
44
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
45 async def identityGet(self, entity, metadata_filter, use_cache, profile):
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
46 return await self.host.bridgeCall(
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
47 "identityGet", entity, metadata_filter, use_cache, profile)
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
48
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
49 async def identitiesGet(self, entities, metadata_filter, profile):
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
50 return await self.host.bridgeCall(
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
51 "identitiesGet", entities, metadata_filter, profile)
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
52
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
53 async def identitiesBaseGet(self, profile):
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
54 return await self.host.bridgeCall(
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
55 "identitiesBaseGet", profile)
ed28ad7d484c browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents: 1315
diff changeset
56
1379
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
57 async def psNodeDelete(self, service_s, node, profile):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
58 self.noServiceProfile(profile)
1379
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
59 return await self.host.bridgeCall(
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
60 "psNodeDelete", service_s, node, profile)
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
61
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
62 async def psNodeAffiliationsSet(self, service_s, node, affiliations, profile):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
63 self.noServiceProfile(profile)
1379
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
64 return await self.host.bridgeCall(
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
65 "psNodeAffiliationsSet", service_s, node, affiliations, profile)
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
66
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
67 async def psItemRetract(self, service_s, node, item_id, notify, profile):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
68 self.noServiceProfile(profile)
1379
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
69 return await self.host.bridgeCall(
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
70 "psItemRetract", service_s, node, item_id, notify, profile)
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
71
1414
97b8ce9ce54b server (restricted_bridge): add mbPreview
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
72 async def mbPreview(self, service_s, node, data, profile):
97b8ce9ce54b server (restricted_bridge): add mbPreview
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
73 return await self.host.bridgeCall(
97b8ce9ce54b server (restricted_bridge): add mbPreview
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
74 "mbPreview", service_s, node, data, profile)
97b8ce9ce54b server (restricted_bridge): add mbPreview
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
75
1391
fc20818a5266 server (restricted_bridge): add `listSet` method
Goffi <goffi@goffi.org>
parents: 1379
diff changeset
76 async def listSet(self, service_s, node, values, schema, item_id, extra, profile):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
77 self.noServiceProfile(profile)
1391
fc20818a5266 server (restricted_bridge): add `listSet` method
Goffi <goffi@goffi.org>
parents: 1379
diff changeset
78 return await self.host.bridgeCall(
fc20818a5266 server (restricted_bridge): add `listSet` method
Goffi <goffi@goffi.org>
parents: 1379
diff changeset
79 "listSet", service_s, node, values, "", item_id, "", profile)
fc20818a5266 server (restricted_bridge): add `listSet` method
Goffi <goffi@goffi.org>
parents: 1379
diff changeset
80
fc20818a5266 server (restricted_bridge): add `listSet` method
Goffi <goffi@goffi.org>
parents: 1379
diff changeset
81
1287
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
82 async def fileHTTPUploadGetSlot(
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
83 self, filename, size, content_type, upload_jid, profile):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
84 self.noServiceProfile(profile)
1287
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
85 return await self.host.bridgeCall(
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
86 "fileHTTPUploadGetSlot", filename, size, content_type,
1f26d8c2afc1 server: restricted_bridge first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
87 upload_jid, profile)
1295
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
88
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
89 async def fileSharingDelete(
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
90 self, service_jid, path, namespace, profile):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
91 self.noServiceProfile(profile)
1295
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
92 return await self.host.bridgeCall(
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
93 "fileSharingDelete", service_jid, path, namespace, profile)
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
94
1350
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
95 async def interestsRegisterFileSharing(
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
96 self, service, repos_type, namespace, path, name, extra_s, profile
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
97 ):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
98 self.noServiceProfile(profile)
1350
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
99 if extra_s:
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
100 # we only allow "thumb_url" here
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
101 extra = data_format.deserialise(extra_s)
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
102 if "thumb_url" in extra:
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
103 extra_s = data_format.serialise({"thumb_url": extra["thumb_url"]})
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
104 else:
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
105 extra_s = ""
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
106
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
107 return await self.host.bridgeCall(
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
108 "interestsRegisterFileSharing", service, repos_type, namespace, path, name,
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
109 extra_s, profile
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
110 )
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
111
1295
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
112 async def interestRetract(
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
113 self, service_jid, item_id, profile
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
114 ):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
115 self.noServiceProfile(profile)
1295
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
116 return await self.host.bridgeCall(
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
117 "interestRetract", service_jid, item_id, profile)
0930b06f022f server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents: 1287
diff changeset
118
1379
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
119 async def psInvite(
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
120 self, invitee_jid_s, service_s, node, item_id, name, extra_s, profile
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
121 ):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
122 self.noServiceProfile(profile)
1379
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
123 return await self.host.bridgeCall(
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
124 "psInvite", invitee_jid_s, service_s, node, item_id, name, extra_s, profile
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
125 )
4c51f22a813a server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents: 1350
diff changeset
126
1315
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
127 async def FISInvite(
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
128 self, invitee_jid_s, service_s, repos_type, namespace, path, name, extra_s,
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
129 profile
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
130 ):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
131 self.noServiceProfile(profile)
1350
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
132 if extra_s:
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
133 # we only allow "thumb_url" here
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
134 extra = data_format.deserialise(extra_s)
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
135 if "thumb_url" in extra:
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
136 extra_s = data_format.serialise({"thumb_url": extra["thumb_url"]})
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
137 else:
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
138 extra_s = ""
a32f3f47e4a8 server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents: 1331
diff changeset
139
1315
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
140 return await self.host.bridgeCall(
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
141 "FISInvite", invitee_jid_s, service_s, repos_type, namespace, path, name,
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
142 extra_s, profile
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
143 )
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
144
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
145 async def FISAffiliationsSet(
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
146 self, service_s, namespace, path, affiliations, profile
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
147 ):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
148 self.noServiceProfile(profile)
1315
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
149 return await self.host.bridgeCall(
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
150 "FISAffiliationsSet", service_s, namespace, path, affiliations, profile
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
151 )
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
152
1331
fe353fceec38 browser (invitation, photos/album): invitation manager improvments:
Goffi <goffi@goffi.org>
parents: 1329
diff changeset
153 async def invitationSimpleCreate(
fe353fceec38 browser (invitation, photos/album): invitation manager improvments:
Goffi <goffi@goffi.org>
parents: 1329
diff changeset
154 self, invitee_email, invitee_name, url_template, extra_s, profile
fe353fceec38 browser (invitation, photos/album): invitation manager improvments:
Goffi <goffi@goffi.org>
parents: 1329
diff changeset
155 ):
1480
e739600267cd server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents: 1414
diff changeset
156 self.noServiceProfile(profile)
1315
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
157 return await self.host.bridgeCall(
1331
fe353fceec38 browser (invitation, photos/album): invitation manager improvments:
Goffi <goffi@goffi.org>
parents: 1329
diff changeset
158 "invitationSimpleCreate", invitee_email, invitee_name, url_template, extra_s,
fe353fceec38 browser (invitation, photos/album): invitation manager improvments:
Goffi <goffi@goffi.org>
parents: 1329
diff changeset
159 profile
1315
991ff12241e0 server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents: 1295
diff changeset
160 )