diff --git a/spectrum_manager/src/server.cpp b/spectrum_manager/src/server.cpp index 6a3ca56f..29b6ea34 100644 --- a/spectrum_manager/src/server.cpp +++ b/spectrum_manager/src/server.cpp @@ -388,116 +388,6 @@ void Server::serve_logout(struct mg_connection *conn, struct http_message *hm) { delete session; } -void Server::serve_users_add(struct mg_connection *conn, struct http_message *hm) { - std::string user = get_http_var(hm, "user"); - std::string password = get_http_var(hm, "password"); - - if (!user.empty() && !password.empty()) { - if (m_storage) { - UserInfo dummy; - bool registered = m_storage->getUser(user, dummy); - if (!registered) { - UserInfo info; - info.jid = user; - info.password = password; - m_storage->setUser(info); - } - else { - redirect_to(conn, hm, "/users?error=This+username+is+already+registered"); - return; - } - } - } - redirect_to(conn, hm, "/users?ok=1"); -} - -void Server::serve_users_remove(struct mg_connection *conn, struct http_message *hm) { - Server:session *session = get_session(hm); - if (!session->admin) { - redirect_to(conn, hm, "/"); - return; - } - - if (!m_storage) { - return; - } - - std::string user = get_http_var(hm, "user"); - UserInfo info; - m_storage->getUser(user, info); - m_storage->removeUser(info.id); - redirect_to(conn, hm, "/users"); -} - -void Server::serve_users(struct mg_connection *conn, struct http_message *hm) { - std::string html; - Server:session *session = get_session(hm); - if (!session) { - std::string ok = get_http_var(hm, "ok"); - if (!ok.empty()) { - redirect_to(conn, hm, "/"); - return; - } - html += "
Only Spectrum 2 manager administrator can access this page.
"; - print_html(conn, hm, html); - return; - } - - html += "Here, you can add new users who will have access to this web interface. " - "These users will be able to register new accounts on all Spectrum 2 instances " - "running on these server. They won't be able to change any Spectrum 2 instance " - "configuration influencing other users.
"; - } - - std::string error = get_http_var(hm, "error"); - if (!error.empty()) { - html += "Error: " + error + "
"; - } - - if (!m_storage) { - print_html(conn, hm, html); - return; - } - - html += "User | Action |
---|---|
" + user + " | "; - html += "Remove | "; - html += "