feat: Add afterFind trigger to authentication adapters (#8444)
This commit is contained in:
@@ -223,6 +223,9 @@ RestQuery.prototype.execute = function (executeOptions) {
|
||||
.then(() => {
|
||||
return this.runAfterFindTrigger();
|
||||
})
|
||||
.then(() => {
|
||||
return this.handleAuthAdapters();
|
||||
})
|
||||
.then(() => {
|
||||
return this.response;
|
||||
});
|
||||
@@ -842,6 +845,15 @@ RestQuery.prototype.runAfterFindTrigger = function () {
|
||||
});
|
||||
};
|
||||
|
||||
RestQuery.prototype.handleAuthAdapters = async function () {
|
||||
if (this.className !== '_User' || this.findOptions.explain) {
|
||||
return;
|
||||
}
|
||||
await Promise.all(
|
||||
this.response.results.map(result => this.config.authDataManager.runAfterFind(result.authData))
|
||||
);
|
||||
};
|
||||
|
||||
// Adds included values to the response.
|
||||
// Path is a list of field names.
|
||||
// Returns a promise for an augmented response.
|
||||
|
||||
Reference in New Issue
Block a user