mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-01 02:58:00 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -5,6 +5,14 @@
|
||||
#include "RESTAPI_radius_endpoint_handler.h"
|
||||
|
||||
namespace OpenWifi {
|
||||
static inline bool ValidEndpointTypes(const std::string &T) {
|
||||
return T=="radius" || T=="radsec";
|
||||
}
|
||||
|
||||
static inline bool ValidPoolStrategy(const std::string &T) {
|
||||
return T=="none" || T=="tandom" || T=="weighted";
|
||||
}
|
||||
|
||||
void RESTAPI_radius_endpoint_handler::DoGet() {
|
||||
auto id = GetBinding("id");
|
||||
if(id.empty()) {
|
||||
@@ -44,6 +52,19 @@ namespace OpenWifi {
|
||||
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
|
||||
}
|
||||
|
||||
if(!ValidEndpointTypes(NewRecord.Type)) {
|
||||
return BadRequest(RESTAPI::Errors::InvalidRadiusTypeEndpoint);
|
||||
}
|
||||
if(!ValidPoolStrategy(NewRecord.PoolStrategy)) {
|
||||
return BadRequest(RESTAPI::Errors::InvalidRadiusEndpointPoolStrategy);
|
||||
}
|
||||
if(!NewRecord.RadiusServers.empty() && !NewRecord.RadsecServers.empty()) {
|
||||
return BadRequest(RESTAPI::Errors::EndpointMustHaveOneTypeOfServers);
|
||||
}
|
||||
if(NewRecord.Index.empty()) {
|
||||
return BadRequest(RESTAPI::Errors::RadiusEndpointIndexInvalid);
|
||||
}
|
||||
|
||||
ProvObjects::CreateObjectInfo(RawObject,UserInfo_.userinfo,NewRecord.info);
|
||||
if(DB_.CreateRecord(NewRecord)) {
|
||||
RecordType AddedRecord;
|
||||
|
||||
Reference in New Issue
Block a user