From bf88bf5c59e1112b049e8bacd0b1f6f2d63e064c Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Tue, 22 May 2018 01:32:44 +0200
Subject: util.pubsub: Also check for affiliation set on bare JID

This fixes eg publishing from a full JID when the affiliation has been
set on the bare JID, as would be common in XMPP.
---
 util/pubsub.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'util')

diff --git a/util/pubsub.lua b/util/pubsub.lua
index 7cf376ef..86dd8e14 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -75,7 +75,8 @@ function service:may(node, actor, action)
 	if actor == true then return true; end
 
 	local node_obj = self.nodes[node];
-	local node_aff = node_obj and node_obj.affiliations[actor];
+	local node_aff = node_obj and (node_obj.affiliations[actor]
+	              or node_obj.affiliations[self.config.normalize_jid(actor)]);
 	local service_aff = self.affiliations[actor]
 	                 or self.config.get_affiliation(actor, node, action)
 	                 or "none";
-- 
cgit v1.2.3