blob: 530b00f84e12a5ea8ce4d6a2d82c453e6d6315c3 [file] [log] [blame]
Ed Tanous40e9b922024-09-10 13:50:16 -07001// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright OpenBMC Authors
Xie Ning9fa06f12022-06-29 18:27:47 +08003#pragma once
4#include "dbus_singleton.hpp"
5#include "dbus_utility.hpp"
6#include "persistent_data.hpp"
7
8#include <sdbusplus/bus/match.hpp>
9#include <sdbusplus/message/types.hpp>
10
11namespace bmcweb
12{
13
Patrick Williamsca165b92023-02-28 02:40:35 -060014inline void onUserRemoved(sdbusplus::message_t& msg)
Xie Ning9fa06f12022-06-29 18:27:47 +080015{
16 sdbusplus::message::object_path p;
17 msg.read(p);
18 std::string username = p.filename();
19 persistent_data::SessionStore::getInstance().removeSessionsByUsername(
20 username);
21}
22
23inline void registerUserRemovedSignal()
24{
25 std::string userRemovedMatchStr =
26 sdbusplus::bus::match::rules::interfacesRemoved(
27 "/xyz/openbmc_project/user");
28
29 static sdbusplus::bus::match_t userRemovedMatch(
30 *crow::connections::systemBus, userRemovedMatchStr, onUserRemoved);
31}
32} // namespace bmcweb