Tue, 21 Dec 2010 15:26:37 +0000
util.pubsub: Add service:set_node_capabilities()
util/pubsub.lua | file | annotate | diff | comparison | revisions |
--- 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;