Software / code / prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
| 3927:1b57e83266f0 | 3928:4dfb345e33ec |
|---|---|
| 240 end | 240 end |
| 241 -- | 241 -- |
| 242 return true, self.nodes; | 242 return true, self.nodes; |
| 243 end | 243 end |
| 244 | 244 |
| 245 -- Access models only affect 'none' affiliation caps, service/default access level... | |
| 246 function service:set_node_capabilities(node, actor, capabilities) | |
| 247 -- Access checking | |
| 248 if not self:may(node, actor, "configure") then | |
| 249 return false, "forbidden"; | |
| 250 end | |
| 251 -- | |
| 252 local node_obj = self.nodes[node]; | |
| 253 if not node_obj then | |
| 254 return false, "item-not-found"; | |
| 255 end | |
| 256 node_obj.capabilities = capabilities; | |
| 257 return true; | |
| 258 end | |
| 259 | |
| 245 return _M; | 260 return _M; |