From 5837f7565673ec5933bb4f528ee3289ea05d0744 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 21 Dec 2010 15:26:37 +0000 Subject: util.pubsub: Add service:set_node_capabilities() --- util/pubsub.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'util/pubsub.lua') diff --git a/util/pubsub.lua b/util/pubsub.lua index 1363bcb5..657dcd9a 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -242,4 +242,19 @@ function service:get_nodes(actor) 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; -- cgit v1.2.3