mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 20:47:10 +11:00
AdminDel/Del now delete logs aswell
This commit is contained in:
parent
57c755c415
commit
b0af12d4ce
2 changed files with 19 additions and 4 deletions
|
|
@ -61,13 +61,27 @@ public:
|
||||||
|
|
||||||
bool DelUser(const std::string &name, const std::string &attempt)
|
bool DelUser(const std::string &name, const std::string &attempt)
|
||||||
{
|
{
|
||||||
std::shared_lock<std::shared_mutex> lock{size_l};
|
{
|
||||||
return users.erase_if(name, [&attempt](const User &u) { return (XXH3_64bits(attempt.data(), attempt.size()) == u.password); });
|
std::shared_lock<std::shared_mutex> lock{size_l};
|
||||||
|
bool state = users.erase_if(name, [&attempt](User &u) { return (XXH3_64bits(attempt.data(), attempt.size()) == u.password); });
|
||||||
|
}
|
||||||
|
if (state)
|
||||||
|
{
|
||||||
|
logs.erase_if(name, [](User &u) {})
|
||||||
|
}
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
bool AdminDelUser(const std::string &name, const std::string &attempt)
|
bool AdminDelUser(const std::string &name, const std::string &attempt)
|
||||||
{
|
{
|
||||||
std::shared_lock<std::shared_mutex> lock{size_l};
|
{
|
||||||
return users.erase_if(name, [this, &attempt](const User &) { return (admin_pass == attempt); });
|
std::shared_lock<std::shared_mutex> lock{size_l};
|
||||||
|
bool state = users.erase_if(name, [this, &attempt](const User &) { return (admin_pass == attempt); });
|
||||||
|
}
|
||||||
|
if (state)
|
||||||
|
{
|
||||||
|
logs.erase_if(name, [](User &u) {});
|
||||||
|
}
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SendFunds(const std::string &a_name, const std::string &b_name, uint_fast32_t amount, const std::string &attempt)
|
bool SendFunds(const std::string &a_name, const std::string &b_name, uint_fast32_t amount, const std::string &attempt)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
//24 bytes total
|
||||||
struct Transaction
|
struct Transaction
|
||||||
{
|
{
|
||||||
std::string from = "", to = "";
|
std::string from = "", to = "";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue