Add admin security predicate to time endpoint (#154)

This commit is contained in:
rjwats 2020-06-17 09:20:33 +01:00 committed by GitHub
parent 55511e0611
commit 0bea2fde92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,9 @@ NTPSettingsService::NTPSettingsService(AsyncWebServer* server, FS* fs, SecurityM
_httpEndpoint(NTPSettings::read, NTPSettings::update, this, server, NTP_SETTINGS_SERVICE_PATH, securityManager), _httpEndpoint(NTPSettings::read, NTPSettings::update, this, server, NTP_SETTINGS_SERVICE_PATH, securityManager),
_fsPersistence(NTPSettings::read, NTPSettings::update, this, fs, NTP_SETTINGS_FILE), _fsPersistence(NTPSettings::read, NTPSettings::update, this, fs, NTP_SETTINGS_FILE),
_timeHandler(TIME_PATH, _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.setMethod(HTTP_POST);
_timeHandler.setMaxContentLength(MAX_TIME_SIZE); _timeHandler.setMaxContentLength(MAX_TIME_SIZE);
server->addHandler(&_timeHandler); server->addHandler(&_timeHandler);