squash the following commits

LDAP: Adding support for extra properties
Implement GetUserInfo function in phosphor-user-manager

Squashing the commits due to phosphor-dbus-interfaces
dependency as the interface gets merged and it requires implementation
so it is a deadlock for both the commits.

Implement GetUserInfo function in phosphor-user-manager

There was need to have api which return privilege for ldap user.
it was discussed in this commit
https://gerrit.openbmc-project.xyz/#/c/openbmc/phosphor-dbus-interfaces/+/12027/
and decided to have generic api.

-Checks if user is local user, then returns map of properties of
 local user like user privilege,list of user groups,user enabled
 state and user locked state.

-If its not local user, then it checks if its a ldap user,
 then get the privilege mapping for the LDAP group and returns.

TestedBy: 1) getUserInfo with local user
             verify user details.
          2) getUserInfo with ldap user having privilege mapper
             entry, verify user details.
          3) getUserInfo with no existing user.
              check for exception UserNameDoesNotExist.

Change-Id: I44af41953db60ff96b39498d72839c2ab64bc8bd
Signed-off-by: raviteja-b <raviteja28031990@gmail.com>

LDAP: Adding support for extra properties

This commit also decouple the ldap service(nslcd) start
with each property update,Now there is a D-bus property
ldap service enabled which controls that whether the LDAP
service will be restarted after each property update,so now user
have an option to disable the ldap service and do multi-
property update and then enable the service again.

TestedBy: 1) Create the config with new added properties
               Verify that it was getting reflected on the D-bus object.
          2) After making the change restarted the ldap-conf service
               Verify that new properties(usernameattr,groupnameattr) are correctly updated.
          3) Authenticaton test
               Verify that LDAP authentication worked fine.
          4) Set the enabled property to true
               Verify that it starts the nslcd service
          5) Set the enabled property to false
               Verify that it stops the nslcd.service
          6) Set the enabled property to true and change any other config property
               Verify that it starts the nslcd.service
          7) Set the enabled property to false which stops the nslcd service
                 and change any other config property.
               Verify that it doesn't start the nslcd service.

Change-Id: Ie3ca04a2adbbb1fe113764199348c4f7ac67f648
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
diff --git a/user_mgr.hpp b/user_mgr.hpp
index c1673f1..c78174d 100644
--- a/user_mgr.hpp
+++ b/user_mgr.hpp
@@ -19,6 +19,7 @@
 #include <xyz/openbmc_project/User/Manager/server.hpp>
 #include <xyz/openbmc_project/User/AccountPolicy/server.hpp>
 #include <unordered_map>
+#include <variant>
 #include "users.hpp"
 
 namespace phosphor
@@ -32,6 +33,27 @@
 using AccountPolicyIface =
     sdbusplus::xyz::openbmc_project::User::server::AccountPolicy;
 
+using Privilege = std::string;
+using GroupList = std::vector<std::string>;
+using UserEnabled = bool;
+using PropertyName = std::string;
+
+using UserInfo = std::variant<Privilege, GroupList, UserEnabled>;
+using UserInfoMap = std::map<PropertyName, UserInfo>;
+
+using DbusUserObjPath = sdbusplus::message::object_path;
+
+using DbusUserPropVariant = sdbusplus::message::variant<Privilege>;
+
+using DbusUserObjProperties =
+    std::vector<std::pair<PropertyName, DbusUserPropVariant>>;
+
+using Interface = std::string;
+
+using DbusUserObjValue = std::map<Interface, DbusUserObjProperties>;
+
+using DbusUserObj = std::map<DbusUserObjPath, DbusUserObjValue>;
+
 /** @class UserMgr
  *  @brief Responsible for managing user accounts over the D-Bus interface.
  */
@@ -141,6 +163,17 @@
     bool userLockedForFailedAttempt(const std::string &userName,
                                     const bool &value);
 
+    /** @brief returns user info
+     * Checks if user is local user, then returns map of properties of user.
+     * like user privilege, list of user groups, user enabled state and user
+     * locked state. If its not local user, then it checks if its a ldap user,
+     * then it gets the privilege mapping of the LDAP group.
+     *
+     * @param[in] - user name
+     * @return -  map of user properties
+     **/
+    UserInfoMap getUserInfo(std::string userName) override;
+
   private:
     /** @brief sdbusplus handler */
     sdbusplus::bus::bus &bus;
@@ -275,6 +308,30 @@
     int setPamModuleArgValue(const std::string &moduleName,
                              const std::string &argName,
                              const std::string &argValue);
+
+    /** @brief get service name
+     *  method to get dbus service name
+     *
+     *  @param[in] path - object path
+     *  @param[in] intf - interface
+     *  @return - service name
+     */
+    std::string getServiceName(std::string &&path, std::string &&intf);
+
+    /** @brief get LDAP group name
+     *  method to get LDAP group name for the given LDAP user
+     *
+     *  @param[in] - userName
+     *  @return - group name
+     */
+    std::string getLdapGroupName(const std::string &userName);
+
+    /** @brief get privilege mapper object
+     *  method to get dbus privilege mapper object
+     *
+     *  @return - map of user object
+     */
+    DbusUserObj getPrivilegeMapperObject(void);
 };
 
 } // namespace user