summaryrefslogtreecommitdiff
path: root/jstests/auth/profile_access.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/auth/profile_access.js')
-rw-r--r--jstests/auth/profile_access.js33
1 files changed, 20 insertions, 13 deletions
diff --git a/jstests/auth/profile_access.js b/jstests/auth/profile_access.js
index 504b89d7931..e7090ef3b0d 100644
--- a/jstests/auth/profile_access.js
+++ b/jstests/auth/profile_access.js
@@ -1,33 +1,40 @@
-var conn = MongoRunner.runMongod({auth : ""});
+var conn = MongoRunner.runMongod({auth: ""});
var adminDb = conn.getDB("admin");
var testDb = conn.getDB("testdb");
-adminDb.createUser({user:'admin',
- pwd:'password',
- roles:['userAdminAnyDatabase','dbAdminAnyDatabase', 'readWriteAnyDatabase']});
+adminDb.createUser({
+ user: 'admin',
+ pwd: 'password',
+ roles: ['userAdminAnyDatabase', 'dbAdminAnyDatabase', 'readWriteAnyDatabase']
+});
-adminDb.auth('admin','password');
-testDb.createUser({user:'readUser',pwd:'password',roles:['read']});
-testDb.createUser({user:'dbAdminUser',pwd:'password',roles:['dbAdmin']});
-testDb.createUser({user:'dbAdminAnyDBUser',pwd:'password',roles:[{role: 'dbAdminAnyDatabase',
- db: 'admin'}]});
+adminDb.auth('admin', 'password');
+testDb.createUser({user: 'readUser', pwd: 'password', roles: ['read']});
+testDb.createUser({user: 'dbAdminUser', pwd: 'password', roles: ['dbAdmin']});
+testDb.createUser({
+ user: 'dbAdminAnyDBUser',
+ pwd: 'password',
+ roles: [{role: 'dbAdminAnyDatabase', db: 'admin'}]
+});
testDb.setProfilingLevel(2);
testDb.foo.findOne();
adminDb.logout();
-testDb.auth('readUser','password');
-assert.throws(function() { testDb.system.profile.findOne(); });
+testDb.auth('readUser', 'password');
+assert.throws(function() {
+ testDb.system.profile.findOne();
+});
testDb.logout();
// SERVER-14355
-testDb.auth('dbAdminUser','password');
+testDb.auth('dbAdminUser', 'password');
testDb.setProfilingLevel(0);
testDb.system.profile.drop();
assert.commandWorked(testDb.createCollection("system.profile", {capped: true, size: 1024}));
testDb.logout();
// SERVER-16944
-testDb.auth('dbAdminAnyDBUser','password');
+testDb.auth('dbAdminAnyDBUser', 'password');
testDb.setProfilingLevel(0);
testDb.system.profile.drop();
assert.commandWorked(testDb.createCollection("system.profile", {capped: true, size: 1024})); \ No newline at end of file