# HG changeset patch # User Matthew Wild # Date 1292945197 0 # Node ID 4dfb345e33ecd3f87d7d59cf3a00e86db5784b7f # Parent 1b57e83266f061d387f749949cc7e9bb129e2e51 util.pubsub: Add service:set_node_capabilities() diff -r 1b57e83266f0 -r 4dfb345e33ec util/pubsub.lua --- 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;