summaryrefslogtreecommitdiff
path: root/jstests/auth/basic_role_auth.js
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@10gen.com>2013-11-15 17:34:08 -0500
committerSpencer T Brody <spencer@10gen.com>2013-11-18 16:12:40 -0500
commit030988fb8e08c14cbbcab4fe3a22ed6d6d6a524c (patch)
tree490aae072516d68d1ade369901580306b2d3e542 /jstests/auth/basic_role_auth.js
parent938ebe6981529f3c7b62b11ccf39b3533c6c2c8a (diff)
downloadmongo-030988fb8e08c14cbbcab4fe3a22ed6d6d6a524c.tar.gz
SERVER-10151 Re-enable the 'Test change role' section of auth/basic_role_auth.js by using the updateUser command
Diffstat (limited to 'jstests/auth/basic_role_auth.js')
-rw-r--r--jstests/auth/basic_role_auth.js21
1 files changed, 8 insertions, 13 deletions
diff --git a/jstests/auth/basic_role_auth.js b/jstests/auth/basic_role_auth.js
index 1b59ad8c46b..0530edda062 100644
--- a/jstests/auth/basic_role_auth.js
+++ b/jstests/auth/basic_role_auth.js
@@ -422,24 +422,19 @@ var TESTS = [
}
},
-// Changing role test disabled per SERVER-10151. Once we have commands for changing user's roles,
-// this should be changed to use those and re-enabled
-/*{
+{
name: 'Test change role',
test: function(conn) {
var testDB = conn.getDB('test');
assert.eq(1, testDB.auth('rw', AUTH_INFO.test.rw.pwd));
var newConn = new Mongo(conn.host);
- var testDB2 = newConn.getDB('test');
- assert.eq(1, testDB2.auth('uadmin', AUTH_INFO.test.uadmin.pwd));
- var origSpec = testDB2.system.users.findOne({ user: 'rw' });
- testDB2.system.users.update({ user: 'rw' }, { $set: { roles: [ 'read' ] }});
- var gle = testDB2.runCommand({ getLastError: 1 });
- assert(gle.err == null, 'role change failed: ' + tojson(gle));
+ assert.eq(1, newConn.getDB('admin').auth('any_uadmin', AUTH_INFO.admin.any_uadmin.pwd));
+ newConn.getDB('test').updateUser('rw', {roles: ['read']});
+ var origSpec = newConn.getDB("test").getUser("rw");
- // role change should not affect users already authenticated.
- testOps(testDB, READ_WRITE_PERM);
+ // role change should affect users already authenticated.
+ testOps(testDB, READ_PERM);
// role change should affect active connections.
testDB.runCommand({ logout: 1 });
@@ -452,9 +447,9 @@ var TESTS = [
assert.eq(1, testDB3.auth('rw', AUTH_INFO.test.rw.pwd));
testOps(testDB3, READ_PERM);
- testDB2.system.users.update({ user: 'rw' }, origSpec);
+ newConn.getDB('test').updateUser('rw', {roles: origSpec.roles});
}
-},*/
+},
{
name: 'Test override user',