summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop.cpp
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2022-05-10 17:54:01 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-24 05:17:25 +0000
commit4fab61e9c5006e9a4c06860dc9e49e1d422ee859 (patch)
treec383da8e16d40422c3dff8dea6a38c6e2935e256 /src/mongo/db/curop.cpp
parentd3dae653da44b8cb87ff2a9687c0468aa52b6b44 (diff)
downloadmongo-4fab61e9c5006e9a4c06860dc9e49e1d422ee859.tar.gz
SERVER-66360 Remove multi-user authentication support
Diffstat (limited to 'src/mongo/db/curop.cpp')
-rw-r--r--src/mongo/db/curop.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/mongo/db/curop.cpp b/src/mongo/db/curop.cpp
index 17953399f68..08158554ad9 100644
--- a/src/mongo/db/curop.cpp
+++ b/src/mongo/db/curop.cpp
@@ -204,10 +204,7 @@ void CurOp::reportCurrentOpForClient(OperationContext* opCtx,
const auto serializeAuthenticatedUsers = [&](StringData name) {
if (authSession->isAuthenticated()) {
BSONArrayBuilder users(infoBuilder->subarrayStart(name));
- for (auto userIt = authSession->getAuthenticatedUserNames(); userIt.more();
- userIt.next()) {
- userIt->serializeToBSON(&users);
- }
+ authSession->getAuthenticatedUserName()->serializeToBSON(&users);
}
};
@@ -1109,28 +1106,16 @@ void OpDebug::append(OperationContext* opCtx,
void OpDebug::appendUserInfo(const CurOp& c,
BSONObjBuilder& builder,
AuthorizationSession* authSession) {
- UserNameIterator nameIter = authSession->getAuthenticatedUserNames();
-
- UserName bestUser;
- if (nameIter.more())
- bestUser = *nameIter;
-
std::string opdb(nsToDatabase(c.getNS()));
BSONArrayBuilder allUsers(builder.subarrayStart("allUsers"));
- for (; nameIter.more(); nameIter.next()) {
- BSONObjBuilder nextUser(allUsers.subobjStart());
- nextUser.append(AuthorizationManager::USER_NAME_FIELD_NAME, nameIter->getUser());
- nextUser.append(AuthorizationManager::USER_DB_FIELD_NAME, nameIter->getDB());
- nextUser.doneFast();
-
- if (nameIter->getDB() == opdb) {
- bestUser = *nameIter;
- }
+ auto name = authSession->getAuthenticatedUserName();
+ if (name) {
+ name->serializeToBSON(&allUsers);
}
allUsers.doneFast();
- builder.append("user", bestUser.getUser().empty() ? "" : bestUser.getDisplayName());
+ builder.append("user", name ? name->getDisplayName() : "");
}
std::function<BSONObj(ProfileFilter::Args)> OpDebug::appendStaged(StringSet requestedFields,