We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cba193b commit a3fb626Copy full SHA for a3fb626
src/mongo/db/audit/audit_commands.cpp
@@ -136,9 +136,19 @@ class AuditGetOptionsCommand : public AuditCommand {
136
"Example: { auditGetOptions: 1 }";
137
}
138
139
- Status checkAuthForOperation(OperationContext*,
140
- const DatabaseName&,
+ bool adminOnly() const override {
+ return true;
141
+ }
142
+
143
+ Status checkAuthForOperation(OperationContext* opCtx,
144
+ const DatabaseName& dbName,
145
const BSONObj&) const override {
146
+ auto* as = AuthorizationSession::get(opCtx->getClient());
147
+ if (!as->isAuthorizedForActionsOnResource(
148
+ ResourcePattern::forClusterResource(dbName.tenantId()), ActionType::getParameter)) {
149
+ return {ErrorCodes::Unauthorized, "unauthorized"};
150
151
152
return Status::OK();
153
154
0 commit comments