Create / delete user with proper properties

Fixed code to create the user with default user properties
and clean-up the properties properly, when the user name is
cleared.

Unit-Test:
Verified that during Set User name, user is created with default
properties and user info in ipmi is fully cleaned during user
delete.

Change-Id: I5060fc9f3dd1b98adb43fd7560a9e742ce484fcb
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index 641abf0..eb95163 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -798,10 +798,7 @@
                               entry("PATH=%s", userPath.c_str()));
             return IPMI_CC_UNSPECIFIED_ERROR;
         }
-        std::fill(userInfo->userName,
-                  userInfo->userName + sizeof(userInfo->userName), 0);
-        ipmiClearUserEntryPassword(oldUser);
-        userInfo->userInSystem = false;
+        deleteUserIndex(userId);
     }
     else if (oldUser.empty() && !newUser.empty() && validUser)
     {
@@ -811,10 +808,7 @@
             auto method = bus.new_method_call(
                 getUserServiceName().c_str(), userMgrObjBasePath,
                 userMgrInterface, createUserMethod);
-            // TODO: Fetch proper privilege & enable state once set User access
-            // is implemented if LAN Channel specified, then create user for all
-            // groups follow channel privilege for user creation.
-            method.append(newUser.c_str(), availableGroups, "priv-admin", true);
+            method.append(newUser.c_str(), availableGroups, "", false);
             auto reply = bus.call(method);
         }
         catch (const sdbusplus::exception::SdBusError& e)