Skip to content

Commit

Permalink
build index in system.user on insert SERVER-3572
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBeard0531 committed Oct 24, 2011
1 parent aac7de7 commit 3733a98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 5 additions & 1 deletion db/pdfile.cpp
Expand Up @@ -1756,10 +1756,14 @@ namespace mongo {
uassert( 10095 , "attempt to insert in reserved database name 'system'", sys != ns);
if ( strstr(ns, ".system.") ) {
// later:check for dba-type permissions here if have that at some point separate
if ( strstr(ns, ".system.indexes" ) )
if ( strstr(ns, ".system.indexes" ) ){
wouldAddIndex = true;
}
else if ( legalClientSystemNS( ns , true ) ) {
if ( obuf && strstr( ns , ".system.users" ) ) {
static const BSONObj userPattern = BSON("user" << 1);
Helpers::ensureIndex(ns, userPattern, false, "user_1");

BSONObj t( reinterpret_cast<const char *>( obuf ) );
uassert( 14051 , "system.user entry needs 'user' field to be a string" , t["user"].type() == String );
uassert( 14052 , "system.user entry needs 'pwd' field to be a string" , t["pwd"].type() == String );
Expand Down
2 changes: 0 additions & 2 deletions db/security.cpp
Expand Up @@ -79,9 +79,7 @@ namespace mongo {
pwd = internalSecurity.pwd;
}
else {
// static BSONObj userPattern = fromjson("{\"user\":1}");
string systemUsers = dbname + ".system.users";
// OCCASIONALLY Helpers::ensureIndex(systemUsers.c_str(), userPattern, false, "user_1");
{
BSONObjBuilder b;
b << "user" << user;
Expand Down

0 comments on commit 3733a98

Please sign in to comment.