plugins invitation, invitation-file: adapt service JID and affiliation:

if the user part of the service is missing while creating and invitation, it's added
because using only the domain will lead to a different repository depending on the
requester. In addition, the invitee is added to the repostiroy path as a member, to be
sure he/she can access it.
This commit is contained in:
Goffi 2020-08-01 16:24:03 +02:00
commit 9ee767d0cb

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python3
# SAT plugin to detect language (experimental)
# SàT plugin to send invitations for file sharing
# Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
# This program is free software: you can redistribute it and/or modify
@ -40,7 +39,7 @@ PLUGIN_INFO = {
}
class FileSharingInvitation(object):
class FileSharingInvitation:
def __init__(self, host):
log.info(_("File Sharing Invitation plugin initialization"))
@ -53,6 +52,7 @@ class FileSharingInvitation(object):
in_sign="ssssssss",
out_sign="",
method=self._sendFileSharingInvitation,
async_=True
)
def _sendFileSharingInvitation(
@ -62,10 +62,12 @@ class FileSharingInvitation(object):
invitee_jid = jid.JID(invitee_jid_s)
service = jid.JID(service_s)
extra = data_format.deserialise(extra_s)
return self.host.plugins["INVITATION"].sendFileSharingInvitation(
client, invitee_jid, service, repos_type=repos_type or None,
namespace=namespace or None, path=path or None, name=name or None,
extra=extra)
return defer.ensureDeferred(
self.host.plugins["INVITATION"].sendFileSharingInvitation(
client, invitee_jid, service, repos_type=repos_type or None,
namespace=namespace or None, path=path or None, name=name or None,
extra=extra)
)
def onInvitation(self, client, name, extra, service, repos_type, namespace, path):
if repos_type == "files":