summaryrefslogtreecommitdiff
path: root/db/dbeval.cpp
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-02-01 10:31:08 -0800
committerAaron <aaron@10gen.com>2010-02-01 10:31:08 -0800
commit946d42e8e718d0e11ab3389c286b5ae41a23d5e7 (patch)
tree0d168cd91b26d2d7af43b0e16e9fbb46f7eca241 /db/dbeval.cpp
parent75fd1d625740d9d3dced353e003a379cd31dd84f (diff)
downloadmongo-946d42e8e718d0e11ab3389c286b5ae41a23d5e7.tar.gz
SERVER-258 make db.eval work with read only mode
Diffstat (limited to 'db/dbeval.cpp')
-rw-r--r--db/dbeval.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/db/dbeval.cpp b/db/dbeval.cpp
index 8ee4ff2cf0a..b9af6e4de79 100644
--- a/db/dbeval.cpp
+++ b/db/dbeval.cpp
@@ -111,8 +111,15 @@ namespace mongo {
virtual bool slaveOk() {
return false;
}
+ // We need at least read only access to run db.eval - auth for eval'd writes will be checked
+ // as they are requested.
+ virtual bool requiresAuth() {
+ return false;
+ }
CmdEval() : Command("$eval") { }
bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
+ AuthenticationInfo *ai = currentClient.get()->ai;
+ uassert( 12596 , "$eval readOnly unauthorized", ai->isReadOnlyAuthorized(cc().database()->name.c_str()));
return dbEval(ns, cmdObj, result, errmsg);
}
} cmdeval;