Changeset

9075:46d4322f7eed

util.pubsub: Add support for a config validation function
author Matthew Wild <mwild1@gmail.com>
date Wed, 01 Aug 2018 19:18:07 +0100
parents 9074:0462405b1cfb
children 9076:00d89430d77e
files util/pubsub.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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});