mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 10:20:26 +00:00
API CHANGE
Last round of new "action"s for the sysadm/services class, "action":"[enable/disable]" Required input arguments: "services":["service1","service2","etc"] Exactly the same syntax as the start/stop/restart API calls, just a different action and the output field is "services_[enabled/disabled]" as well.
This commit is contained in:
@@ -1061,6 +1061,32 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmServiceRequest(const QJsonVa
|
||||
}
|
||||
out->insert("services_restarted", QJsonArray::fromStringList(success));
|
||||
}
|
||||
}else if(action=="enable" && in_args.toObject().contains("services") ){
|
||||
QJsonValue sval = in_args.toObject().value("services");
|
||||
QStringList services;
|
||||
if(sval.isString()){ services << sval.toString(); }
|
||||
else if(sval.isArray()){ services = JsonArrayToStringList(sval.toArray()); }
|
||||
if(!services.isEmpty()){
|
||||
QStringList success;
|
||||
ok = true;
|
||||
for(int i=0; i<services.length(); i++){
|
||||
if( SMGR.Enable( SMGR.GetService(services[i]) ) ){ success << services[i]; }
|
||||
}
|
||||
out->insert("services_enabled", QJsonArray::fromStringList(success));
|
||||
}
|
||||
}else if(action=="disable" && in_args.toObject().contains("services") ){
|
||||
QJsonValue sval = in_args.toObject().value("services");
|
||||
QStringList services;
|
||||
if(sval.isString()){ services << sval.toString(); }
|
||||
else if(sval.isArray()){ services = JsonArrayToStringList(sval.toArray()); }
|
||||
if(!services.isEmpty()){
|
||||
QStringList success;
|
||||
ok = true;
|
||||
for(int i=0; i<services.length(); i++){
|
||||
if( SMGR.Disable( SMGR.GetService(services[i]) ) ){ success << services[i]; }
|
||||
}
|
||||
out->insert("services_disabled", QJsonArray::fromStringList(success));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user