aboutsummaryrefslogtreecommitdiffstats
path: root/util/pubsub.lua
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
commitae8176a49c9d055e72027dcf44adbe90feb4999b (patch)
tree21678df5f8b2199e2f3fb31cd99fb2c0721d2cc7 /util/pubsub.lua
parentffb3f9db908b246645d09f2768a5a390df1cba74 (diff)
downloadprosody-ae8176a49c9d055e72027dcf44adbe90feb4999b.tar.gz
prosody-ae8176a49c9d055e72027dcf44adbe90feb4999b.zip
util.pubsub: Re-check all subscriptions on access_model change, unsubscribing those no longer allowed
Diffstat (limited to 'util/pubsub.lua')
-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