summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shuvalov <andrew.shuvalov@mongodb.com>2021-03-01 22:18:58 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-01 22:44:46 +0000
commit33a8c0755e5d0e6202bdc5bb746fcb9ff9645766 (patch)
treed1bd03ecb7e53a78c359f67ff25b4b394b86b24f
parent4fbc6225a2baaaea78c73ded66048a198677e335 (diff)
downloadmongo-33a8c0755e5d0e6202bdc5bb746fcb9ff9645766.tar.gz
Revert "SERVER-54650: Make recipientSyncData and recipientForgetMigration require runTenantMigration action type"
This reverts commit f30e562830d4790afbf86d03a583b9cacc30a382.
-rw-r--r--jstests/auth/lib/commands_lib.js46
-rw-r--r--src/mongo/db/commands/tenant_migration_donor_cmds.cpp8
-rw-r--r--src/mongo/db/commands/tenant_migration_recipient_cmds.cpp21
3 files changed, 8 insertions, 67 deletions
diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js
index 8a25515f5e6..5227dda8ebc 100644
--- a/jstests/auth/lib/commands_lib.js
+++ b/jstests/auth/lib/commands_lib.js
@@ -3419,52 +3419,6 @@ var authCommandsLib = {
]
},
{
- testname: "recipientSyncData",
- command: {
- recipientSyncData: 1,
- migrationId: UUID(),
- donorConnectionString: "donor-rs/localhost:1234",
- tenantId: "testTenantId",
- readPreference: {mode: "primary"},
- startMigrationDonorTimestamp: Timestamp(1, 1),
- recipientCertificateForDonor: migrationCertificates.recipientCertificateForDonor,
- },
- skipSharded: true,
- testcases: [
- {
- runOnDb: adminDbName,
- roles: roles_clusterManager,
- privileges: [{resource: {cluster: true}, actions: ["runTenantMigration"]}],
- // Cannot start tenant migration on a standalone mongod.
- expectFail: true,
- },
- {runOnDb: firstDbName, roles: {}},
- {runOnDb: secondDbName, roles: {}}
- ]
- },
- {
- testname: "recipientForgetMigration",
- command: {
- recipientForgetMigration: 1,
- migrationId: UUID(),
- donorConnectionString: "donor-rs/localhost:1234",
- tenantId: "testTenantId",
- readPreference: {mode: "primary"},
- },
- skipSharded: true,
- testcases: [
- {
- runOnDb: adminDbName,
- roles: roles_clusterManager,
- privileges: [{resource: {cluster: true}, actions: ["runTenantMigration"]}],
- // This is expected to fail with InvalidOptions without cluster certificate.
- expectFail: true,
- },
- {runOnDb: firstDbName, roles: {}},
- {runOnDb: secondDbName, roles: {}}
- ]
- },
- {
testname: "drop",
command: {drop: "x"},
setup: function(db) {
diff --git a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp
index 3df446a8b77..19eb886ce20 100644
--- a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp
+++ b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp
@@ -126,8 +126,7 @@ public:
return response;
}
- private:
- void doCheckAuthorization(OperationContext* opCtx) const final {
+ void doCheckAuthorization(OperationContext* opCtx) const {
uassert(ErrorCodes::Unauthorized,
"Unauthorized",
AuthorizationSession::get(opCtx->getClient())
@@ -135,6 +134,7 @@ public:
ActionType::runTenantMigration));
}
+ private:
bool supportsWriteConcern() const override {
return false;
}
@@ -196,7 +196,7 @@ public:
}
private:
- void doCheckAuthorization(OperationContext* opCtx) const final {
+ void doCheckAuthorization(OperationContext* opCtx) const {
uassert(ErrorCodes::Unauthorized,
"Unauthorized",
AuthorizationSession::get(opCtx->getClient())
@@ -285,7 +285,7 @@ public:
}
private:
- void doCheckAuthorization(OperationContext* opCtx) const final {
+ void doCheckAuthorization(OperationContext* opCtx) const {
uassert(ErrorCodes::Unauthorized,
"Unauthorized",
AuthorizationSession::get(opCtx->getClient())
diff --git a/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp b/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp
index 6a26c8c9fec..d8a917e5c3d 100644
--- a/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp
+++ b/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp
@@ -28,7 +28,6 @@
*/
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
-#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/commands.h"
#include "mongo/db/commands/feature_compatibility_version_parser.h"
#include "mongo/db/commands/tenant_migration_donor_cmds_gen.h"
@@ -129,15 +128,9 @@ public:
}
}
- private:
- void doCheckAuthorization(OperationContext* opCtx) const final {
- uassert(ErrorCodes::Unauthorized,
- "Unauthorized",
- AuthorizationSession::get(opCtx->getClient())
- ->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
- ActionType::runTenantMigration));
- }
+ void doCheckAuthorization(OperationContext* opCtx) const {}
+ private:
bool supportsWriteConcern() const override {
return false;
}
@@ -211,15 +204,9 @@ public:
recipientInstance->getCompletionFuture().get(opCtx);
}
- private:
- void doCheckAuthorization(OperationContext* opCtx) const final {
- uassert(ErrorCodes::Unauthorized,
- "Unauthorized",
- AuthorizationSession::get(opCtx->getClient())
- ->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
- ActionType::runTenantMigration));
- }
+ void doCheckAuthorization(OperationContext* opCtx) const {}
+ private:
bool supportsWriteConcern() const override {
return false;
}