updateGroupsAndPriv: fix bugs and add tests
This commit adds a unit test for the |updateGroupsAndPriv| function.
Thanks to the test case, I found a bug that the exsting codes don't
updat the groups and privilege of the user after updating.
Added several neccessary functions to add unit test and fix bugs.
Tested: unit test passed.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ifcf88505f10b6bfdcca2de31a29ce055153463e8
diff --git a/user_mgr.hpp b/user_mgr.hpp
index b057bf0..a535cc2 100644
--- a/user_mgr.hpp
+++ b/user_mgr.hpp
@@ -160,7 +160,7 @@
* @param[in] priv - Privilege to be updated.
*/
void updateGroupsAndPriv(const std::string& userName,
- const std::vector<std::string>& groups,
+ std::vector<std::string> groups,
const std::string& priv);
/** @brief Update user enabled state.
@@ -316,6 +316,9 @@
virtual void executeUserRename(const char* userName,
const char* newUserName);
+ virtual void executeUserModify(const char* userName, const char* newGroups,
+ bool sshRequested);
+
/** @brief check for valid privielge
* method to check valid privilege, and throw if invalid
*