mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-10-29 18:02:29 +00:00
Added the ability to get user by email
This commit is contained in:
@@ -20,9 +20,11 @@ namespace OpenWifi {
|
||||
Poco::toLowerInPlace(Id);
|
||||
std::string Arg;
|
||||
SecurityObjects::UserInfo UInfo;
|
||||
if(HasParameter("byEmail",Arg) && Arg=="true" && !Storage()->GetUserByEmail(Id,UInfo)) {
|
||||
std::cout << "Could not find e-mail: " << Id << std::endl;
|
||||
return NotFound();
|
||||
if(HasParameter("byEmail",Arg) && Arg=="true") {
|
||||
if(!Storage()->GetUserByEmail(Id,UInfo)) {
|
||||
std::cout << "Could not find e-mail: " << Id << std::endl;
|
||||
return NotFound();
|
||||
}
|
||||
} else if(!Storage()->GetUserById(Id,UInfo)) {
|
||||
std::cout << "Could not find ID: " << Id << std::endl;
|
||||
return NotFound();
|
||||
|
||||
@@ -200,12 +200,13 @@ getuser() {
|
||||
}
|
||||
|
||||
getuserbyemail() {
|
||||
curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/user/$1?byEmail=true" \
|
||||
curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/user/${1}?byEmail=true" \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: Bearer ${token}" \
|
||||
-d "$payload" > ${result_file}
|
||||
jq < ${result_file}
|
||||
}
|
||||
|
||||
listusers() {
|
||||
curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/users" \
|
||||
-H "accept: application/json" \
|
||||
|
||||
Reference in New Issue
Block a user