Adding default subscriber entity.

This commit is contained in:
stephb9959
2022-04-05 16:07:06 -07:00
parent 65d7b28d77
commit f36a9f5dba
13 changed files with 116 additions and 4 deletions

View File

@@ -41,6 +41,10 @@ namespace OpenWifi{
return BadRequest(RESTAPI::Errors::CannotDeleteRoot);
}
if(Existing.type=="subscriber" && Existing.defaultEntity) {
return BadRequest(RESTAPI::Errors::CannotDeleteSubEntity);
}
if( !Existing.children.empty() || !Existing.devices.empty() || !Existing.venues.empty() || !Existing.locations.empty()
|| !Existing.contacts.empty() || !Existing.configurations.empty()) {
return BadRequest(RESTAPI::Errors::StillInUse);
@@ -69,6 +73,14 @@ namespace OpenWifi{
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
}
if(NewEntity.type.empty()) {
NewEntity.type = "normal";
}
if(!ValidEntityType(NewEntity.type)) {
return BadRequest(RESTAPI::Errors::InvalidEntityType);
}
if(!ProvObjects::CreateObjectInfo(Obj,UserInfo_.userinfo,NewEntity.info)) {
return BadRequest(RESTAPI::Errors::NameMustBeSet);
}