Diff

util/pubsub.lua @ 3928:4dfb345e33ec

util.pubsub: Add service:set_node_capabilities()
author Matthew Wild <mwild1@gmail.com>
date Tue, 21 Dec 2010 15:26:37 +0000
parent 3917:263a133bdf5a
child 3931:6daed692264f
line wrap: on
line diff
--- a/util/pubsub.lua	Tue Dec 21 14:44:13 2010 +0000
+++ b/util/pubsub.lua	Tue Dec 21 15:26:37 2010 +0000
@@ -242,4 +242,19 @@
 	return true, self.nodes;
 end
 
+-- Access models only affect 'none' affiliation caps, service/default access level...
+function service:set_node_capabilities(node, actor, capabilities)
+	-- Access checking
+	if not self:may(node, actor, "configure") then
+		return false, "forbidden";
+	end
+	--
+	local node_obj = self.nodes[node];
+	if not node_obj then
+		return false, "item-not-found";
+	end
+	node_obj.capabilities = capabilities;
+	return true;
+end
+
 return _M;