diff options
author | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-09-06 11:36:04 +0530 |
---|---|---|
committer | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-09-13 11:43:43 +0530 |
commit | d20225fb9b79172979f9f3b92d12534f56d9dad7 (patch) | |
tree | b2c740fb0ff46a7fdcde9602b2c798dac305581e /user.hpp | |
parent | 8a89b53bf014d0844dfd85b2327853037d1e2cb7 (diff) | |
download | phosphor-user-manager-d20225fb9b79172979f9f3b92d12534f56d9dad7.tar.gz phosphor-user-manager-d20225fb9b79172979f9f3b92d12534f56d9dad7.zip |
Implement user password interface
provides a minimal implementation of Password.interface
Change-Id: I3041b6425b76f931dbb8d7e4b7d192e98d70aa23
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
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 |