aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/pubsub.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-26 19:30:28 +0200
committerKim Alvefur <zash@zash.se>2018-06-26 19:30:28 +0200
commitbddb37e08b18f8f860bfa3cf77054deb1ce00e6d (patch)
treea14730dbc56594c29d19b412cbbe0757415c54f9 /plugins/mod_pubsub/pubsub.lib.lua
parent7b5d5987aa5d429b0af88b830158fd3104ee551e (diff)
downloadprosody-bddb37e08b18f8f860bfa3cf77054deb1ce00e6d.tar.gz
prosody-bddb37e08b18f8f860bfa3cf77054deb1ce00e6d.zip
mod_pubsub: Boilerplate checks for affiliation retrieval
Diffstat (limited to 'plugins/mod_pubsub/pubsub.lib.lua')
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua18
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
--]]