diff options
author | Aaron <aaron@10gen.com> | 2010-01-26 17:04:09 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-01-26 17:04:09 -0800 |
commit | dcce5e795e5728214d6973a2e4f7168d05b22ecf (patch) | |
tree | 0ebaa9eff1603721b5d6b4c29b0794eab431124b /db/security_commands.cpp | |
parent | c11297df9a7dca4170a1f7c6ec6b97335753aeca (diff) | |
download | mongo-dcce5e795e5728214d6973a2e4f7168d05b22ecf.tar.gz |
SERVER-258 add readOnly auth mode
Diffstat (limited to 'db/security_commands.cpp')
-rw-r--r-- | db/security_commands.cpp | 7 |
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; |