jstests/auth/lib/commands_builtin_roles.js
/**
 * Second entry point for this test library.
 * To be invoked as an test argument to authCommandsLib.runTests().
 */
Second entry point for this test library.
To be invoked as an test argument to authCommandsLib.runTests().
Second entry point for this test library . To be invoked as an test argument to authCommandsLib . runTests () .
function createUsers(conn) {
    var adminDb = conn.getDB(adminDbName);
    adminDb.createUser({user: "admin", pwd: "password", roles: ["__system"]});
    assert(adminDb.auth("admin", "password"));
    for (var i = 0; i < roles.length; i++) {
        r = roles[i];
        r.db = conn.getDB(r.dbname);
        r.db.createUser({user: "user|" + r.key, pwd: "password", roles: [r.role]});
    }
    adminDb.logout();
}
function createUsers ( conn ) { var adminDb = conn . getDB ( adminDbName ) ; adminDb . createUser ( { user : "admin" , pwd : "password" , roles : [ "__system" ] } ) ; assert ( adminDb . auth ( "admin" , "password" ) ) ; for ( var i = 0 ; i < roles . length ; i ++ ) { r = roles [ i ] ; r . db = conn . getDB ( r . dbname ) ; r . db . createUser ( { user : "user|" + r . key , pwd : "password" , roles : [ r . role ] } ) ; } adminDb . logout ( ) ; }
Second entry point for this test library.
Second entry point for this test library .