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