blob: 25c7e623f30c439a66ccba46e52d8bb4394605df [file] [log] [blame]
Vishwanatha Subbannad20225f2017-09-06 11:36:04 +05301#pragma once
2
3#include <string>
4#include <sdbusplus/bus.hpp>
5#include <sdbusplus/server/object.hpp>
6#include <xyz/openbmc_project/User/Password/server.hpp>
7namespace phosphor
8{
9namespace user
10{
11
12namespace Base = sdbusplus::xyz::openbmc_project::User::server;
13using Interface = sdbusplus::server::object::object<Base::Password>;
14
15/** @class User
16 * @brief Responsible for managing a specific user account.
17 * It is implementing just the Password interface
18 * for now.
19 */
20class User : public Interface
21{
22 public:
23 User() = delete;
24 ~User() = default;
25 User(const User&) = delete;
26 User& operator=(const User&) = delete;
27 User(User&&) = delete;
28 User& operator=(User&&) = delete;
29
30 /** @brief Constructs User object.
31 *
32 * @param[in] bus - sdbusplus handler
33 * @param[in] path - D-Bus path
34 */
35 User(sdbusplus::bus::bus& bus, const char* path)
36 : Interface(bus, path),
37 bus(bus),
38 path(path)
39 {
40 // Do nothing
41 }
42
43 /** @brief user password set method. If this is called for
44 * a user ID that already has the password, the password
45 * would be updated, else password would be created.
46 * Since this needs an already authenticated session,
47 * old password is not needed.
48 *
49 * @param[in] newPassword - New password
50 */
51 void setPassword(std::string newPassword) override;
52
53 private:
54 /** @brief sdbusplus handler */
55 sdbusplus::bus::bus& bus;
56
57 /** @brief object path */
58 const std::string& path;
59};
60
61} // namespace user
62} // namespace phosphor