diff options
author | Kim Alvefur <zash@zash.se> | 2018-08-05 19:12:49 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-08-05 19:12:49 +0200 |
commit | 4cb9ea0f698f9d8bca8cbe9f8a48139e365885da (patch) | |
tree | 5c52dde3a7db4436f4bc204522fb746c181a3ac3 | |
parent | ba1e04038eec60b1d500b3e23b9962711c39962e (diff) | |
download | prosody-4cb9ea0f698f9d8bca8cbe9f8a48139e365885da.tar.gz prosody-4cb9ea0f698f9d8bca8cbe9f8a48139e365885da.zip |
mod_pubsub: Use util.pubsub API for retrieving node config instead
Normalizes access control to the 'get_configuration' capability
Thanks pep.
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index 7c796c20..9c12572a 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -632,18 +632,12 @@ function handlers.owner_get_configure(origin, stanza, config, service) return true; end - if not service:may(node, stanza.attr.from, "configure") then - origin.send(pubsub_error_reply(stanza, "forbidden")); - return true; - end - - local node_obj = service.nodes[node]; - if not node_obj then - origin.send(pubsub_error_reply(stanza, "item-not-found")); + local ok, node_config = service:get_node_config(node, stanza.attr.from); + if not ok then + origin.send(pubsub_error_reply(stanza, node_config)); return true; end - local node_config = node_obj.config; local pubsub_form_data = config_to_xep0060(node_config); local reply = st.reply(stanza) :tag("pubsub", { xmlns = xmlns_pubsub_owner }) |