mirror of https://github.com/Icinga/icinga2.git
AuthenticatedApiUser name refactor
This commit is contained in:
parent
08c6e9bc42
commit
b07471d803
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue