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