@openinc/parse-server-opendash 1.10.1 → 1.10.2
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.
- package/dist/hooks/Dashboard.js +26 -16
- package/package.json +1 -1
package/dist/hooks/Dashboard.js
CHANGED
|
@@ -58,30 +58,40 @@ function init(className) {
|
|
|
58
58
|
(0, __1.afterSaveHook)(className, function (_a) {
|
|
59
59
|
var object = _a.object, original = _a.original, user = _a.user;
|
|
60
60
|
return __awaiter(_this, void 0, void 0, function () {
|
|
61
|
-
var acl, widgetIds,
|
|
61
|
+
var acl, widgetIds, _i, widgetIds_1, widgetId, widget, error_1;
|
|
62
62
|
return __generator(this, function (_b) {
|
|
63
63
|
switch (_b.label) {
|
|
64
64
|
case 0:
|
|
65
65
|
acl = object.getACL();
|
|
66
66
|
widgetIds = object.get("widgets");
|
|
67
|
-
if (!(acl && Array.isArray(widgetIds) && widgetIds.length > 0)) return [3 /*break*/,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
objectId: id,
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
return [4 /*yield*/, Parse.Object.fetchAll(widgets, { useMasterKey: true })];
|
|
67
|
+
if (!(acl && Array.isArray(widgetIds) && widgetIds.length > 0)) return [3 /*break*/, 7];
|
|
68
|
+
_i = 0, widgetIds_1 = widgetIds;
|
|
69
|
+
_b.label = 1;
|
|
74
70
|
case 1:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
widget.setACL(acl);
|
|
79
|
-
}
|
|
80
|
-
return [4 /*yield*/, Parse.Object.saveAll(widgets, { useMasterKey: true })];
|
|
71
|
+
if (!(_i < widgetIds_1.length)) return [3 /*break*/, 7];
|
|
72
|
+
widgetId = widgetIds_1[_i];
|
|
73
|
+
_b.label = 2;
|
|
81
74
|
case 2:
|
|
75
|
+
_b.trys.push([2, 5, , 6]);
|
|
76
|
+
widget = new Parse.Object("".concat(__1.PREFIX, "Widget"), {
|
|
77
|
+
objectId: widgetId,
|
|
78
|
+
});
|
|
79
|
+
return [4 /*yield*/, widget.fetch({ useMasterKey: true })];
|
|
80
|
+
case 3:
|
|
81
|
+
_b.sent();
|
|
82
|
+
widget.setACL(acl);
|
|
83
|
+
return [4 /*yield*/, widget.save(null, { useMasterKey: true })];
|
|
84
|
+
case 4:
|
|
82
85
|
_b.sent();
|
|
83
|
-
|
|
84
|
-
case
|
|
86
|
+
return [3 /*break*/, 6];
|
|
87
|
+
case 5:
|
|
88
|
+
error_1 = _b.sent();
|
|
89
|
+
console.error("Error: Update widget permission from dashboard:", object.id, widgetId, error_1);
|
|
90
|
+
return [3 /*break*/, 6];
|
|
91
|
+
case 6:
|
|
92
|
+
_i++;
|
|
93
|
+
return [3 /*break*/, 1];
|
|
94
|
+
case 7: return [2 /*return*/];
|
|
85
95
|
}
|
|
86
96
|
});
|
|
87
97
|
});
|