Status AuthorizationManagerImpl::_fetchUserV2(OperationContext* opCtx, const UserName& userName, std::unique_ptr<User>* out) { BSONObj userObj; Status status = getUserDescription(opCtx, userName, &userObj); if (!status.isOK()) { return status; } auto user = std::make_unique<User>(userName); status = _initializeUserFromPrivilegeDocument(user.get(), userObj); if (!status.isOK()) { return status; } std::swap(*out, user); return Status::OK(); }
Status AuthorizationManager::_fetchUserV2(OperationContext* txn, const UserName& userName, std::auto_ptr<User>* acquiredUser) { BSONObj userObj; Status status = getUserDescription(txn, userName, &userObj); if (!status.isOK()) { return status; } // Put the new user into an auto_ptr temporarily in case there's an error while // initializing the user. std::auto_ptr<User> user(new User(userName)); status = _initializeUserFromPrivilegeDocument(user.get(), userObj); if (!status.isOK()) { return status; } acquiredUser->reset(user.release()); return Status::OK(); }
Status AuthorizationManagerImpl::_fetchUserV2(OperationContext* opCtx, const UserName& userName, std::unique_ptr<User>* acquiredUser) { BSONObj userObj; Status status = getUserDescription(opCtx, userName, &userObj); if (!status.isOK()) { return status; } // Put the new user into an unique_ptr temporarily in case there's an error while // initializing the user. auto user = stdx::make_unique<User>(userName); status = _initializeUserFromPrivilegeDocument(user.get(), userObj); if (!status.isOK()) { return status; } acquiredUser->reset(user.release()); return Status::OK(); }