Changeset

9098:d5bc306e93aa

util.pubsub: Look for a configured callback for more complicated access models
author Kim Alvefur <zash@zash.se>
date Sat, 04 Aug 2018 03:04:00 +0200
parents 9097:ce2ba9f91c84
children 9099:974b25c27f24
files util/pubsub.lua
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/pubsub.lua	Sat Aug 04 03:38:55 2018 +0200
+++ b/util/pubsub.lua	Sat Aug 04 03:04:00 2018 +0200
@@ -121,6 +121,16 @@
 	elseif access_model == "whitelist" then
 		return "none";
 	end
+
+	if self.config.access_models then
+		local check = self.config.access_models[access_model];
+		if check then
+			local aff = check(actor);
+			if aff then
+				return aff;
+			end
+		end
+	end
 end
 
 function service:set_affiliation(node, actor, jid, affiliation)