diff options
Diffstat (limited to 'user.hpp')
-rw-r--r-- | user.hpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/user.hpp b/user.hpp new file mode 100644 index 0000000..25c7e62 --- /dev/null +++ b/user.hpp @@ -0,0 +1,62 @@ +#pragma once + +#include <string> +#include <sdbusplus/bus.hpp> +#include <sdbusplus/server/object.hpp> +#include <xyz/openbmc_project/User/Password/server.hpp> +namespace phosphor +{ +namespace user +{ + +namespace Base = sdbusplus::xyz::openbmc_project::User::server; +using Interface = sdbusplus::server::object::object<Base::Password>; + +/** @class User + * @brief Responsible for managing a specific user account. + * It is implementing just the Password interface + * for now. + */ +class User : public Interface +{ + public: + User() = delete; + ~User() = default; + User(const User&) = delete; + User& operator=(const User&) = delete; + User(User&&) = delete; + User& operator=(User&&) = delete; + + /** @brief Constructs User object. + * + * @param[in] bus - sdbusplus handler + * @param[in] path - D-Bus path + */ + User(sdbusplus::bus::bus& bus, const char* path) + : Interface(bus, path), + bus(bus), + path(path) + { + // Do nothing + } + + /** @brief user password set method. If this is called for + * a user ID that already has the password, the password + * would be updated, else password would be created. + * Since this needs an already authenticated session, + * old password is not needed. + * + * @param[in] newPassword - New password + */ + void setPassword(std::string newPassword) override; + + private: + /** @brief sdbusplus handler */ + sdbusplus::bus::bus& bus; + + /** @brief object path */ + const std::string& path; +}; + +} // namespace user +} // namespace phosphor |