summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2022-05-06 00:18:03 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-09 19:23:36 +0000
commita13b628c6e0b5ebd047ecdf4470db88eca4be2c1 (patch)
tree6976232c81fe419cb36ff66c381dbb15fb9465c9
parent69ce4e665607fe143e6038f3653479ff2221b043 (diff)
downloadmongo-a13b628c6e0b5ebd047ecdf4470db88eca4be2c1.tar.gz
SERVER-66064 Fix fast count when authentication is enabled
(cherry picked from commit ee12644af8d8a500eb9c8242a2081c7a538d8b4c)
-rw-r--r--src/mongo/db/fle_crud.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/fle_crud.cpp b/src/mongo/db/fle_crud.cpp
index c041cedf79e..c561877aab1 100644
--- a/src/mongo/db/fle_crud.cpp
+++ b/src/mongo/db/fle_crud.cpp
@@ -40,6 +40,7 @@
#include "mongo/bson/bsontypes.h"
#include "mongo/crypto/encryption_fields_gen.h"
#include "mongo/crypto/fle_crypto.h"
+#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/ops/write_ops_gen.h"
#include "mongo/db/ops/write_ops_parsers.h"
@@ -1161,6 +1162,8 @@ uint64_t FLEQueryInterfaceImpl::countDocuments(const NamespaceString& nss) {
auto client = _serviceContext->makeClient("SEP-int-fle-crud");
AlternativeClientRegion clientRegion(client);
auto opCtx = cc().makeOperationContext();
+ auto as = AuthorizationSession::get(cc());
+ as->grantInternalAuthorization(opCtx.get());
CountCommandRequest ccr(nss);
auto opMsgRequest = ccr.serialize(BSONObj());