summaryrefslogtreecommitdiff
path: root/db/dbwebserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'db/dbwebserver.cpp')
-rw-r--r--db/dbwebserver.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/db/dbwebserver.cpp b/db/dbwebserver.cpp
index 78c09c0..eb19ba3 100644
--- a/db/dbwebserver.cpp
+++ b/db/dbwebserver.cpp
@@ -79,11 +79,10 @@ namespace mongo {
}
bool allowed( const char * rq , vector<string>& headers, const SockAddr &from ) {
- if ( from.isLocalHost() )
- return true;
-
- if ( ! _webUsers->haveAdminUsers() )
+ if ( from.isLocalHost() || !_webUsers->haveAdminUsers() ) {
+ cmdAuthenticate.authenticate( "admin", "RestUser", false );
return true;
+ }
string auth = getHeader( rq , "Authorization" );
@@ -118,8 +117,10 @@ namespace mongo {
r << ha2;
string r1 = md5simpledigest( r.str() );
- if ( r1 == parms["response"] )
+ if ( r1 == parms["response"] ) {
+ cmdAuthenticate.authenticate( "admin", user["user"].str(), user[ "readOnly" ].isBoolean() && user[ "readOnly" ].boolean() );
return true;
+ }
}
}