summaryrefslogtreecommitdiff
path: root/jstests/auth/authentication_restrictions_role.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/auth/authentication_restrictions_role.js')
-rw-r--r--jstests/auth/authentication_restrictions_role.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/jstests/auth/authentication_restrictions_role.js b/jstests/auth/authentication_restrictions_role.js
index 759d874de3c..29b56aca933 100644
--- a/jstests/auth/authentication_restrictions_role.js
+++ b/jstests/auth/authentication_restrictions_role.js
@@ -57,6 +57,14 @@
assert.commandWorked(admin.runCommand({createRole: "role3", roles: [], privileges: []}));
print("=== Role creation tests");
+ print("When a role is updated, it retains authenticationRestrictions");
+ assert.commandWorked(admin.runCommand({updateRole: "role2", roles: ["root"]}));
+ const role2Info = assert.commandWorked(
+ admin.runCommand({rolesInfo: "role2", showAuthenticationRestrictions: true}));
+ printjson(role2Info);
+ assert.eq(JSON.stringify([[{clientSource: ["127.0.0.1/32"]}]]),
+ JSON.stringify(role2Info.roles[0].authenticationRestrictions));
+
print(
"When a client creates roles with empty authenticationRestrictions, the operation succeeds, though it has no effect");
assert.commandWorked(admin.runCommand(