Mercurial > libervia-web
annotate libervia/server/restricted_bridge.py @ 1315:991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 Aug 2020 16:47:24 +0200 |
parents | 0930b06f022f |
children | ed28ad7d484c |
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 | |
33 async def fileHTTPUploadGetSlot( | |
34 self, filename, size, content_type, upload_jid, profile): | |
35 return await self.host.bridgeCall( | |
36 "fileHTTPUploadGetSlot", filename, size, content_type, | |
37 upload_jid, profile) | |
1295
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
38 |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
39 async def fileSharingDelete( |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
40 self, service_jid, path, namespace, profile): |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
41 return await self.host.bridgeCall( |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
42 "fileSharingDelete", service_jid, path, namespace, profile) |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
43 |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
44 async def interestRetract( |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
45 self, service_jid, item_id, profile |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
46 ): |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
47 return await self.host.bridgeCall( |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
48 "interestRetract", service_jid, item_id, profile) |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
49 |
1315
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
50 async def FISInvite( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
51 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
|
52 profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
53 ): |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
54 return await self.host.bridgeCall( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
55 "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
|
56 extra_s, profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
57 ) |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
58 |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
59 async def FISAffiliationsSet( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
60 self, service_s, namespace, path, affiliations, profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
61 ): |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
62 return await self.host.bridgeCall( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
63 "FISAffiliationsSet", service_s, namespace, path, affiliations, profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
64 ) |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
65 |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
66 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
|
67 return await self.host.bridgeCall( |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
68 "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
|
69 ) |