blob: 73f63031cd2b4a56e4d564b5ebcdd651ffc95944 [file] [log] [blame]
Xie Ning9fa06f12022-06-29 18:27:47 +08001#pragma once
2#include "dbus_singleton.hpp"
3#include "dbus_utility.hpp"
4#include "persistent_data.hpp"
5
6#include <sdbusplus/bus/match.hpp>
7#include <sdbusplus/message/types.hpp>
8
9namespace bmcweb
10{
11
Patrick Williamsca165b92023-02-28 02:40:35 -060012inline void onUserRemoved(sdbusplus::message_t& msg)
Xie Ning9fa06f12022-06-29 18:27:47 +080013{
14 sdbusplus::message::object_path p;
15 msg.read(p);
16 std::string username = p.filename();
17 persistent_data::SessionStore::getInstance().removeSessionsByUsername(
18 username);
19}
20
21inline void registerUserRemovedSignal()
22{
23 std::string userRemovedMatchStr =
24 sdbusplus::bus::match::rules::interfacesRemoved(
25 "/xyz/openbmc_project/user");
26
27 static sdbusplus::bus::match_t userRemovedMatch(
28 *crow::connections::systemBus, userRemovedMatchStr, onUserRemoved);
29}
30} // namespace bmcweb