util.pubsub: Add support for a config validation function
authorMatthew Wild <mwild1@gmail.com>
Wed, 01 Aug 2018 19:18:07 +0100
changeset 9078 46d4322f7eed
parent 9077 0462405b1cfb
child 9079 00d89430d77e
util.pubsub: Add support for a config validation function
util/pubsub.lua
--- a/util/pubsub.lua	Wed Aug 01 19:08:09 2018 +0100
+++ b/util/pubsub.lua	Wed Aug 01 19:18:07 2018 +0100
@@ -542,6 +542,13 @@
 		return false, "item-not-found";
 	end
 
+	if self.config.check_node_config then
+		local ok = self.config.check_node_config(node, actor, new_config);
+		if not ok then
+			return false, "not-acceptable";
+		end
+	end
+
 	local old_config = node_obj.config;
 	node_obj.config = setmetatable(new_config, {__index=self.node_defaults});