summaryrefslogtreecommitdiff
path: root/jstests/auth/resource_pattern_matching.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/auth/resource_pattern_matching.js')
-rw-r--r--jstests/auth/resource_pattern_matching.js62
1 files changed, 29 insertions, 33 deletions
diff --git a/jstests/auth/resource_pattern_matching.js b/jstests/auth/resource_pattern_matching.js
index ca3c9b50195..ccefb8f51f5 100644
--- a/jstests/auth/resource_pattern_matching.js
+++ b/jstests/auth/resource_pattern_matching.js
@@ -13,12 +13,8 @@ function setup_users(granter) {
admindb.runCommand({
createUser: "admin",
pwd: "admin",
- roles: [
- "userAdminAnyDatabase",
- "dbAdminAnyDatabase",
- "clusterAdmin",
- "readWriteAnyDatabase"
- ]
+ roles:
+ ["userAdminAnyDatabase", "dbAdminAnyDatabase", "clusterAdmin", "readWriteAnyDatabase"]
});
admindb.auth("admin", "admin");
@@ -143,10 +139,10 @@ function run_tests(granter, verifier) {
verifier,
[{resource: {db: "a", collection: "a"}, actions: ["find"]}],
{
- "a.a": should_find,
- "a.b": should_fail_find,
- "b.a": should_fail_find,
- "b.b": should_fail_find
+ "a.a": should_find,
+ "a.b": should_fail_find,
+ "b.a": should_fail_find,
+ "b.b": should_fail_find
});
run_test(
@@ -183,12 +179,12 @@ function run_tests(granter, verifier) {
verifier,
[{resource: {db: "$", collection: "cmd"}, actions: ["find"]}],
{
- "a.a": function(testdb, testcol) {
- var r = testdb.stats();
+ "a.a": function(testdb, testcol) {
+ var r = testdb.stats();
- if (r["ok"])
- throw("db.$.cmd shouldn't give a.stats()");
- }
+ if (r["ok"])
+ throw ("db.$.cmd shouldn't give a.stats()");
+ }
});
run_test_bad_resource("empty_resource", granter, {});
@@ -202,26 +198,26 @@ function run_tests(granter, verifier) {
granter,
verifier,
[
- {resource: {db: "a", collection: "a"}, actions: ["find"]},
- {resource: {db: "", collection: ""}, actions: ["insert"]}
+ {resource: {db: "a", collection: "a"}, actions: ["find"]},
+ {resource: {db: "", collection: ""}, actions: ["insert"]}
],
{
- "a.a": function(testdb, testcol) {
- should_insert(testdb, testcol);
- should_find(testdb, testcol);
- },
- "a.b": function(testdb, testcol) {
- should_insert(testdb, testcol);
- should_fail_find(testdb, testcol);
- },
- "b.a": function(testdb, testcol) {
- should_insert(testdb, testcol);
- should_fail_find(testdb, testcol);
- },
- "b.b": function(testdb, testcol) {
- should_insert(testdb, testcol);
- should_fail_find(testdb, testcol);
- },
+ "a.a": function(testdb, testcol) {
+ should_insert(testdb, testcol);
+ should_find(testdb, testcol);
+ },
+ "a.b": function(testdb, testcol) {
+ should_insert(testdb, testcol);
+ should_fail_find(testdb, testcol);
+ },
+ "b.a": function(testdb, testcol) {
+ should_insert(testdb, testcol);
+ should_fail_find(testdb, testcol);
+ },
+ "b.b": function(testdb, testcol) {
+ should_insert(testdb, testcol);
+ should_fail_find(testdb, testcol);
+ },
});
}