identity-admin 1.25.23 → 1.26.0
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.
|
@@ -31,6 +31,7 @@ export default class DashboardController {
|
|
|
31
31
|
[key: string]: any;
|
|
32
32
|
};
|
|
33
33
|
protected getVisibileExtraActions(currentUser: Document, record: any, resource: IResourceFile, repository: any, modelName: string): Promise<string[] | undefined>;
|
|
34
|
+
private getModelConfiguration;
|
|
34
35
|
index(req: IRequest, res: Response): Promise<void | Response<any, Record<string, any>>>;
|
|
35
36
|
create(req: IRequest, res: Response): Promise<void>;
|
|
36
37
|
update(req: IRequest, res: Response): Promise<void | Response<any, Record<string, any>>>;
|
|
@@ -113,6 +113,16 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
113
113
|
return extraActionsArray;
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
+
getModelConfiguration(modelName) {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
if ((_a = this.modelConfigurations) === null || _a === void 0 ? void 0 : _a.get(modelName)) {
|
|
120
|
+
return (_b = this.modelConfigurations) === null || _b === void 0 ? void 0 : _b.get(modelName);
|
|
121
|
+
}
|
|
122
|
+
const collection = mongoose_1.default.connection.db.collection('modelconfigurations');
|
|
123
|
+
return yield collection.findOne({ modelName: modelName });
|
|
124
|
+
});
|
|
125
|
+
}
|
|
116
126
|
index(req, res) {
|
|
117
127
|
var _a, _b, _c;
|
|
118
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -486,7 +496,7 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
486
496
|
});
|
|
487
497
|
}
|
|
488
498
|
deleteAll(req, res) {
|
|
489
|
-
var _a, _b, _c
|
|
499
|
+
var _a, _b, _c;
|
|
490
500
|
return __awaiter(this, void 0, void 0, function* () {
|
|
491
501
|
if (!this.validateRequest(req, res)) {
|
|
492
502
|
return;
|
|
@@ -505,12 +515,13 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
505
515
|
if (!permissionCheck) {
|
|
506
516
|
return ResponseUtils_1.default.forbidden(res);
|
|
507
517
|
}
|
|
508
|
-
const
|
|
518
|
+
const configuration = yield this.getModelConfiguration(resource.properties.modelName);
|
|
519
|
+
const actions = ActionsGenerator_1.default.generateActions(resource.properties.actions, resource, currentUser, configuration);
|
|
509
520
|
const bulkDeletePermission = actions.bulkDelete.isAccessible;
|
|
510
521
|
if (!bulkDeletePermission) {
|
|
511
522
|
return ResponseUtils_1.default.forbidden(res);
|
|
512
523
|
}
|
|
513
|
-
const repository = (
|
|
524
|
+
const repository = (_c = this.repository) !== null && _c !== void 0 ? _c : new Repository_1.default(resource.properties.resource);
|
|
514
525
|
for (var i = 0; i < recordIds.length; i++) {
|
|
515
526
|
const recordId = recordIds[i];
|
|
516
527
|
const record = yield repository.findById(recordId);
|
|
@@ -635,7 +646,7 @@ __decorate([
|
|
|
635
646
|
__param(1, (0, inversify_express_utils_1.response)())
|
|
636
647
|
], DashboardController.prototype, "validateRequest", null);
|
|
637
648
|
__decorate([
|
|
638
|
-
(0, inversify_express_utils_1.httpGet)(
|
|
649
|
+
(0, inversify_express_utils_1.httpGet)("/"),
|
|
639
650
|
__param(0, (0, inversify_express_utils_1.request)()),
|
|
640
651
|
__param(1, (0, inversify_express_utils_1.response)())
|
|
641
652
|
], DashboardController.prototype, "index", null);
|
|
@@ -92,7 +92,15 @@ class FilterHelper {
|
|
|
92
92
|
filterQuery = yield virtual.handler(filterQuery, value);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
|
|
95
|
+
const fieldProps = resource.properties.model[key];
|
|
96
|
+
if (fieldProps && fieldProps.multipleInFilter) {
|
|
97
|
+
filterQuery[key] = {
|
|
98
|
+
$in: value.split(',')
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
filterQuery[key] = value;
|
|
103
|
+
}
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
else {
|
|
@@ -319,6 +319,11 @@ export interface IFieldValue {
|
|
|
319
319
|
schema?: IModel | {
|
|
320
320
|
[key: string]: IFieldValue;
|
|
321
321
|
};
|
|
322
|
+
/**
|
|
323
|
+
* Specify if this field is filtered by multiple values not only one value. Only used if this value is one of the quick filters.
|
|
324
|
+
* @default undefined
|
|
325
|
+
*/
|
|
326
|
+
multipleInFilter?: boolean;
|
|
322
327
|
}
|
|
323
328
|
export interface IVirtualValue {
|
|
324
329
|
/**
|