code: hpp,dbal,cpp (2 files)

This commit is contained in:
2025-12-26 06:02:59 +00:00
parent 40547d3bf4
commit 71b28a1ff2
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
#ifndef DBAL_CREDENTIAL_HELPERS_HPP
#define DBAL_CREDENTIAL_HELPERS_HPP
#include "../../store/in_memory_store.hpp"
#include <string>
namespace dbal {
namespace entities {
namespace credential {
namespace helpers {
inline bool userExists(const InMemoryStore& store, const std::string& username) {
for (const auto& [id, user] : store.users) {
(void)id;
if (user.username == username) {
return true;
}
}
return false;
}
inline Credential* getCredential(InMemoryStore& store, const std::string& username) {
auto it = store.credentials.find(username);
if (it == store.credentials.end()) {
return nullptr;
}
return &it->second;
}
} // namespace helpers
} // namespace credential
} // namespace entities
} // namespace dbal
#endif

View File

@@ -13,5 +13,6 @@
#include "workflow_validation.hpp"
#include "lua_script_validation.hpp"
#include "package_validation.hpp"
#include "entity/credential_validation.hpp"
#endif