22 #include <boost/algorithm/string/join.hpp>
28 , unrestricted_(false)
35 const auto &security_details =
cfg_.get_child_optional(
"security");
39 for (
const auto &entry : (*security_details))
41 assert(entry.first ==
"map");
50 const std::string &req)
58 WARN(
"Received command from "
60 <<
" but no permission information for this user. Denying.");
66 return std::find(cmds.begin(), cmds.end(), req) == cmds.end();
68 return std::find(cmds.begin(), cmds.end(), req) != cmds.end();
72 const boost::property_tree::ptree &entry)
74 const std::string &pk = entry.get<std::string>(
"pk");
75 bool default_access = entry.get<
bool>(
"default",
false);
79 for (
const auto &c : entry)
81 if (c.first ==
"pk" || c.first ==
"default")
83 std::string cmd_name = c.first;
84 bool allowed = c.second.get_value<
bool>();
88 if (default_access != allowed)
92 INFO(
"Processed configuration for remote user. \n\t "
93 <<
"Public key: " << pk <<
"\n\t "
94 <<
"Default permission: " << default_access <<
"\n\t "
95 << (default_access ?
"Disabled command: " :
"Enabled commands: ")