mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
SERVER-35753 listCommands should include value for requiresAuth
This commit is contained in:
parent
9fd91d29a2
commit
2ff2b24ce6
@ -24,4 +24,16 @@
|
||||
assert(commands["commands"].hasOwnProperty("isMaster"));
|
||||
assert(commands["commands"].hasOwnProperty("insert"));
|
||||
assert(commands["commands"].hasOwnProperty("ping"));
|
||||
|
||||
// Test that commands listed have required properties
|
||||
const isMaster = commands["commands"]["isMaster"];
|
||||
assert(isMaster.hasOwnProperty("help"));
|
||||
assert(isMaster.hasOwnProperty("slaveOk"));
|
||||
assert(isMaster.hasOwnProperty("adminOnly"));
|
||||
assert(isMaster.hasOwnProperty("requiresAuth"));
|
||||
|
||||
// Test that requiresAuth outputs correct value
|
||||
const insert = commands["commands"]["insert"];
|
||||
assert(isMaster["requiresAuth"] === false);
|
||||
assert(insert["requiresAuth"] === true);
|
||||
})();
|
||||
|
@ -174,6 +174,7 @@ public:
|
||||
for (const auto& c : commands) {
|
||||
BSONObjBuilder temp(b.subobjStart(c->getName()));
|
||||
temp.append("help", c->help());
|
||||
temp.append("requiresAuth", c->requiresAuth());
|
||||
temp.append("slaveOk",
|
||||
c->secondaryAllowed(opCtx->getServiceContext()) ==
|
||||
Command::AllowedOnSecondary::kAlways);
|
||||
|
Loading…
Reference in New Issue
Block a user