diff options
author | Benety Goh <benety@mongodb.com> | 2021-02-06 07:57:41 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-06 13:22:48 +0000 |
commit | d77297f4a454073505741ae586c885e087b30165 (patch) | |
tree | 6a4d1ff53296597a75acf25b672f9a2b30e820d6 /src/mongo/db/auth | |
parent | 7664a855f33bbe7e0f77cee78cb07e564a4f0c4c (diff) | |
download | mongo-d77297f4a454073505741ae586c885e087b30165.tar.gz |
Revert "SERVER-53127 Let AggregationRequestHelper::parseFromBSON() return an AggregateCommand"
This reverts commit 6feae12fe29a4c921bdbf03dd8b1ae6d5dd27f92.
Diffstat (limited to 'src/mongo/db/auth')
-rw-r--r-- | src/mongo/db/auth/authorization_session_impl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/auth/authorization_session_impl.cpp b/src/mongo/db/auth/authorization_session_impl.cpp index 0f131648506..9b54154225e 100644 --- a/src/mongo/db/auth/authorization_session_impl.cpp +++ b/src/mongo/db/auth/authorization_session_impl.cpp @@ -90,14 +90,17 @@ Status checkAuthForCreateOrModifyView(AuthorizationSession* authzSession, return Status::OK(); } - auto request = aggregation_request_helper::parseFromBSON( + auto status = aggregation_request_helper::parseFromBSON( viewNs, BSON("aggregate" << viewOnNs.coll() << "pipeline" << viewPipeline << "cursor" << BSONObj() << "$db" << viewOnNs.db()), boost::none, false); + if (!status.isOK()) + return status.getStatus(); - auto statusWithPrivs = authzSession->getPrivilegesForAggregate(viewOnNs, request, isMongos); + auto statusWithPrivs = + authzSession->getPrivilegesForAggregate(viewOnNs, status.getValue(), isMongos); PrivilegeVector privileges = uassertStatusOK(statusWithPrivs); if (!authzSession->isAuthorizedForPrivileges(privileges)) { return Status(ErrorCodes::Unauthorized, "unauthorized"); |