mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-01 19:17:47 +00:00
Add automatic configuration creation on tag
This commit is contained in:
@@ -444,6 +444,7 @@ namespace OpenWifi {
|
||||
NewObject.location = LC.info.id;
|
||||
AddMembership(StorageService()->EntityDB(), &ProvObjects::Entity::locations,
|
||||
ParentEntity, LC.info.id);
|
||||
Result["location"] = LC.info.id;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -470,6 +471,7 @@ namespace OpenWifi {
|
||||
ProvObjects::CreateObjectInfo(R.UserInfo_.userinfo, DC.info);
|
||||
if (StorageService()->ConfigurationDB().CreateRecord(DC)) {
|
||||
NewObject.deviceConfiguration = DC.info.id;
|
||||
Result["configuration"] = DC.info.id;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -421,11 +421,20 @@ namespace OpenWifi{
|
||||
}
|
||||
|
||||
std::string ErrorText;
|
||||
auto ObjectsCreated = CreateObjects(NewObject,*this,ErrorText);
|
||||
auto ObjectsCreated = CreateObjects(Existing,*this,ErrorText);
|
||||
if(!ErrorText.empty()) {
|
||||
return BadRequest(ErrorText);
|
||||
}
|
||||
|
||||
if(!ObjectsCreated.empty()) {
|
||||
auto it = ObjectsCreated.find("configuration");
|
||||
if(it!=ObjectsCreated.end()) {
|
||||
FromConfiguration="";
|
||||
ToConfiguration=it->second;
|
||||
Existing.deviceConfiguration=ToConfiguration;
|
||||
}
|
||||
}
|
||||
|
||||
if(StorageService()->InventoryDB().UpdateRecord("id", Existing.info.id, Existing)) {
|
||||
MoveUsage(StorageService()->PolicyDB(),DB_,FromPolicy,ToPolicy,Existing.info.id);
|
||||
MoveUsage(StorageService()->LocationDB(),DB_,FromLocation,ToLocation,Existing.info.id);
|
||||
|
||||
Reference in New Issue
Block a user