From 0bea2fde92fa7574b6da1d3bc0d84e9d3cbcc0a1 Mon Sep 17 00:00:00 2001 From: rjwats Date: Wed, 17 Jun 2020 09:20:33 +0100 Subject: [PATCH] Add admin security predicate to time endpoint (#154) --- lib/framework/NTPSettingsService.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/framework/NTPSettingsService.cpp b/lib/framework/NTPSettingsService.cpp index c494302..420db7f 100644 --- a/lib/framework/NTPSettingsService.cpp +++ b/lib/framework/NTPSettingsService.cpp @@ -4,7 +4,9 @@ NTPSettingsService::NTPSettingsService(AsyncWebServer* server, FS* fs, SecurityM _httpEndpoint(NTPSettings::read, NTPSettings::update, this, server, NTP_SETTINGS_SERVICE_PATH, securityManager), _fsPersistence(NTPSettings::read, NTPSettings::update, this, fs, NTP_SETTINGS_FILE), _timeHandler(TIME_PATH, - std::bind(&NTPSettingsService::configureTime, this, std::placeholders::_1, std::placeholders::_2)) { + securityManager->wrapCallback( + std::bind(&NTPSettingsService::configureTime, this, std::placeholders::_1, std::placeholders::_2), + AuthenticationPredicates::IS_ADMIN)) { _timeHandler.setMethod(HTTP_POST); _timeHandler.setMaxContentLength(MAX_TIME_SIZE); server->addHandler(&_timeHandler);