diff options
author | Jamie Heppenstall <jamie.heppenstall@mongodb.com> | 2019-06-14 17:43:03 -0400 |
---|---|---|
committer | Jamie Heppenstall <jamie.heppenstall@mongodb.com> | 2019-06-19 17:18:24 -0400 |
commit | d57200de0fcedae5ed71520bb1838c8c1a281b8d (patch) | |
tree | 10937ac26e7ef3c84ae38691cec1b339f73ca1e1 /src | |
parent | 97f12ac3895aff1659b3e87f5822c0f0a62323b5 (diff) | |
download | mongo-d57200de0fcedae5ed71520bb1838c8c1a281b8d.tar.gz |
SERVER-41657 Create new ActionType called refineCollectionShardKey
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/auth/action_types.txt | 1 | ||||
-rw-r--r-- | src/mongo/db/auth/role_graph_builtin_roles.cpp | 3 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_refine_collection_shard_key_cmd.cpp | 6 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/auth/action_types.txt b/src/mongo/db/auth/action_types.txt index a353f154847..431d18373e6 100644 --- a/src/mongo/db/auth/action_types.txt +++ b/src/mongo/db/auth/action_types.txt @@ -85,6 +85,7 @@ "planCacheIndexFilter", # view/update index filters "planCacheRead", # view contents of plan cache "planCacheWrite", # clear cache, drop cache entry, pin/unpin/shun plans +"refineCollectionShardKey", "reIndex", "remove", "removeShard", diff --git a/src/mongo/db/auth/role_graph_builtin_roles.cpp b/src/mongo/db/auth/role_graph_builtin_roles.cpp index daecf3176fc..0646c8219d0 100644 --- a/src/mongo/db/auth/role_graph_builtin_roles.cpp +++ b/src/mongo/db/auth/role_graph_builtin_roles.cpp @@ -251,7 +251,8 @@ MONGO_INITIALIZER(AuthorizationBuiltinRoles)(InitializerContext* context) { << ActionType::splitChunk << ActionType::moveChunk << ActionType::enableSharding - << ActionType::splitVector; + << ActionType::splitVector + << ActionType::refineCollectionShardKey; return Status::OK(); } diff --git a/src/mongo/s/commands/cluster_refine_collection_shard_key_cmd.cpp b/src/mongo/s/commands/cluster_refine_collection_shard_key_cmd.cpp index aec7565ee9f..fa96a95b10f 100644 --- a/src/mongo/s/commands/cluster_refine_collection_shard_key_cmd.cpp +++ b/src/mongo/s/commands/cluster_refine_collection_shard_key_cmd.cpp @@ -49,7 +49,7 @@ public: using InvocationBase::InvocationBase; void typedRun(OperationContext* opCtx) { - const NamespaceString nss = request().getCommandParameter(); + const NamespaceString nss = ns(); ConfigsvrRefineCollectionShardKey configsvrRefineCollShardKey(nss, request().getKey()); configsvrRefineCollShardKey.setDbName(request().getDbName()); @@ -80,8 +80,8 @@ public: uassert(ErrorCodes::Unauthorized, "Unauthorized", AuthorizationSession::get(opCtx->getClient()) - ->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(), - ActionType::enableSharding)); + ->isAuthorizedForActionsOnResource(ResourcePattern::forExactNamespace(ns()), + ActionType::refineCollectionShardKey)); } }; |