diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2017-08-15 10:56:11 -0400 |
---|---|---|
committer | Gabriel Russell <gabriel.russell@mongodb.com> | 2017-09-21 15:41:06 -0400 |
commit | 305f4366320ba2538f077c28d0f3ea6979277c48 (patch) | |
tree | 683be295499125aa86147bab7f1e018111ba5b7f /src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp | |
parent | 8beb002326a5fdd82c694497b7ebcb52a593a3d3 (diff) | |
download | mongo-305f4366320ba2538f077c28d0f3ea6979277c48.tar.gz |
SERVER-30430 Gate session use on featureCompatibilityVersion
Diffstat (limited to 'src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp')
-rw-r--r-- | src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp index 48387e69e88..c4147529484 100644 --- a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp +++ b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp @@ -72,11 +72,18 @@ public: Status checkAuthForOperation(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj) override { + + if (serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k34) { + return SessionsCommandFCV34Status(getName()); + } + AuthorizationSession* authSession = AuthorizationSession::get(opCtx->getClient()); if (!authSession->isAuthorizedForPrivilege( Privilege{ResourcePattern::forClusterResource(), ActionType::killAnySession})) { return Status(ErrorCodes::Unauthorized, "Unauthorized"); } + return Status::OK(); } @@ -84,6 +91,12 @@ public: const std::string& db, const BSONObj& cmdObj, BSONObjBuilder& result) override { + + if (serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k34) { + return appendCommandStatus(result, SessionsCommandFCV34Status(getName())); + } + IDLParserErrorContext ctx("KillAllSessionsByPatternCmd"); auto ksc = KillAllSessionsByPatternCmd::parse(ctx, cmdObj); |