summaryrefslogtreecommitdiff
path: root/src/mongo/db/audit.h
diff options
context:
space:
mode:
authorVarun Ravichandran <varun.ravichandran@mongodb.com>2021-02-02 15:13:34 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-12 18:50:27 +0000
commit2dd18531e61234f23dfb9f906572c5a21a805d6b (patch)
tree8778c52f472402cf12f728bd703c443e68c7d24b /src/mongo/db/audit.h
parenta0ab86b6893f8599998f48eb37f6f77078bfab02 (diff)
downloadmongo-2dd18531e61234f23dfb9f906572c5a21a805d6b.tar.gz
SERVER-50990: Include usernames and roleNames in createIndex audit event
Diffstat (limited to 'src/mongo/db/audit.h')
-rw-r--r--src/mongo/db/audit.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/audit.h b/src/mongo/db/audit.h
index 2fef0920bdf..6b8842c8aa2 100644
--- a/src/mongo/db/audit.h
+++ b/src/mongo/db/audit.h
@@ -57,6 +57,22 @@ class Document;
namespace audit {
/**
+ * Struct that temporarily stores client information when an audit hook
+ * executes on a separate thread with a new Client. In those cases, ImpersonatedClientAttrs
+ * can bundle all relevant client attributes necessary for auditing and be safely
+ * passed into the new thread, where the new Client will be loaded with the userNames and
+ * roleNames stored in ImpersonatedClientAttrs.
+ */
+struct ImpersonatedClientAttrs {
+ std::vector<UserName> userNames;
+ std::vector<RoleName> roleNames;
+
+ ImpersonatedClientAttrs() = default;
+
+ ImpersonatedClientAttrs(Client* client);
+};
+
+/**
* Narrow API for the parts of mongo::Command used by the audit library.
*/
class CommandInterface {