diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2018-04-24 12:14:18 -0400 |
---|---|---|
committer | Billy Donahue <billy.donahue@mongodb.com> | 2018-04-24 16:34:41 -0400 |
commit | 76bc4f800ba2a103d67fa4600d3946f255927818 (patch) | |
tree | 41753625aad1bcca379adb81bf6e58f4d3268fb8 | |
parent | c963ca0e1c6ef2f6fe4910e0e149cc2b2cbe602a (diff) | |
download | mongo-76bc4f800ba2a103d67fa4600d3946f255927818.tar.gz |
SERVER-28871 remove obsolete Command::isUserManagementCommand
-rw-r--r-- | src/mongo/db/commands.h | 8 | ||||
-rw-r--r-- | src/mongo/db/commands/user_management_commands.cpp | 60 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_mongod.cpp | 9 |
3 files changed, 0 insertions, 77 deletions
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index 564c1d1ef75..432866c5dcd 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -255,14 +255,6 @@ public: } /** - * Return true for "user management commands", a distinction that affects - * backward compatible output formatting. - */ - virtual bool isUserManagementCommand() const { - return false; - } - - /** * Return true if only the admin ns has privileges to run this command. */ virtual bool adminOnly() const { diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp index fd3519d4871..b38338e6f57 100644 --- a/src/mongo/db/commands/user_management_commands.cpp +++ b/src/mongo/db/commands/user_management_commands.cpp @@ -744,10 +744,6 @@ class CmdCreateUser : public BasicCommand { public: CmdCreateUser() : BasicCommand("createUser") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -890,10 +886,6 @@ class CmdUpdateUser : public BasicCommand { public: CmdUpdateUser() : BasicCommand("updateUser") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1036,10 +1028,6 @@ class CmdDropUser : public BasicCommand { public: CmdDropUser() : BasicCommand("dropUser") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1107,10 +1095,6 @@ class CmdDropAllUsersFromDatabase : public BasicCommand { public: CmdDropAllUsersFromDatabase() : BasicCommand("dropAllUsersFromDatabase") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1167,10 +1151,6 @@ class CmdGrantRolesToUser : public BasicCommand { public: CmdGrantRolesToUser() : BasicCommand("grantRolesToUser") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1243,10 +1223,6 @@ class CmdRevokeRolesFromUser : public BasicCommand { public: CmdRevokeRolesFromUser() : BasicCommand("revokeRolesFromUser") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1482,10 +1458,6 @@ class CmdCreateRole : public BasicCommand { public: CmdCreateRole() : BasicCommand("createRole") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1607,10 +1579,6 @@ class CmdUpdateRole : public BasicCommand { public: CmdUpdateRole() : BasicCommand("updateRole") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1728,10 +1696,6 @@ class CmdGrantPrivilegesToRole : public BasicCommand { public: CmdGrantPrivilegesToRole() : BasicCommand("grantPrivilegesToRole") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1842,10 +1806,6 @@ class CmdRevokePrivilegesFromRole : public BasicCommand { public: CmdRevokePrivilegesFromRole() : BasicCommand("revokePrivilegesFromRole") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1958,10 +1918,6 @@ class CmdGrantRolesToRole : public BasicCommand { public: CmdGrantRolesToRole() : BasicCommand("grantRolesToRole") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -2051,10 +2007,6 @@ class CmdRevokeRolesFromRole : public BasicCommand { public: CmdRevokeRolesFromRole() : BasicCommand("revokeRolesFromRole") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -2139,10 +2091,6 @@ class CmdDropRole : public BasicCommand { public: CmdDropRole() : BasicCommand("dropRole") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -2285,10 +2233,6 @@ class CmdDropAllRolesFromDatabase : public BasicCommand { public: CmdDropAllRolesFromDatabase() : BasicCommand("dropAllRolesFromDatabase") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -2591,10 +2535,6 @@ class CmdMergeAuthzCollections : public BasicCommand { public: CmdMergeAuthzCollections() : BasicCommand("_mergeAuthzCollections") {} - bool isUserManagementCommand() const override { - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp index 59267d2ad18..26cbd30d235 100644 --- a/src/mongo/db/service_entry_point_mongod.cpp +++ b/src/mongo/db/service_entry_point_mongod.cpp @@ -88,15 +88,6 @@ public: mongo::waitForWriteConcern(opCtx, lastOpAfterRun, opCtx->getWriteConcern(), &res); CommandHelpers::appendCommandWCStatus(commandResponseBuilder, waitForWCStatus, res); - - // SERVER-22421: This code is to ensure error response backwards compatibility with the - // user management commands. This can be removed in 3.6. - if (!waitForWCStatus.isOK() && invocation->definition()->isUserManagementCommand()) { - BSONObj temp = commandResponseBuilder.asTempObj().copy(); - commandResponseBuilder.resetToEmpty(); - CommandHelpers::appendCommandStatus(commandResponseBuilder, waitForWCStatus); - commandResponseBuilder.appendElementsUnique(temp); - } } void waitForLinearizableReadConcern(OperationContext* opCtx) const override { |