Framework update

This commit is contained in:
stephb9959
2021-12-28 11:14:58 -08:00
parent f54cd95fc4
commit 1cf9894f7d
3 changed files with 12 additions and 5 deletions

2
build
View File

@@ -1 +1 @@
156
157

View File

@@ -4,6 +4,8 @@
#include "orm_users.h"
#include "AuthService.h"
#include "RESTObjects/RESTAPI_CertObjects.h"
#include "StorageService.h"
/*
std::string, // Id = 0;
@@ -90,7 +92,6 @@ namespace OpenWifi {
DB(T, Name.c_str(), BaseUserDB_Fields, MakeIndices(ShortName), P, L, ShortName.c_str()) {
}
bool BaseUserDB::CreateUser(const std::string & Admin, SecurityObjects::UserInfo & NewUser, bool PasswordHashedAlready ) {
try {
Poco::toLowerInPlace(NewUser.email);
@@ -145,9 +146,9 @@ namespace OpenWifi {
return false;
}
bool BaseUserDB::GetUsers( uint64_t Offset, uint64_t HowMany, SecurityObjects::UserInfoVec & Users) {
bool BaseUserDB::GetUsers( uint64_t Offset, uint64_t HowMany, SecurityObjects::UserInfoVec & Users, std::string WhereClause) {
try {
return GetRecords(Offset, HowMany, Users);
return GetRecords(Offset, HowMany, Users, WhereClause);
} catch (const Poco::Exception &E) {
Logger().log(E);
}
@@ -199,6 +200,11 @@ namespace OpenWifi {
return false;
}
bool BaseUserDB::DeleteUsers(const std::string & Admin, std::string & owner) {
std::string WhereClause{ " owner='" + owner +"' "};
return DeleteRecords(WhereClause);
}
bool BaseUserDB::SetLastLogin(const std::string &Id) {
try {
Poco::Data::Session Sess = Pool_.get();

View File

@@ -86,9 +86,10 @@ namespace OpenWifi {
bool CreateUser(const std::string & Admin, SecurityObjects::UserInfo & NewUser, bool PasswordHashedAlready = false );
bool GetUserByEmail(const std::string & email, SecurityObjects::UserInfo & User);
bool GetUserById(const std::string &Id, SecurityObjects::UserInfo &User);
bool GetUsers( uint64_t Offset, uint64_t HowMany, SecurityObjects::UserInfoVec & Users);
bool GetUsers( uint64_t Offset, uint64_t HowMany, SecurityObjects::UserInfoVec & Users, std::string WhereClause="");
bool UpdateUserInfo(const std::string & Admin, USER_ID_TYPE & Id, SecurityObjects::UserInfo &UInfo);
bool DeleteUser(const std::string & Admin, USER_ID_TYPE & Id);
bool DeleteUsers(const std::string & Admin, std::string & owner);
bool SetLastLogin(const std::string &Id);
bool SetAvatar(const std::string &Id, const std::string &Value);