| 51 | } |
| 52 | |
| 53 | bool UserManager::AddUser(const std::string& user_name, const UserInfo& user_info) { |
| 54 | MutexLock locker(&mutex_); |
| 55 | std::shared_ptr<User> user(new User(user_name, user_info)); |
| 56 | user->SetUserInfo(user_info); |
| 57 | |
| 58 | std::pair<UserList::iterator, bool> ret = |
| 59 | all_users_.insert(std::pair<std::string, UserPtr>(user_name, user)); |
| 60 | if (ret.second) { |
| 61 | LOG(INFO) << "[user-manager] add user: " << user_name << " success"; |
| 62 | } else { |
| 63 | LOG(INFO) << "[user-manager] add user: " << user_name << " failed: user exists"; |
| 64 | } |
| 65 | return ret.second; |
| 66 | } |
| 67 | |
| 68 | bool UserManager::DeleteUser(const std::string& user_name) { |
| 69 | MutexLock locker(&mutex_); |
no test coverage detected