plugin comp file sharing: file sharing management first draft:

the new "component file sharing management" plugin add ad-hoc commands to changes permission of one or several shared files, delete one or more files, or regenerate thumbnails.
This is a temporary plugin to make file sharing through a component usable with other entities, but should be removed (at least permission management and file deletion) in the future if we move on a pubsub based solution.
This commit is contained in:
Goffi 2019-04-28 09:00:51 +02:00
commit 1dd3518943

View file

@ -44,6 +44,7 @@ PLUGIN_INFO = {
C.PI_PROTOCOLS: [],
C.PI_DEPENDENCIES: [
"FILE",
"FILE_SHARING_MANAGEMENT",
"XEP-0231",
"XEP-0234",
"XEP-0260",
@ -219,6 +220,9 @@ class FileSharing(object):
# we only use the first found file
found_file = found_files[0]
if found_file[u'type'] != C.FILE_TYPE_FILE:
raise TypeError(u"a file was expected, type is {type_}".format(
type_=found_file[u'type']))
file_hash = found_file[u"file_hash"]
file_path = os.path.join(self.files_path, file_hash)
file_data[u"hash_hasher"] = hasher = self._h.getHasher(found_file[u"hash_algo"])