plugin XEP-0050: fix allowed_magics arg and calls to add_ad_hoc_command.
This commit is contained in:
parent
54654b65ed
commit
759ffc443b
3 changed files with 10 additions and 8 deletions
|
|
@ -44,7 +44,7 @@ class APAdHocService:
|
|||
self.xmpp_jid_node_2_ap_actor,
|
||||
"Convert XMPP JID/Node to AP actor",
|
||||
node=NS_XMPP_JID_NODE_2_AP,
|
||||
allowed_magics=C.ENTITY_ALL,
|
||||
allowed_magics=[C.ENTITY_ALL],
|
||||
)
|
||||
|
||||
async def xmpp_jid_node_2_ap_actor(
|
||||
|
|
|
|||
|
|
@ -89,28 +89,28 @@ class FileSharingManagement(object):
|
|||
self._on_change_file,
|
||||
"Change Permissions of File(s)",
|
||||
node=NS_FILE_MANAGEMENT_PERM,
|
||||
allowed_magics=C.ENTITY_ALL,
|
||||
allowed_magics=[C.ENTITY_ALL],
|
||||
)
|
||||
self._c.add_ad_hoc_command(
|
||||
client,
|
||||
self._on_delete_file,
|
||||
"Delete File(s)",
|
||||
node=NS_FILE_MANAGEMENT_DELETE,
|
||||
allowed_magics=C.ENTITY_ALL,
|
||||
allowed_magics=[C.ENTITY_ALL],
|
||||
)
|
||||
self._c.add_ad_hoc_command(
|
||||
client,
|
||||
self._on_gen_thumbnails,
|
||||
"Generate Thumbnails",
|
||||
node=NS_FILE_MANAGEMENT_THUMB,
|
||||
allowed_magics=C.ENTITY_ALL,
|
||||
allowed_magics=[C.ENTITY_ALL],
|
||||
)
|
||||
self._c.add_ad_hoc_command(
|
||||
client,
|
||||
self._on_quota,
|
||||
"Get Quota",
|
||||
node=NS_FILE_MANAGEMENT_QUOTA,
|
||||
allowed_magics=C.ENTITY_ALL,
|
||||
allowed_magics=[C.ENTITY_ALL],
|
||||
)
|
||||
|
||||
def _delete(self, service_jid_s, path, namespace, profile):
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from wokkel import disco, iwokkel, data_form
|
|||
from libervia.backend.core.i18n import _, D_
|
||||
from libervia.backend.core.constants import Const as C
|
||||
from libervia.backend.core.log import getLogger
|
||||
from libervia.backend.core.xmpp import SatXMPPClient, SatXMPPEntity
|
||||
from libervia.backend.core.core_types import SatXMPPEntity
|
||||
from libervia.backend.core import exceptions
|
||||
from libervia.backend.memory.memory import Sessions
|
||||
from libervia.backend.tools import xml_tools, utils
|
||||
|
|
@ -352,7 +352,7 @@ class XEP_0050:
|
|||
session_id=None,
|
||||
form_values=None,
|
||||
timeout=30,
|
||||
):
|
||||
) -> defer.Deferred[domish.Element]:
|
||||
"""Do an Ad-Hoc Command
|
||||
|
||||
@param entity(jid.JID): entity which will execture the command
|
||||
|
|
@ -760,7 +760,7 @@ class XEP_0050:
|
|||
|
||||
def add_ad_hoc_command(
|
||||
self,
|
||||
client: SatXMPPClient,
|
||||
client: SatXMPPEntity,
|
||||
callback: Callable,
|
||||
label: str,
|
||||
node: str | None = None,
|
||||
|
|
@ -814,6 +814,8 @@ class XEP_0050:
|
|||
allowed_groups = []
|
||||
if allowed_magics is None:
|
||||
allowed_magics = [C.ENTITY_PROFILE_BARE]
|
||||
elif isinstance(allowed_magics, str):
|
||||
raise exceptions.InternalError("Allowed magic must be a list of strings!")
|
||||
if forbidden_jids is None:
|
||||
forbidden_jids = []
|
||||
if forbidden_groups is None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue