blob: fd3afd827c119246331dde233da317047c05bf36 [file]
#ifndef THIRD_PARTY_GBMCWEB_INCLUDE_USER_MONITOR_H_
#define THIRD_PARTY_GBMCWEB_INCLUDE_USER_MONITOR_H_
#include <string>
#include "sessions.hpp"
#include "managed_store.hpp"
#include "sdbusplus/bus/match.hpp"
#include "sdbusplus/message.hpp"
#include "sdbusplus/message/native_types.hpp"
namespace bmcweb {
inline void onUserRemoved(sdbusplus::message_t& msg) {
sdbusplus::message::object_path p;
msg.read(p);
std::string username = p.filename();
persistent_data::SessionStore::getInstance().removeSessionsByUsername(
username);
}
inline void registerUserRemovedSignal() {
std::string userRemovedMatchStr =
sdbusplus::bus::match::rules::interfacesRemoved(
"/xyz/openbmc_project/user");
static sdbusplus::bus::match_t userRemovedMatch(
*(managedStore::GetManagedObjectStore()
->GetDeprecatedThreadUnsafeSystemBus()),
userRemovedMatchStr, onUserRemoved);
}
} // namespace bmcweb
#endif // THIRD_PARTY_GBMCWEB_INCLUDE_USER_MONITOR_H_