mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2025-11-04 20:57:56 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -55,6 +55,15 @@ namespace OpenWifi {
|
||||
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
|
||||
}
|
||||
|
||||
if(!SE.restricted.empty()) {
|
||||
for(const auto &role:SE.restricted) {
|
||||
if(SecurityObjects::UserTypeFromString(role)==SecurityObjects::UNKNOWN) {
|
||||
return BadRequest(RESTAPI::Errors::InvalidUserRole);
|
||||
}
|
||||
}
|
||||
std::sort(SE.restricted.begin(),SE.restricted.end());
|
||||
}
|
||||
|
||||
if(!SE.uri.empty() && !Utils::ValidateURI(SE.uri)) {
|
||||
return BadRequest(RESTAPI::Errors::InvalidURI);
|
||||
}
|
||||
@@ -85,6 +94,15 @@ namespace OpenWifi {
|
||||
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
|
||||
}
|
||||
|
||||
if(!SE.restricted.empty()) {
|
||||
for(const auto &role:SE.restricted) {
|
||||
if(SecurityObjects::UserTypeFromString(role)==SecurityObjects::UNKNOWN) {
|
||||
return BadRequest(RESTAPI::Errors::InvalidUserRole);
|
||||
}
|
||||
}
|
||||
std::sort(SE.restricted.begin(),SE.restricted.end());
|
||||
}
|
||||
|
||||
GWObjects::ScriptEntry Existing;
|
||||
if(!DB_.GetRecord("id", UUID, Existing)) {
|
||||
return NotFound();
|
||||
@@ -110,6 +128,10 @@ namespace OpenWifi {
|
||||
return BadRequest(RESTAPI::Errors::InvalidURI);
|
||||
}
|
||||
|
||||
if(ParsedBody_->has("restricted")) {
|
||||
Existing.restricted = SE.restricted;
|
||||
}
|
||||
|
||||
AssignIfPresent(ParsedBody_, "name", Existing.name);
|
||||
AssignIfPresent(ParsedBody_, "description", Existing.description);
|
||||
AssignIfPresent(ParsedBody_, "uri", Existing.uri);
|
||||
|
||||
Reference in New Issue
Block a user