blob: 4f14a533b47cac0288dce83a4a60ac5e0811f445 [file] [log] [blame]
#pragma once
#include "dbus_utility.hpp"
#include "persistent_data.hpp"
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/message/types.hpp>
#include "managed_store.hpp"
#ifdef UNIT_TEST_BUILD
#include "test/g3/mock_managed_store.hpp" // NOLINT
#endif
namespace bmcweb
{
inline void onUserRemoved(sdbusplus::message_t& msg)
{
sdbusplus::message::object_path p;
msg.read(p);
std::string username = p.filename();
persistent_data::SessionStore::getInstance().removeSessionsByUsername(
username);
}
inline void registerUserRemovedSignal()
{
std::string userRemovedMatchStr =
sdbusplus::bus::match::rules::interfacesRemoved(
"/xyz/openbmc_project/user");
static sdbusplus::bus::match_t userRemovedMatch(
*(managedStore::GetManagedObjectStore()->GetDeprecatedThreadUnsafeSystemBus()),
userRemovedMatchStr, onUserRemoved);
}
} // namespace bmcweb