added editorconfig and formated code
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled
This commit is contained in:
1 parent
77a483a38a
commit
e5abe4bb02
23 files changed
+22332
-21478
No files matched your search
@@ -6,7 +6,8 @@
|
||||
#include <syslog.h>
|
||||
|
||||
// function for delete user
|
||||
void delete_user(const httplib::Request &request, httplib::Response &response) {
|
||||
void delete_user(const httplib::Request& request, httplib::Response& response)
|
||||
{
|
||||
std::cout << GREEN << request.path << RESET << " " << request.method << std::endl;
|
||||
response.set_header("Access-Control-Allow-Origin", "*");
|
||||
if (request.body.empty()) {
|
||||
@@ -46,7 +47,7 @@ void delete_user(const httplib::Request &request, httplib::Response &response) {
|
||||
if (json_body["userid"] != nullptr) {
|
||||
deluserid = json_body["userid"];
|
||||
nlohmann::json response_user_data = nullptr;
|
||||
for (nlohmann::json &user: all_users) {
|
||||
for (nlohmann::json& user : all_users) {
|
||||
if (user["id"] == userid) {
|
||||
response_user_data = user;
|
||||
}
|
||||
@@ -67,7 +68,7 @@ void delete_user(const httplib::Request &request, httplib::Response &response) {
|
||||
for (size_t i = 0; i < all_users.size(); i++) {
|
||||
if (all_users[i]["id"] == deluserid) {
|
||||
std::stringstream syslogstring;
|
||||
syslogstring << "user deleted [" << all_users[i]["username"] << "]";
|
||||
syslogstring << "user deleted [" << all_users[i]["username"] << "]";
|
||||
all_users.erase(i);
|
||||
found = true;
|
||||
syslog(LOG_INFO, syslogstring.str().c_str());
|
||||
|
||||
Reference in new issue
Block a user