Added the ability to get user by email

This commit is contained in:
stephb9959
2021-10-19 08:05:07 -07:00
parent fcd8157020
commit 581cc76625
3 changed files with 8 additions and 2 deletions

2
build
View File

@@ -1 +1 @@
55
56

View File

@@ -39,6 +39,8 @@ namespace OpenWifi {
static const std::string uSERVICE_TOPOLOGY{ "owtopo"};
static const std::string uSERVICE_PROVISIONING{ "owprov"};
static const std::string uSERVICE_OWLS{ "owls"};
static const std::string uSERVICE_SUBCRIBER{ "owsub"};
static const std::string uSERVICE_INSTALLER{ "owinst"};
class MyErrorHandler : public Poco::ErrorHandler {
public:

View File

@@ -17,8 +17,12 @@ namespace OpenWifi {
return BadRequest(RESTAPI::Errors::MissingUserID);
}
Poco::toLowerInPlace(Id);
std::string Arg;
SecurityObjects::UserInfo UInfo;
if(!Storage()->GetUserById(Id,UInfo)) {
if(HasParameter("byEmail",Arg) && Arg=="true" && !Storage()->GetUserByEmail(Id,UInfo)) {
return NotFound();
} else if(!Storage()->GetUserById(Id,UInfo)) {
return NotFound();
}
Poco::JSON::Object UserInfoObject;