1 #include "parser_auth_by.h"
3 int PARSER_AUTH_BY::ParseStart(void * /*data*/, const char *el, const char **attr)
5 if (strcasecmp(el, "GetUserAuthBy") == 0)
7 if (attr[0] && attr[1])
11 login.erase(login.begin(), login.end());
19 int PARSER_AUTH_BY::ParseEnd(void * /*data*/, const char *el)
21 if (strcasecmp(el, "GetUserAuthBy") == 0)
29 void PARSER_AUTH_BY::CreateAnswer()
32 if (users->FindByName(login, &u))
34 answer = "<AuthorizedBy result=\"error\" reason=\"User not found.\"/>";
39 answer += "<AuthorizedBy result=\"ok\">";
40 std::vector<std::string> list(u->GetAuthorizers());
41 for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it)
42 answer += "<Auth name=\"" + *it + "\"/>";
43 answer += "</AuthorizedBy>";