Software /
code /
prosody
Changeset
3928:4dfb345e33ec
util.pubsub: Add service:set_node_capabilities()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 21 Dec 2010 15:26:37 +0000 |
parents | 3927:1b57e83266f0 |
children | 3929:7cb03d67101b |
files | util/pubsub.lua |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
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;