Skip to content

Commit 0bea2fd

Browse files
authored
Add admin security predicate to time endpoint (#154)
1 parent 55511e0 commit 0bea2fd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/framework/NTPSettingsService.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ NTPSettingsService::NTPSettingsService(AsyncWebServer* server, FS* fs, SecurityM
44
_httpEndpoint(NTPSettings::read, NTPSettings::update, this, server, NTP_SETTINGS_SERVICE_PATH, securityManager),
55
_fsPersistence(NTPSettings::read, NTPSettings::update, this, fs, NTP_SETTINGS_FILE),
66
_timeHandler(TIME_PATH,
7-
std::bind(&NTPSettingsService::configureTime, this, std::placeholders::_1, std::placeholders::_2)) {
7+
securityManager->wrapCallback(
8+
std::bind(&NTPSettingsService::configureTime, this, std::placeholders::_1, std::placeholders::_2),
9+
AuthenticationPredicates::IS_ADMIN)) {
810
_timeHandler.setMethod(HTTP_POST);
911
_timeHandler.setMaxContentLength(MAX_TIME_SIZE);
1012
server->addHandler(&_timeHandler);

0 commit comments

Comments
 (0)