aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-08-06 17:04:11 +0200
committerKim Alvefur <zash@zash.se>2018-08-06 17:04:11 +0200
commit4b848862f505b78aa427ad7a8a7cf4f5be933dc2 (patch)
tree21678df5f8b2199e2f3fb31cd99fb2c0721d2cc7 /util
parent2fde1f7e5ef4c8ec179bd32ae4e3e037dec4c97d (diff)
downloadprosody-4b848862f505b78aa427ad7a8a7cf4f5be933dc2.tar.gz
prosody-4b848862f505b78aa427ad7a8a7cf4f5be933dc2.zip
util.pubsub: Re-check all subscriptions on access_model change, unsubscribing those no longer allowed
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index f9255a55..b1aad71f 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -598,6 +598,18 @@ function service:set_node_config(node, actor, new_config)
end
end
+ if old_config["access_model"] ~= node_obj.config["access_model"] then
+ for subscriber in pairs(node_obj.subscribers) do
+ if not self:may(node, subscriber, "be_subscribed") then
+ local ok, err = self:remove_subscription(node, true, subscriber);
+ if not ok then
+ node_obj.config = old_config;
+ return ok, err;
+ end
+ end
+ end
+ end
+
if old_config["persist_items"] ~= node_obj.config["persist_items"] then
self.data[node] = self.config.itemstore(self.nodes[node].config, node);
elseif old_config["max_items"] ~= node_obj.config["max_items"] then