Only allowing root users to run scripts.

This commit is contained in:
stephb9959
2022-05-12 12:14:14 -07:00
parent 3329781bc2
commit e730c60ebc

View File

@@ -236,8 +236,12 @@ namespace OpenWifi {
void RESTAPI_device_commandHandler::Script() {
Logger_.information(fmt::format("SCRIPT: user={} serial={}", UserInfo_.userinfo.email,SerialNumber_));
const auto &Obj = ParsedBody_;
if(!Internal_ && UserInfo_.userinfo.userRole!=SecurityObjects::ROOT) {
return UnAuthorized(RESTAPI::Errors::ACCESS_DENIED);
}
const auto &Obj = ParsedBody_;
GWObjects::ScriptRequest SCR;
if(!SCR.from_json(Obj)) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);