summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth
diff options
context:
space:
mode:
authoraldo-aguilar <aldo.aguilar@mongodb.com>2021-06-07 19:58:09 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-08 15:21:40 +0000
commit787e5d3e46eb68156d85da5ed43a5d4e34ad4e46 (patch)
tree49281cdc302b2904333181e4682f7e1307455159 /src/mongo/db/auth
parent357a25d3857d87310a47b530e19ba94a18336f60 (diff)
downloadmongo-787e5d3e46eb68156d85da5ed43a5d4e34ad4e46.tar.gz
SERVER-45161 Remove AuthorizationManagerWithExplicitUserPrivilegesTest
Diffstat (limited to 'src/mongo/db/auth')
-rw-r--r--src/mongo/db/auth/authorization_manager_test.cpp41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/mongo/db/auth/authorization_manager_test.cpp b/src/mongo/db/auth/authorization_manager_test.cpp
index 23269084d1b..001433e82f9 100644
--- a/src/mongo/db/auth/authorization_manager_test.cpp
+++ b/src/mongo/db/auth/authorization_manager_test.cpp
@@ -214,47 +214,6 @@ TEST_F(AuthorizationManagerTest, testLocalX509AuthenticationNoAuthorization) {
#endif
-/**
- * An implementation of AuthzManagerExternalStateMock that overrides the getUserDescription method
- * to return the user document unmodified from how it was inserted. When using this insert user
- * documents in the format that would be returned from a usersInfo command run with
- * showPrivilges:true, rather than the format that would normally be stored in a system.users
- * collection. The main difference between using this mock and the normal
- * AuthzManagerExternalStateMock is that with this one you should specify the 'inheritedPrivileges'
- * field in any user documents added.
- */
-class AuthzManagerExternalStateMockWithExplicitUserPrivileges
- : public AuthzManagerExternalStateMock {
-public:
- /**
- * This version of getUserDescription just loads the user doc directly as it was inserted into
- * the mock's user document catalog, without performing any role resolution. This way the tests
- * can control exactly what privileges are returned for the user.
- */
- Status getUserDescription(OperationContext* opCtx,
- const UserRequest& user,
- BSONObj* result) override {
- return _getUserDocument(opCtx, user.name, result);
- }
-
-private:
- Status _getUserDocument(OperationContext* opCtx, const UserName& userName, BSONObj* userDoc) {
- Status status =
- findOne(opCtx,
- AuthorizationManager::usersCollectionNamespace,
- BSON(AuthorizationManager::USER_NAME_FIELD_NAME
- << userName.getUser() << AuthorizationManager::USER_DB_FIELD_NAME
- << userName.getDB()),
- userDoc);
- if (status == ErrorCodes::NoMatchingDocument) {
- status = Status(ErrorCodes::UserNotFound,
- str::stream() << "Could not find user \"" << userName.getUser()
- << "\" for db \"" << userName.getDB() << "\"");
- }
- return status;
- }
-};
-
// Tests SERVER-21535, unrecognized actions should be ignored rather than causing errors.
TEST_F(AuthorizationManagerTest, testAcquireV2UserWithUnrecognizedActions) {
ASSERT_OK(externalState->insertPrivilegeDocument(