diff options
author | Andreas Nilsson <andreas.nilsson@10gen.com> | 2015-09-08 09:46:53 -0400 |
---|---|---|
committer | Andreas Nilsson <andreas.nilsson@10gen.com> | 2015-09-08 10:47:48 -0400 |
commit | d9a98b851736689d5913e4817179889ee75a475c (patch) | |
tree | a0c11f364f2b38a4576e73990eca5dbf5ca80f5c /src/mongo/db/commands/user_management_commands_common.cpp | |
parent | 526742267e208954e531c102784c0599ceba579f (diff) | |
download | mongo-d9a98b851736689d5913e4817179889ee75a475c.tar.gz |
SERVER-19721 Restore the authSchemaUpgrade command
Fixed mongos rebase error for catalogManager(txn)
Diffstat (limited to 'src/mongo/db/commands/user_management_commands_common.cpp')
-rw-r--r-- | src/mongo/db/commands/user_management_commands_common.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/commands/user_management_commands_common.cpp b/src/mongo/db/commands/user_management_commands_common.cpp index 64aee9eca51..09445c5aea7 100644 --- a/src/mongo/db/commands/user_management_commands_common.cpp +++ b/src/mongo/db/commands/user_management_commands_common.cpp @@ -522,6 +522,14 @@ Status checkAuthForMergeAuthzCollectionsCommand(ClientBasic* client, const BSONO return Status::OK(); } +Status checkAuthForAuthSchemaUpgradeCommand(ClientBasic* client) { + AuthorizationSession* authzSession = AuthorizationSession::get(client); + if (!authzSession->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(), + ActionType::authSchemaUpgrade)) { + return Status(ErrorCodes::Unauthorized, "Not authorized to run authSchemaUpgrade command."); + } + return Status::OK(); +} } // namespace auth } // namespace mongo |