diff options
author | James Wahlin <james@mongodb.com> | 2017-07-03 15:33:36 -0400 |
---|---|---|
committer | James Wahlin <james@mongodb.com> | 2017-07-25 12:24:49 -0400 |
commit | 5dcaad5f137eebc1915c0fc7b5078da4aa86f915 (patch) | |
tree | 3994b41708bce7cf5cbc5b7c9ba422db77f9bfb3 /src/mongo/db/pipeline/document_source_index_stats.h | |
parent | 079763d2cd06776edf81f3ecf6c32ab66d1742ec (diff) | |
download | mongo-5dcaad5f137eebc1915c0fc7b5078da4aa86f915.tar.gz |
SERVER-29371 DocumentSource classes should provide auth requirements
Diffstat (limited to 'src/mongo/db/pipeline/document_source_index_stats.h')
-rw-r--r-- | src/mongo/db/pipeline/document_source_index_stats.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source_index_stats.h b/src/mongo/db/pipeline/document_source_index_stats.h index e802e0d7016..7d25aca6c9f 100644 --- a/src/mongo/db/pipeline/document_source_index_stats.h +++ b/src/mongo/db/pipeline/document_source_index_stats.h @@ -39,6 +39,31 @@ namespace mongo { */ class DocumentSourceIndexStats final : public DocumentSourceNeedsMongod { public: + class LiteParsed final : public LiteParsedDocumentSource { + public: + static std::unique_ptr<LiteParsed> parse(const AggregationRequest& request, + const BSONElement& spec) { + return stdx::make_unique<LiteParsed>(request.getNamespaceString()); + } + + explicit LiteParsed(NamespaceString nss) : _nss(std::move(nss)) {} + + stdx::unordered_set<NamespaceString> getInvolvedNamespaces() const final { + return stdx::unordered_set<NamespaceString>(); + } + + PrivilegeVector requiredPrivileges(bool isMongos) const final { + return {Privilege(ResourcePattern::forExactNamespace(_nss), ActionType::indexStats)}; + } + + bool isInitialSource() const final { + return true; + } + + private: + const NamespaceString _nss; + }; + // virtuals from DocumentSource GetNextResult getNext() final; const char* getSourceName() const final; |