summaryrefslogtreecommitdiff
path: root/db/security_commands.cpp
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-01-26 17:04:09 -0800
committerAaron <aaron@10gen.com>2010-01-26 17:04:09 -0800
commitdcce5e795e5728214d6973a2e4f7168d05b22ecf (patch)
tree0ebaa9eff1603721b5d6b4c29b0794eab431124b /db/security_commands.cpp
parentc11297df9a7dca4170a1f7c6ec6b97335753aeca (diff)
downloadmongo-dcce5e795e5728214d6973a2e4f7168d05b22ecf.tar.gz
SERVER-258 add readOnly auth mode
Diffstat (limited to 'db/security_commands.cpp')
-rw-r--r--db/security_commands.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/db/security_commands.cpp b/db/security_commands.cpp
index 9d63744045b..ab11adf3bf4 100644
--- a/db/security_commands.cpp
+++ b/db/security_commands.cpp
@@ -152,7 +152,12 @@ namespace mongo {
}
AuthenticationInfo *ai = currentClient.get()->ai;
- ai->authorize(cc().database()->name.c_str());
+
+ if ( userObj[ "readOnly" ].isBoolean() && userObj[ "readOnly" ].boolean() ) {
+ ai->authorizeReadOnly( cc().database()->name.c_str() );
+ } else {
+ ai->authorize( cc().database()->name.c_str() );
+ }
return true;
}
} cmdAuthenticate;