summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands.h')
-rw-r--r--src/mongo/db/commands.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h
index fb114ddc4ed..a897adaca4c 100644
--- a/src/mongo/db/commands.h
+++ b/src/mongo/db/commands.h
@@ -17,10 +17,12 @@
#pragma once
+#include <string>
#include <vector>
#include "mongo/base/status.h"
#include "mongo/db/auth/privilege.h"
+#include "mongo/db/auth/resource_pattern.h"
#include "mongo/db/client_basic.h"
#include "mongo/db/jsobj.h"
@@ -51,6 +53,13 @@ namespace mutablebson {
// mongo::String, then 'dbname' is returned unmodified.
virtual string parseNs(const string& dbname, const BSONObj& cmdObj) const;
+ // Utility that returns a ResourcePattern for the namespace returned from
+ // parseNs(dbname, cmdObj). This will be either an exact namespace resource pattern
+ // or a database resource pattern, depending on whether parseNs returns a fully qualifed
+ // collection name or just a database name.
+ ResourcePattern parseResourcePattern(const std::string& dbname,
+ const BSONObj& cmdObj) const;
+
// warning: isAuthorized uses the lockType() return values, and values are being passed
// around as ints so be careful as it isn't really typesafe and will need cleanup later
enum LockType { READ = -1 , NONE = 0 , WRITE = 1 };