summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/kill_op_cmd_base.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/commands/kill_op_cmd_base.cpp
parentd3dae653da44b8cb87ff2a9687c0468aa52b6b44 (diff)
downloadmongo-4fab61e9c5006e9a4c06860dc9e49e1d422ee859.tar.gz
SERVER-66360 Remove multi-user authentication support
Diffstat (limited to 'src/mongo/db/commands/kill_op_cmd_base.cpp')
-rw-r--r--src/mongo/db/commands/kill_op_cmd_base.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/commands/kill_op_cmd_base.cpp b/src/mongo/db/commands/kill_op_cmd_base.cpp
index bace16861bc..a056e6cc514 100644
--- a/src/mongo/db/commands/kill_op_cmd_base.cpp
+++ b/src/mongo/db/commands/kill_op_cmd_base.cpp
@@ -53,8 +53,11 @@ void KillOpCmdBase::reportSuccessfulCompletion(OperationContext* opCtx,
auto client = opCtx->getClient();
if (client) {
if (AuthorizationManager::get(client->getServiceContext())->isAuthEnabled()) {
- auto user = AuthorizationSession::get(client)->getAuthenticatedUserNames();
- attr.add("user", user->toBSON());
+ if (auto user = AuthorizationSession::get(client)->getAuthenticatedUserName()) {
+ attr.add("user", BSON_ARRAY(user->toBSON()));
+ } else {
+ attr.add("user", BSONArray());
+ }
}
if (client->session()) {