mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-01 19:17:47 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -3,10 +3,20 @@
|
||||
//
|
||||
|
||||
#include "RESTAPI_radiusendpoint_list_handler.h"
|
||||
#include "framework/AppServiceRegistry.h"
|
||||
#include "RadiusEndpointUpdater.h"
|
||||
|
||||
namespace OpenWifi {
|
||||
|
||||
void RESTAPI_radiusendpoint_list_handler::DoGet() {
|
||||
if(GetBoolParameter("lastUpdate")) {
|
||||
uint64_t LastUpdate=0;
|
||||
AppServiceRegistry().Get("radiusEndpointLastUpdate", LastUpdate);
|
||||
Poco::JSON::Object Answer;
|
||||
Answer.set("lastUpdate",LastUpdate);
|
||||
return ReturnObject(Answer);
|
||||
}
|
||||
|
||||
if(QB_.CountOnly) {
|
||||
return ReturnCountOnly(DB_.Count());
|
||||
}
|
||||
@@ -15,4 +25,25 @@ namespace OpenWifi {
|
||||
return ReturnObject(Records);
|
||||
}
|
||||
|
||||
void RESTAPI_radiusendpoint_list_handler::DoPut() {
|
||||
if( UserInfo_.userinfo.userRole!=SecurityObjects::ROOT &&
|
||||
UserInfo_.userinfo.userRole!=SecurityObjects::ADMIN) {
|
||||
return BadRequest(RESTAPI::Errors::ACCESS_DENIED);
|
||||
}
|
||||
|
||||
if(GetBoolParameter("updateEndpoints")) {
|
||||
RadiusEndpointUpdater R;
|
||||
|
||||
std::string Error;
|
||||
uint64_t ErrorNum = 0;
|
||||
R.UpdateEndpoints(Error, ErrorNum);
|
||||
|
||||
Poco::JSON::Object Answer;
|
||||
Answer.set("Error", Error);
|
||||
Answer.set("ErrorNum", ErrorNum);
|
||||
return ReturnObject(Answer);
|
||||
}
|
||||
return BadRequest(RESTAPI::Errors::MissingAuthenticationInformation);
|
||||
}
|
||||
|
||||
} // OpenWifi
|
||||
Reference in New Issue
Block a user