summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_coll_stats.h
diff options
context:
space:
mode:
authorJames Wahlin <james@mongodb.com>2017-07-03 15:33:36 -0400
committerJames Wahlin <james@mongodb.com>2017-07-25 12:24:49 -0400
commit5dcaad5f137eebc1915c0fc7b5078da4aa86f915 (patch)
tree3994b41708bce7cf5cbc5b7c9ba422db77f9bfb3 /src/mongo/db/pipeline/document_source_coll_stats.h
parent079763d2cd06776edf81f3ecf6c32ab66d1742ec (diff)
downloadmongo-5dcaad5f137eebc1915c0fc7b5078da4aa86f915.tar.gz
SERVER-29371 DocumentSource classes should provide auth requirements
Diffstat (limited to 'src/mongo/db/pipeline/document_source_coll_stats.h')
-rw-r--r--src/mongo/db/pipeline/document_source_coll_stats.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/document_source_coll_stats.h b/src/mongo/db/pipeline/document_source_coll_stats.h
index ad8673643e6..2506c1be823 100644
--- a/src/mongo/db/pipeline/document_source_coll_stats.h
+++ b/src/mongo/db/pipeline/document_source_coll_stats.h
@@ -42,16 +42,29 @@ public:
public:
static std::unique_ptr<LiteParsed> parse(const AggregationRequest& request,
const BSONElement& spec) {
- return stdx::make_unique<LiteParsed>();
+ return stdx::make_unique<LiteParsed>(request.getNamespaceString());
}
+ explicit LiteParsed(NamespaceString nss) : _nss(std::move(nss)) {}
+
bool isCollStats() const final {
return true;
}
+ PrivilegeVector requiredPrivileges(bool isMongos) const final {
+ return {Privilege(ResourcePattern::forExactNamespace(_nss), ActionType::collStats)};
+ }
+
stdx::unordered_set<NamespaceString> getInvolvedNamespaces() const final {
return stdx::unordered_set<NamespaceString>();
}
+
+ bool isInitialSource() const final {
+ return true;
+ }
+
+ private:
+ const NamespaceString _nss;
};
DocumentSourceCollStats(const boost::intrusive_ptr<ExpressionContext>& pExpCtx)