diff options
author | Kim Alvefur <zash@zash.se> | 2018-06-26 19:30:28 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-06-26 19:30:28 +0200 |
commit | db95257fa21e403d04719e2dc0b9478b426a7c13 (patch) | |
tree | a14730dbc56594c29d19b412cbbe0757415c54f9 /plugins/mod_pubsub | |
parent | 2a848b980a182a5155c6e6e6f19ca68cc48cfaf3 (diff) | |
download | prosody-db95257fa21e403d04719e2dc0b9478b426a7c13.tar.gz prosody-db95257fa21e403d04719e2dc0b9478b426a7c13.zip |
mod_pubsub: Boilerplate checks for affiliation retrieval
Diffstat (limited to 'plugins/mod_pubsub')
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index c9ebfdb4..b030abbd 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -454,10 +454,26 @@ function handlers.owner_get_default(origin, stanza, default, service) -- luachec return true; end ---[[ TODO function handlers.owner_get_affiliations(origin, stanza, affiliations, service) + local node = affiliations.attr.node; + if not node then + origin.send(pubsub_error_reply(stanza, "nodeid-required")); + return true; + end + if not service:may(node, stanza.attr.from, "set_affiliation") then + origin.send(pubsub_error_reply(stanza, "forbidden")); + return true; + end + + local reply = st.reply(stanza) + :tag("pubsub", { xmlns = xmlns_pubsub_owner }) + :tag("affiliations", { node = node }); + + origin.send(reply); + return true; end +--[[ TODO function handlers.owner_set_affiliations(origin, stanza, affiliations, service) end --]] |