Mercurial > libervia-web
annotate libervia/server/restricted_bridge.py @ 1329:ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
the cache is put in local storage and linked to a session.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 14 Aug 2020 09:31:32 +0200 |
parents | 991ff12241e0 |
children | fe353fceec38 |
rev | line source |
---|---|
1287 | 1 #!/usr/bin/env python3 |
2 | |
3 # Libervia: a SàT frontend | |
4 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org) | |
5 | |
6 # This program is free software: you can redistribute it and/or modify | |
7 # it under the terms of the GNU Affero General Public License as published by | |
8 # the Free Software Foundation, either version 3 of the License, or | |
9 # (at your option) any later version. | |
10 | |
11 # This program is distributed in the hope that it will be useful, | |
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 # GNU Affero General Public License for more details. | |
15 | |
16 # You should have received a copy of the GNU Affero General Public License | |
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | |
19 from libervia.server.constants import Const as C | |
20 | |
21 | |
22 class RestrictedBridge: | |
23 """Bridge with limited access, which can be used in browser | |
24 | |
25 Only a few method are implemented, with potentially dangerous argument controlled. | |
26 Security limit is used | |
27 """ | |
28 | |
29 def __init__(self, host): | |
30 self.host = host | |
31 self.security_limit = C.SECURITY_LIMIT | |
32 | |
1329
ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents:
1315
diff
changeset
|
33 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
|
34 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
|
35 |
ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents:
1315
diff
changeset
|
36 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
|
37 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
|
38 "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
|
39 |
ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents:
1315
diff
changeset
|
40 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
|
41 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
|
42 "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
|
43 |
ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents:
1315
diff
changeset
|
44 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
|
45 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
|
46 "identitiesBaseGet", profile) |
ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents:
1315
diff
changeset
|
47 |
1287 | 48 async def fileHTTPUploadGetSlot( |
49 self, filename, size, content_type, upload_jid, profile): | |
50 return await self.host.bridgeCall( | |
51 "fileHTTPUploadGetSlot", filename, size, content_type, | |
52 upload_jid, profile) | |
1295
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
53 |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
54 async def fileSharingDelete( |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
55 self, service_jid, path, namespace, profile): |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
56 return await self.host.bridgeCall( |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
57 "fileSharingDelete", service_jid, path, namespace, profile) |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
58 |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
59 async def interestRetract( |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
60 self, service_jid, item_id, profile |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
61 ): |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
62 return await self.host.bridgeCall( |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
63 "interestRetract", service_jid, item_id, profile) |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
64 |
1315
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
65 async def FISInvite( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
66 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
|
67 profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
68 ): |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
69 return await self.host.bridgeCall( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
70 "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
|
71 extra_s, profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
72 ) |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
73 |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
74 async def FISAffiliationsSet( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
75 self, service_s, namespace, path, affiliations, profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
76 ): |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
77 return await self.host.bridgeCall( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
78 "FISAffiliationsSet", service_s, namespace, path, affiliations, profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
79 ) |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
80 |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
81 async def invitationSimpleCreate(self, invitee_email, url_template, extra_s, profile): |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
82 return await self.host.bridgeCall( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
83 "invitationSimpleCreate", invitee_email, url_template, extra_s, profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
84 ) |