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 12 inline void onUserRemoved(sdbusplus::message_t& msg) 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 31