diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-05-11 17:36:52 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2015-05-14 18:59:03 -0400 |
commit | 463d3343d559590d60cfd5c48ac98ad675d5390e (patch) | |
tree | 5ab045f64656074016c08229ae0bcc6734579e6e /src/mongo/db/commands/clone.cpp | |
parent | 22de12dd4ac510cd2a37b643eb528673f651e21b (diff) | |
download | mongo-463d3343d559590d60cfd5c48ac98ad675d5390e.tar.gz |
SERVER-18227 Add bypassDocumentValidation option to commands that need it
Diffstat (limited to 'src/mongo/db/commands/clone.cpp')
-rw-r--r-- | src/mongo/db/commands/clone.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/commands/clone.cpp b/src/mongo/db/commands/clone.cpp index 78b576553b3..76a801caa35 100644 --- a/src/mongo/db/commands/clone.cpp +++ b/src/mongo/db/commands/clone.cpp @@ -36,6 +36,7 @@ #include "mongo/db/auth/resource_pattern.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection.h" +#include "mongo/db/catalog/document_validation.h" #include "mongo/db/cloner.h" #include "mongo/db/commands.h" #include "mongo/db/commands/copydb.h" @@ -80,6 +81,10 @@ namespace mongo { ActionSet actions; actions.addAction(ActionType::insert); actions.addAction(ActionType::createIndex); + if (shouldBypassDocumentValidationforCommand(cmdObj)) { + actions.addAction(ActionType::bypassDocumentValidation); + } + if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource( ResourcePattern::forDatabaseName(dbname), actions)) { return Status(ErrorCodes::Unauthorized, "Unauthorized"); @@ -94,6 +99,10 @@ namespace mongo { string& errmsg, BSONObjBuilder& result) { + boost::optional<DisableDocumentValidation> maybeDisableValidation; + if (shouldBypassDocumentValidationforCommand(cmdObj)) + maybeDisableValidation.emplace(txn); + string from = cmdObj.getStringField("clone"); if ( from.empty() ) return false; |