summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/connection_status.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/connection_status.cpp
parentd3dae653da44b8cb87ff2a9687c0468aa52b6b44 (diff)
downloadmongo-4fab61e9c5006e9a4c06860dc9e49e1d422ee859.tar.gz
SERVER-66360 Remove multi-user authentication support
Diffstat (limited to 'src/mongo/db/commands/connection_status.cpp')
-rw-r--r--src/mongo/db/commands/connection_status.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/commands/connection_status.cpp b/src/mongo/db/commands/connection_status.cpp
index 1e688d2274b..903fc7fce38 100644
--- a/src/mongo/db/commands/connection_status.cpp
+++ b/src/mongo/db/commands/connection_status.cpp
@@ -50,7 +50,11 @@ public:
auto* as = AuthorizationSession::get(opCtx->getClient());
ConnectionStatusReplyAuthInfo info;
- info.setAuthenticatedUsers(iteratorToVector<UserName>(as->getAuthenticatedUserNames()));
+ std::vector<UserName> userNames;
+ if (auto userName = as->getAuthenticatedUserName()) {
+ userNames.push_back(std::move(userName.get()));
+ }
+ info.setAuthenticatedUsers(std::move(userNames));
info.setAuthenticatedUserRoles(
iteratorToVector<RoleName>(as->getAuthenticatedRoleNames()));
if (request().getShowPrivileges()) {
@@ -77,9 +81,8 @@ public:
// entries in the connection status output.
User::ResourcePrivilegeMap unified;
- for (auto nameIt = as->getAuthenticatedUserNames(); nameIt.more(); nameIt.next()) {
- auto* authUser = as->lookupUser(*nameIt);
- for (const auto& privIter : authUser->getPrivileges()) {
+ if (auto authUser = as->getAuthenticatedUser()) {
+ for (const auto& privIter : authUser.get()->getPrivileges()) {
auto it = unified.find(privIter.first);
if (it == unified.end()) {
unified[privIter.first] = privIter.second;