Comparison

util/pubsub.lua @ 9107:6e42ef9c805c

util.pubsub: Add method to retrieve node configuration
author Matthew Wild <mwild1@gmail.com>
date Sat, 04 Aug 2018 21:32:24 +0100
parent 9106:e70b9e8bc443
child 9117:a19fdc6e4f09
comparison
equal deleted inserted replaced
9106:e70b9e8bc443 9107:6e42ef9c805c
590 end 590 end
591 591
592 return true; 592 return true;
593 end 593 end
594 594
595 function service:get_node_config(node, actor)
596 if not self:may(node, actor, "get_configuration") then
597 return false, "forbidden";
598 end
599
600 local node_obj = self.nodes[node];
601 if not node_obj then
602 return false, "item-not-found";
603 end
604
605 local config_table = {};
606 for k, v in pairs(default_node_config) do
607 config_table[k] = v;
608 end
609 for k, v in pairs(node_obj.config) do
610 config_table[k] = v;
611 end
612
613 return true, config_table;
614 end
615
595 return { 616 return {
596 new = new; 617 new = new;
597 }; 618 };