@optimiser/common 1.0.410 → 1.0.412
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/lib/utility.js +15 -11
- package/package.json +1 -1
package/dist/lib/utility.js
CHANGED
|
@@ -5797,27 +5797,31 @@ function ValidateStateCountryField(_a) {
|
|
|
5797
5797
|
* Return: true/false
|
|
5798
5798
|
*/
|
|
5799
5799
|
function CheckAccessPermissions(permissionType, objectName, msp_d, db, mdb, next) {
|
|
5800
|
-
var _a, _b;
|
|
5800
|
+
var _a, _b, _c;
|
|
5801
5801
|
return __awaiter(this, void 0, void 0, function () {
|
|
5802
|
-
var response, isAllowed, data, _i,
|
|
5803
|
-
return __generator(this, function (
|
|
5804
|
-
switch (
|
|
5802
|
+
var response, isAllowed, data, _i, _d, item, error_9;
|
|
5803
|
+
return __generator(this, function (_e) {
|
|
5804
|
+
switch (_e.label) {
|
|
5805
5805
|
case 0:
|
|
5806
|
-
|
|
5806
|
+
_e.trys.push([0, 2, , 3]);
|
|
5807
5807
|
return [4 /*yield*/, GetUserProfile(msp_d, db, mdb, next)];
|
|
5808
5808
|
case 1:
|
|
5809
|
-
response =
|
|
5809
|
+
response = _e.sent();
|
|
5810
5810
|
isAllowed = false;
|
|
5811
5811
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
5812
5812
|
if (data && data.Permissions.length > 0) {
|
|
5813
|
-
for (_i = 0,
|
|
5814
|
-
item =
|
|
5813
|
+
for (_i = 0, _d = data.Permissions; _i < _d.length; _i++) {
|
|
5814
|
+
item = _d[_i];
|
|
5815
5815
|
if (item.ModuleID.toLowerCase() == objectName.toLowerCase() || ((_b = (_a = item.ModuleData) === null || _a === void 0 ? void 0 : _a.Objects) === null || _b === void 0 ? void 0 : _b.includes(objectName))) {
|
|
5816
|
-
if (
|
|
5816
|
+
if (permissionType == "CheckOnlyAccess") {
|
|
5817
|
+
isAllowed = true;
|
|
5818
|
+
break;
|
|
5819
|
+
}
|
|
5820
|
+
else if (item.Operations.includes(permissionType)) {
|
|
5817
5821
|
isAllowed = true;
|
|
5818
5822
|
break;
|
|
5819
5823
|
}
|
|
5820
|
-
else if (item.CheckOnlyControlPanel && item.Operations.includes('Control Panel')) {
|
|
5824
|
+
else if (((_c = item.ModuleData) === null || _c === void 0 ? void 0 : _c.CheckOnlyControlPanel) && item.Operations.includes('Control Panel')) {
|
|
5821
5825
|
isAllowed = true;
|
|
5822
5826
|
break;
|
|
5823
5827
|
}
|
|
@@ -5833,7 +5837,7 @@ function CheckAccessPermissions(permissionType, objectName, msp_d, db, mdb, next
|
|
|
5833
5837
|
}
|
|
5834
5838
|
return [2 /*return*/, isAllowed];
|
|
5835
5839
|
case 2:
|
|
5836
|
-
error_9 =
|
|
5840
|
+
error_9 = _e.sent();
|
|
5837
5841
|
console.error("Internal Error in CheckAccessPermissions function : ".concat(error_9));
|
|
5838
5842
|
return [3 /*break*/, 3];
|
|
5839
5843
|
case 3: return [2 /*return*/];
|