Ed Tanous | 40e9b92 | 2024-09-10 13:50:16 -0700 | [diff] [blame^] | 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // SPDX-FileCopyrightText: Copyright OpenBMC Authors |
Xie Ning | 9fa06f1 | 2022-06-29 18:27:47 +0800 | [diff] [blame] | 3 | #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 | |
| 11 | namespace bmcweb |
| 12 | { |
| 13 | |
Patrick Williams | ca165b9 | 2023-02-28 02:40:35 -0600 | [diff] [blame] | 14 | inline void onUserRemoved(sdbusplus::message_t& msg) |
Xie Ning | 9fa06f1 | 2022-06-29 18:27:47 +0800 | [diff] [blame] | 15 | { |
| 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 | |
| 23 | inline 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 |