Comparison

plugins/mod_pubsub/pubsub.lib.lua @ 8933:6d3ecf9e8277

mod_pubsub: Boilerplate checks for affiliation retrieval
author Kim Alvefur <zash@zash.se>
date Tue, 26 Jun 2018 19:30:28 +0200
parent 8932:12a9731aef0b
child 8934:365bcf899093
comparison
equal deleted inserted replaced
8932:12a9731aef0b 8933:6d3ecf9e8277
452 :add_child(node_config_form:form(pubsub_form_data)); 452 :add_child(node_config_form:form(pubsub_form_data));
453 origin.send(reply); 453 origin.send(reply);
454 return true; 454 return true;
455 end 455 end
456 456
457 function handlers.owner_get_affiliations(origin, stanza, affiliations, service)
458 local node = affiliations.attr.node;
459 if not node then
460 origin.send(pubsub_error_reply(stanza, "nodeid-required"));
461 return true;
462 end
463 if not service:may(node, stanza.attr.from, "set_affiliation") then
464 origin.send(pubsub_error_reply(stanza, "forbidden"));
465 return true;
466 end
467
468 local reply = st.reply(stanza)
469 :tag("pubsub", { xmlns = xmlns_pubsub_owner })
470 :tag("affiliations", { node = node });
471
472 origin.send(reply);
473 return true;
474 end
475
457 --[[ TODO 476 --[[ TODO
458 function handlers.owner_get_affiliations(origin, stanza, affiliations, service)
459 end
460
461 function handlers.owner_set_affiliations(origin, stanza, affiliations, service) 477 function handlers.owner_set_affiliations(origin, stanza, affiliations, service)
462 end 478 end
463 --]] 479 --]]
464 480
465 local function create_encapsulating_item(id, payload) 481 local function create_encapsulating_item(id, payload)