summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpencer Jackson <spencer.jackson@mongodb.com>2018-11-27 12:02:02 -0500
committerSpencer Jackson <spencer.jackson@mongodb.com>2018-12-03 17:43:53 -0500
commit74921ac92c1330f754eed39c8e7148955aca2be9 (patch)
treeeed5f46b6cd11e0e5edaf907988a91dd107d42fa /src
parentf439d76860cf8307c5d6ba3fe421b8c88a7c3d8c (diff)
downloadmongo-74921ac92c1330f754eed39c8e7148955aca2be9.tar.gz
SERVER-28871: Remove user management command write concern backwards compatibility
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands.h8
-rw-r--r--src/mongo/db/commands/user_management_commands.cpp60
-rw-r--r--src/mongo/db/service_entry_point_mongod.cpp9
3 files changed, 0 insertions, 77 deletions
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h
index aed2407f8f8..3d06532c17d 100644
--- a/src/mongo/db/commands.h
+++ b/src/mongo/db/commands.h
@@ -304,14 +304,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 18d112112b9..967af4dfdbe 100644
--- a/src/mongo/db/commands/user_management_commands.cpp
+++ b/src/mongo/db/commands/user_management_commands.cpp
@@ -770,10 +770,6 @@ class CmdCreateUser : public BasicCommand {
public:
CmdCreateUser() : BasicCommand("createUser") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -895,10 +891,6 @@ class CmdUpdateUser : public BasicCommand {
public:
CmdUpdateUser() : BasicCommand("updateUser") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1022,10 +1014,6 @@ class CmdDropUser : public BasicCommand {
public:
CmdDropUser() : BasicCommand("dropUser") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1084,10 +1072,6 @@ class CmdDropAllUsersFromDatabase : public BasicCommand {
public:
CmdDropAllUsersFromDatabase() : BasicCommand("dropAllUsersFromDatabase") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1136,10 +1120,6 @@ class CmdGrantRolesToUser : public BasicCommand {
public:
CmdGrantRolesToUser() : BasicCommand("grantRolesToUser") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1203,10 +1183,6 @@ class CmdRevokeRolesFromUser : public BasicCommand {
public:
CmdRevokeRolesFromUser() : BasicCommand("revokeRolesFromUser") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1424,10 +1400,6 @@ class CmdCreateRole : public BasicCommand {
public:
CmdCreateRole() : BasicCommand("createRole") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1528,10 +1500,6 @@ class CmdUpdateRole : public BasicCommand {
public:
CmdUpdateRole() : BasicCommand("updateRole") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1634,10 +1602,6 @@ class CmdGrantPrivilegesToRole : public BasicCommand {
public:
CmdGrantPrivilegesToRole() : BasicCommand("grantPrivilegesToRole") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1729,10 +1693,6 @@ class CmdRevokePrivilegesFromRole : public BasicCommand {
public:
CmdRevokePrivilegesFromRole() : BasicCommand("revokePrivilegesFromRole") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1827,10 +1787,6 @@ class CmdGrantRolesToRole : public BasicCommand {
public:
CmdGrantRolesToRole() : BasicCommand("grantRolesToRole") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1907,10 +1863,6 @@ class CmdRevokeRolesFromRole : public BasicCommand {
public:
CmdRevokeRolesFromRole() : BasicCommand("revokeRolesFromRole") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -1984,10 +1936,6 @@ class CmdDropRole : public BasicCommand {
public:
CmdDropRole() : BasicCommand("dropRole") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -2120,10 +2068,6 @@ class CmdDropAllRolesFromDatabase : public BasicCommand {
public:
CmdDropAllRolesFromDatabase() : BasicCommand("dropAllRolesFromDatabase") {}
- bool isUserManagementCommand() const override {
- return true;
- }
-
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
@@ -2410,10 +2354,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 d09db7a73ed..60dfe11f99c 100644
--- a/src/mongo/db/service_entry_point_mongod.cpp
+++ b/src/mongo/db/service_entry_point_mongod.cpp
@@ -102,15 +102,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::appendCommandStatusNoThrow(commandResponseBuilder, waitForWCStatus);
- commandResponseBuilder.appendElementsUnique(temp);
- }
}
void waitForLinearizableReadConcern(OperationContext* opCtx) const override {