identity-admin 1.26.8 → 1.26.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -67,7 +67,7 @@ let ActionController = class ActionController {
|
|
|
67
67
|
response = yield extraAction.handler(req, res, data);
|
|
68
68
|
const newRecord = yield repository.findById(record._id);
|
|
69
69
|
const userActionsLog = new UserActionsLog_1.default({
|
|
70
|
-
action:
|
|
70
|
+
action: extraAction.name,
|
|
71
71
|
modelName,
|
|
72
72
|
userId: req.user._id,
|
|
73
73
|
dataBefore: JSON.stringify(oldRecord),
|
|
@@ -506,10 +506,14 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
506
506
|
const populatedString = modifiedResource.properties.populatedString;
|
|
507
507
|
const populationHelper = new PopulationHelper_1.PopulationHelper(resource, PopulationHelper_1.PopulationType.SHOW, populatedString);
|
|
508
508
|
const modifiedPopulatedObject = yield populationHelper.get();
|
|
509
|
+
const crudOperations = resource.properties.crudOperations;
|
|
510
|
+
var filter = {};
|
|
511
|
+
if (crudOperations && crudOperations.show && crudOperations.show.before) {
|
|
512
|
+
filter = yield crudOperations.show.before(req, filter, currentUser);
|
|
513
|
+
}
|
|
514
|
+
filter._id = recordId;
|
|
509
515
|
var record = yield repository.findOne({
|
|
510
|
-
filter
|
|
511
|
-
_id: recordId,
|
|
512
|
-
},
|
|
516
|
+
filter,
|
|
513
517
|
populate: modifiedPopulatedObject,
|
|
514
518
|
});
|
|
515
519
|
if (!record) {
|
|
@@ -133,6 +133,16 @@ interface ICrudOperations {
|
|
|
133
133
|
validators?: ValidationChain[];
|
|
134
134
|
};
|
|
135
135
|
show?: {
|
|
136
|
+
/**
|
|
137
|
+
* Before handler that gives you the access to the filter object.
|
|
138
|
+
* You can add to the filter object any key and value that will be used in the filter query before getting the records for list.
|
|
139
|
+
* @returns the filter object
|
|
140
|
+
*/
|
|
141
|
+
before?: (req: IRequest, filter: {
|
|
142
|
+
[key: string]: any;
|
|
143
|
+
}, currentUser: Document) => Promise<{
|
|
144
|
+
[key: string]: any;
|
|
145
|
+
}>;
|
|
136
146
|
after?: (req: IRequest, record: Document) => Promise<{
|
|
137
147
|
record: Document;
|
|
138
148
|
[key: string]: any;
|