]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/parser_auth_by.cpp
Ticket 37. The construction if-else removed and ReadString() changed to
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / parser_auth_by.cpp
index e16745c58097b4a83c81429bd70e6a0ed2b1b880..ab1cabdf9a54af35bf61acf73cf4cd41b0477828 100644 (file)
 
 using STG::PARSER::AUTH_BY;
 
 
 using STG::PARSER::AUTH_BY;
 
+const char * AUTH_BY::tag = "GetUserAuthBy";
+
 int AUTH_BY::Start(void * /*data*/, const char *el, const char **attr)
 {
 int AUTH_BY::Start(void * /*data*/, const char *el, const char **attr)
 {
-    if (strcasecmp(el, tag.c_str()) != 0)
+    if (strcasecmp(el, m_tag.c_str()) != 0)
         return -1;
 
     if (!attr[1])
         return -1;
 
     if (!attr[1])
@@ -42,13 +44,13 @@ void AUTH_BY::CreateAnswer()
     CONST_USER_PTR u;
     if (m_users.FindByName(m_login, &u))
     {
     CONST_USER_PTR u;
     if (m_users.FindByName(m_login, &u))
     {
-        answer = "<AuthorizedBy result=\"error\" reason=\"User not found.\"/>";
+        m_answer = "<AuthorizedBy result=\"error\" reason=\"User not found.\"/>";
         return;
     }
 
         return;
     }
 
-    answer = "<AuthorizedBy result=\"ok\">";
+    m_answer = "<AuthorizedBy result=\"ok\">";
     std::vector<std::string> list(u->GetAuthorizers());
     for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it)
     std::vector<std::string> list(u->GetAuthorizers());
     for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it)
-        answer += "<Auth name=\"" + *it + "\"/>";
-    answer += "</AuthorizedBy>";
+        m_answer += "<Auth name=\"" + *it + "\"/>";
+    m_answer += "</AuthorizedBy>";
 }
 }