Xie Ning | 9fa06f1 | 2022-06-29 18:27:47 +0800 | [diff] [blame] | 1 | #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 | |
| 9 | namespace bmcweb |
| 10 | { |
| 11 | |
Patrick Williams | ca165b9 | 2023-02-28 02:40:35 -0600 | [diff] [blame] | 12 | inline void onUserRemoved(sdbusplus::message_t& msg) |
Xie Ning | 9fa06f1 | 2022-06-29 18:27:47 +0800 | [diff] [blame] | 13 | { |
| 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 | |
| 21 | inline 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 |