diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-08-04 21:32:24 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-08-04 21:32:24 +0100 |
commit | 43c11955313ee52f25e81f0ff68db073be2d684b (patch) | |
tree | f87d6fc002e697a0b260d5a771bd84c33c5fe91d /util/pubsub.lua | |
parent | 62fd30552e3edb6205ff748e2a87f1c54f54f88f (diff) | |
download | prosody-43c11955313ee52f25e81f0ff68db073be2d684b.tar.gz prosody-43c11955313ee52f25e81f0ff68db073be2d684b.zip |
util.pubsub: Add method to retrieve node configuration
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r-- | util/pubsub.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua index b124b115..381c449a 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -592,6 +592,27 @@ function service:set_node_config(node, actor, new_config) return true; end +function service:get_node_config(node, actor) + if not self:may(node, actor, "get_configuration") then + return false, "forbidden"; + end + + local node_obj = self.nodes[node]; + if not node_obj then + return false, "item-not-found"; + end + + local config_table = {}; + for k, v in pairs(default_node_config) do + config_table[k] = v; + end + for k, v in pairs(node_obj.config) do + config_table[k] = v; + end + + return true, config_table; +end + return { new = new; }; |