1 #include "parser_auth_by.h"
6 int PARSER_AUTH_BY::ParseStart(void * /*data*/, const char *el, const char **attr)
8 if (strcasecmp(el, "GetUserAuthBy") == 0)
10 if (attr[0] && attr[1])
14 login.erase(login.begin(), login.end());
22 int PARSER_AUTH_BY::ParseEnd(void * /*data*/, const char *el)
24 if (strcasecmp(el, "GetUserAuthBy") == 0)
32 void PARSER_AUTH_BY::CreateAnswer()
35 if (users->FindByName(login, &u))
37 answer = "<AuthorizedBy result=\"error\" reason=\"User not found.\"/>";
42 answer += "<AuthorizedBy result=\"ok\">";
43 std::vector<std::string> list(u->GetAuthorizers());
44 for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it)
45 answer += "<Auth name=\"" + *it + "\"/>";
46 answer += "</AuthorizedBy>";