diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2018-05-02 15:13:10 -0400 |
---|---|---|
committer | Billy Donahue <billy.donahue@mongodb.com> | 2018-05-02 16:10:07 -0400 |
commit | dbbd060edc2180b5aac94bd8f645530f7e486899 (patch) | |
tree | efd4486cf70dae89494b52534f5c3764194103d1 /src/mongo/db/commands | |
parent | fd9eef9377ab1be148df2eb96ac26da41a222801 (diff) | |
download | mongo-dbbd060edc2180b5aac94bd8f645530f7e486899.tar.gz |
SERVER-34653 Add 'AuthorizationSession::isAuthenticated()'
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/current_op.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/commands/kill_op_cmd_base.cpp | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/mongo/db/commands/current_op.cpp b/src/mongo/db/commands/current_op.cpp index 20d652fcaf2..a53d7876c2c 100644 --- a/src/mongo/db/commands/current_op.cpp +++ b/src/mongo/db/commands/current_op.cpp @@ -55,8 +55,7 @@ public: return Status::OK(); } - bool isAuthenticated = authzSession->getAuthenticatedUserNames().more(); - if (isAuthenticated && cmdObj["$ownOps"].trueValue()) { + if (authzSession->isAuthenticated() && cmdObj["$ownOps"].trueValue()) { return Status::OK(); } diff --git a/src/mongo/db/commands/kill_op_cmd_base.cpp b/src/mongo/db/commands/kill_op_cmd_base.cpp index 50035b03eea..d6763a506fb 100644 --- a/src/mongo/db/commands/kill_op_cmd_base.cpp +++ b/src/mongo/db/commands/kill_op_cmd_base.cpp @@ -51,8 +51,7 @@ Status KillOpCmdBase::checkAuthForCommand(Client* client, return Status::OK(); } - bool isAuthenticated = AuthorizationSession::get(client)->getAuthenticatedUserNames().more(); - if (isAuthenticated && isKillingLocalOp(cmdObj.getField("op"))) { + if (authzSession->isAuthenticated() && isKillingLocalOp(cmdObj.getField("op"))) { // Look up the OperationContext and see if we have permission to kill it. This is done once // here and again in the command body. The check here in the checkAuthForCommand() function // is necessary because if the check fails, it will be picked up by the auditing system. |