Instance names can now be renamed on the WebUI (incl. inst 0)

Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
Paulchen-Panther
2019-08-04 20:19:33 +02:00
parent a080c7151d
commit 3dee474356
9 changed files with 121 additions and 44 deletions

View File

@@ -1298,9 +1298,16 @@ void JsonAPI::handleInstanceCommand(const QJsonObject & message, const QString &
if(subc == "saveName")
{
// silent fail
_instanceManager->saveName(inst,name);
sendSuccessReply(command+"-"+subc, tan);
if(_userAuthorized)
{
// silent fail
if(_instanceManager->saveName(inst,name))
sendSuccessReply(command+"-"+subc, tan);
else
sendErrorReply(QString("The instance name '%1' is already in use").arg(name), command+"-"+subc, tan);
}
else
sendErrorReply("No Authorization",command+"-"+subc, tan);
return;
}
}