diff options
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r-- | src/mongo/db/s/SConscript | 2 | ||||
-rw-r--r-- | src/mongo/db/s/cluster_find_cmd_d.cpp | 58 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript index 8f37f180c1b..c2d83bdaedc 100644 --- a/src/mongo/db/s/SConscript +++ b/src/mongo/db/s/SConscript @@ -308,6 +308,7 @@ env.Library( 'cleanup_orphaned_cmd.cpp', 'clone_catalog_data_command.cpp', 'clone_collection_options_from_primary_shard_cmd.cpp', + 'cluster_find_cmd_d.cpp', 'collmod_coordinator.cpp', 'collmod_coordinator_document.idl', 'config/set_cluster_parameter_coordinator.cpp', @@ -426,6 +427,7 @@ env.Library( '$BUILD_DIR/mongo/db/timeseries/timeseries_conversion_util', '$BUILD_DIR/mongo/db/timeseries/timeseries_options', '$BUILD_DIR/mongo/idl/cluster_server_parameter', + '$BUILD_DIR/mongo/s/commands/cluster_commands_common', '$BUILD_DIR/mongo/s/commands/sharded_cluster_sharding_commands', '$BUILD_DIR/mongo/s/sharding_initialization', '$BUILD_DIR/mongo/s/sharding_router_api', diff --git a/src/mongo/db/s/cluster_find_cmd_d.cpp b/src/mongo/db/s/cluster_find_cmd_d.cpp new file mode 100644 index 00000000000..7bc45e4cc1d --- /dev/null +++ b/src/mongo/db/s/cluster_find_cmd_d.cpp @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2022-present MongoDB, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Server Side Public License, version 1, + * as published by MongoDB, Inc. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Server Side Public License for more details. + * + * You should have received a copy of the Server Side Public License + * along with this program. If not, see + * <http://www.mongodb.com/licensing/server-side-public-license>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the Server Side Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#include "mongo/s/commands/cluster_find_cmd.h" + +namespace mongo { +namespace { + +/** + * Implements the cluster find command on mongod. + */ +struct ClusterFindCmdD { + static constexpr StringData kName = "clusterFind"_sd; + + static const std::set<std::string>& getApiVersions() { + return kNoApiVersions; + } + + static void doCheckAuthorization(OperationContext* opCtx, + bool hasTerm, + const NamespaceString& nss) { + uassert(ErrorCodes::Unauthorized, + "Unauthorized", + AuthorizationSession::get(opCtx->getClient()) + ->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(), + ActionType::internal)); + } +}; +ClusterFindCmdBase<ClusterFindCmdD> clusterFindCmdD; + +} // namespace +} // namespace mongo |