added network role update to host PUT

This commit is contained in:
0xdcarns 2022-12-28 12:13:07 -05:00
parent 8c92308ccf
commit 2e419944c0

View file

@ -85,6 +85,17 @@ func updateHost(w http.ResponseWriter, r *http.Request) {
return
}
newNetworks := logic.GetHostNetworks(newHost.ID.String())
if len(newNetworks) > 0 {
if err = mq.ModifyClient(&mq.MqClient{
ID: currHost.ID.String(),
Text: currHost.Name,
Networks: newNetworks,
}); err != nil {
logger.Log(0, r.Header.Get("user"), "failed to update host networks roles in DynSec:", err.Error())
}
}
apiHostData := newHost.ConvertNMHostToAPI()
logger.Log(2, r.Header.Get("user"), "updated host", newHost.ID.String())
w.WriteHeader(http.StatusOK)