AuthenticatedApiUser name refactor

This commit is contained in:
Mattia Codato 2020-07-03 11:17:36 +02:00
parent 08c6e9bc42
commit b07471d803
3 changed files with 7 additions and 7 deletions

View File

@ -689,11 +689,11 @@ Dictionary::Ptr ApiActions::ExecuteCommand(const ConfigObject::Ptr& object,
return ApiActions::CreateResult(404, "Can't find a valid notification for '" + resolved_notification + "'.");
/* Get author */
if (!ActionsHandler::authenticatedApiUser)
if (!ActionsHandler::AuthenticatedApiUser)
BOOST_THROW_EXCEPTION(std::invalid_argument("Can't find API user."));
cmd->Execute(notification, user, cr, NotificationType::NotificationCustom,
ActionsHandler::authenticatedApiUser->GetName(), "", execMacros, false);
ActionsHandler::AuthenticatedApiUser->GetName(), "", execMacros, false);
}
}

View File

@ -11,7 +11,7 @@
using namespace icinga;
thread_local ApiUser::Ptr ActionsHandler::authenticatedApiUser;
thread_local ApiUser::Ptr ActionsHandler::AuthenticatedApiUser;
REGISTER_URLHANDLER("/v1/actions", ActionsHandler);
@ -74,9 +74,9 @@ bool ActionsHandler::HandleRequest(
bool verbose = false;
ActionsHandler::authenticatedApiUser = user;
Defer a ([&]() {
ActionsHandler::authenticatedApiUser = nullptr;
ActionsHandler::AuthenticatedApiUser = user;
Defer a ([]() {
ActionsHandler::AuthenticatedApiUser = nullptr;
});
if (params)

View File

@ -13,7 +13,7 @@ class ActionsHandler final : public HttpHandler
public:
DECLARE_PTR_TYPEDEFS(ActionsHandler);
static thread_local ApiUser::Ptr authenticatedApiUser;
static thread_local ApiUser::Ptr AuthenticatedApiUser;
bool HandleRequest(
AsioTlsStream& stream,