@optimiser/common 1.0.227 → 1.0.231
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.d.ts +2 -1
- package/dist/lib/utility.js +109 -68
- package/package.json +1 -1
package/dist/lib/utility.d.ts
CHANGED
|
@@ -175,6 +175,7 @@ declare function GetUserProfile(msp_d: AnyObjectInterface, db: Db, mdb: Db, next
|
|
|
175
175
|
message: string;
|
|
176
176
|
data: any;
|
|
177
177
|
} | undefined>;
|
|
178
|
+
declare function CheckPageAuthentication(pageData: AnyObjectInterface, msp_d: AnyObjectInterface, db: Db, mdb: Db, next: NextFunction): Promise<boolean>;
|
|
178
179
|
/**
|
|
179
180
|
* @param Error Error object
|
|
180
181
|
* @param ServiceOrigin - Error Occur in Service (Service Name)
|
|
@@ -186,4 +187,4 @@ declare function GetUserProfile(msp_d: AnyObjectInterface, db: Db, mdb: Db, next
|
|
|
186
187
|
declare function ErrorHandlerForServices(Error: OPT_ERROR, ServiceOrigin: string, EmailConfig: any, Module?: string, db?: Db): Promise<any>;
|
|
187
188
|
declare function CheckCaptcha(token: string, captcha: string, redisClient: Redis): Promise<unknown>;
|
|
188
189
|
declare function ValidateSanitizeUserInput(inputFields: AnyObjectInterface, pageData: AnyObjectInterface): Promise<AnyObjectInterface[] | undefined>;
|
|
189
|
-
export { CheckForWhiteListedDomain, ReturnJsonResponse, ConvertFileByteSize, GetObjectByKeyValueFromList, IsEqualArrays, IsEqualValue, CheckUserProfileField, GetPageFieldData, GetPageObjectSchema, GetFieldDetail, UpdateRecentViewObject, SyncChildObjectData, SyncParentObjectData, DeleteFieldInOtherCollection, SyncFieldInSameCollection, SyncFieldInSameCollectionByObjectID, SyncFieldInSameCollectionByObjectIDWithPromise, SyncFieldInOtherCollection, SyncUserInOtherCollection, BuildLookupDataField, CheckDataBeforeAdd, CheckDataBeforeUpdate, BuildGridFieldProjection, BuildFieldProjection, BuildLookupFieldProjection, FilterConditions, GirdHeaderFilters, AddLog, CheckFilterFieldsProjection, VerifyEmailPassword, GetMyTeamUsers, ExtractChildUsersTree, GetMaxKeyValueListSchema, VerifyAWSEmailConfig, GenerateId, SyncUserDetailsWithMasterDB, SignoutUserFromAllDevices, SignoutUsersWithPromise, SignoutMultipleUsersFromAllDevices, UserLicenseConsumeCalculate, sendMailWithUserAccount, GetEmailClientConfigs, GetCompanyEncryptionKey, ExecuteDynamicDMLQuery, ExecuteDynamicDQLQuery, GetUserProfilePermissions, MakeUserPasswordInvalid, ConvertJsonToXLXS, SendResetPasswordMail, SendMailToSupport, MailTemplateStructure, SendMailToCustomer, parseMSPCookie, GetIPDetailsFromReq, isEmptyObj, SyncListSchemaFieldInOtherCollection, UpdateTagCountAfterDelete, SyncTagCountAfterUpdate, ReactivateFieldInOtherCollection, SyncUserLicenceConsumedCount, BroadCastEventToAllCompanyUsers, CheckDataPermission, SyncCompanyLicenceInMasterCompanyAfterAdd, NextServiceDateForDashboard, CheckDateNotInPast, GetWeekDayByDayAndOccurance, GetInterValFromOccurance, GetWeekDayInfoInMonth, GetDayIndex, GetUserProfile, ErrorHandlerForServices, CheckCaptcha, ValidateSanitizeUserInput };
|
|
190
|
+
export { CheckForWhiteListedDomain, ReturnJsonResponse, ConvertFileByteSize, GetObjectByKeyValueFromList, IsEqualArrays, IsEqualValue, CheckUserProfileField, GetPageFieldData, GetPageObjectSchema, GetFieldDetail, UpdateRecentViewObject, SyncChildObjectData, SyncParentObjectData, DeleteFieldInOtherCollection, SyncFieldInSameCollection, SyncFieldInSameCollectionByObjectID, SyncFieldInSameCollectionByObjectIDWithPromise, SyncFieldInOtherCollection, SyncUserInOtherCollection, BuildLookupDataField, CheckDataBeforeAdd, CheckDataBeforeUpdate, BuildGridFieldProjection, BuildFieldProjection, BuildLookupFieldProjection, FilterConditions, GirdHeaderFilters, AddLog, CheckFilterFieldsProjection, VerifyEmailPassword, GetMyTeamUsers, ExtractChildUsersTree, GetMaxKeyValueListSchema, VerifyAWSEmailConfig, GenerateId, SyncUserDetailsWithMasterDB, SignoutUserFromAllDevices, SignoutUsersWithPromise, SignoutMultipleUsersFromAllDevices, UserLicenseConsumeCalculate, sendMailWithUserAccount, GetEmailClientConfigs, GetCompanyEncryptionKey, ExecuteDynamicDMLQuery, ExecuteDynamicDQLQuery, GetUserProfilePermissions, MakeUserPasswordInvalid, ConvertJsonToXLXS, SendResetPasswordMail, SendMailToSupport, MailTemplateStructure, SendMailToCustomer, parseMSPCookie, GetIPDetailsFromReq, isEmptyObj, SyncListSchemaFieldInOtherCollection, UpdateTagCountAfterDelete, SyncTagCountAfterUpdate, ReactivateFieldInOtherCollection, SyncUserLicenceConsumedCount, BroadCastEventToAllCompanyUsers, CheckDataPermission, SyncCompanyLicenceInMasterCompanyAfterAdd, NextServiceDateForDashboard, CheckDateNotInPast, GetWeekDayByDayAndOccurance, GetInterValFromOccurance, GetWeekDayInfoInMonth, GetDayIndex, GetUserProfile, CheckPageAuthentication, ErrorHandlerForServices, CheckCaptcha, ValidateSanitizeUserInput };
|
package/dist/lib/utility.js
CHANGED
|
@@ -80,7 +80,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
80
80
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
81
81
|
};
|
|
82
82
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
83
|
-
exports.ValidateSanitizeUserInput = exports.CheckCaptcha = exports.ErrorHandlerForServices = exports.GetUserProfile = exports.GetDayIndex = exports.GetWeekDayInfoInMonth = exports.GetInterValFromOccurance = exports.GetWeekDayByDayAndOccurance = exports.CheckDateNotInPast = exports.NextServiceDateForDashboard = exports.SyncCompanyLicenceInMasterCompanyAfterAdd = exports.CheckDataPermission = exports.BroadCastEventToAllCompanyUsers = exports.SyncUserLicenceConsumedCount = exports.ReactivateFieldInOtherCollection = exports.SyncTagCountAfterUpdate = exports.UpdateTagCountAfterDelete = exports.SyncListSchemaFieldInOtherCollection = exports.isEmptyObj = exports.GetIPDetailsFromReq = exports.parseMSPCookie = exports.SendMailToCustomer = exports.MailTemplateStructure = exports.SendMailToSupport = exports.SendResetPasswordMail = exports.ConvertJsonToXLXS = exports.MakeUserPasswordInvalid = exports.GetUserProfilePermissions = exports.ExecuteDynamicDQLQuery = exports.ExecuteDynamicDMLQuery = exports.GetCompanyEncryptionKey = exports.GetEmailClientConfigs = exports.sendMailWithUserAccount = exports.UserLicenseConsumeCalculate = exports.SignoutMultipleUsersFromAllDevices = exports.SignoutUsersWithPromise = exports.SignoutUserFromAllDevices = exports.SyncUserDetailsWithMasterDB = exports.GenerateId = exports.VerifyAWSEmailConfig = exports.GetMaxKeyValueListSchema = exports.ExtractChildUsersTree = exports.GetMyTeamUsers = exports.VerifyEmailPassword = exports.CheckFilterFieldsProjection = exports.AddLog = exports.GirdHeaderFilters = exports.FilterConditions = exports.BuildLookupFieldProjection = exports.BuildFieldProjection = exports.BuildGridFieldProjection = exports.CheckDataBeforeUpdate = exports.CheckDataBeforeAdd = exports.BuildLookupDataField = exports.SyncUserInOtherCollection = exports.SyncFieldInOtherCollection = exports.SyncFieldInSameCollectionByObjectIDWithPromise = exports.SyncFieldInSameCollectionByObjectID = exports.SyncFieldInSameCollection = exports.DeleteFieldInOtherCollection = exports.SyncParentObjectData = exports.SyncChildObjectData = exports.UpdateRecentViewObject = exports.GetFieldDetail = exports.GetPageObjectSchema = exports.GetPageFieldData = exports.CheckUserProfileField = exports.IsEqualValue = exports.IsEqualArrays = exports.GetObjectByKeyValueFromList = exports.ConvertFileByteSize = exports.ReturnJsonResponse = exports.CheckForWhiteListedDomain = void 0;
|
|
83
|
+
exports.ValidateSanitizeUserInput = exports.CheckCaptcha = exports.ErrorHandlerForServices = exports.CheckPageAuthentication = exports.GetUserProfile = exports.GetDayIndex = exports.GetWeekDayInfoInMonth = exports.GetInterValFromOccurance = exports.GetWeekDayByDayAndOccurance = exports.CheckDateNotInPast = exports.NextServiceDateForDashboard = exports.SyncCompanyLicenceInMasterCompanyAfterAdd = exports.CheckDataPermission = exports.BroadCastEventToAllCompanyUsers = exports.SyncUserLicenceConsumedCount = exports.ReactivateFieldInOtherCollection = exports.SyncTagCountAfterUpdate = exports.UpdateTagCountAfterDelete = exports.SyncListSchemaFieldInOtherCollection = exports.isEmptyObj = exports.GetIPDetailsFromReq = exports.parseMSPCookie = exports.SendMailToCustomer = exports.MailTemplateStructure = exports.SendMailToSupport = exports.SendResetPasswordMail = exports.ConvertJsonToXLXS = exports.MakeUserPasswordInvalid = exports.GetUserProfilePermissions = exports.ExecuteDynamicDQLQuery = exports.ExecuteDynamicDMLQuery = exports.GetCompanyEncryptionKey = exports.GetEmailClientConfigs = exports.sendMailWithUserAccount = exports.UserLicenseConsumeCalculate = exports.SignoutMultipleUsersFromAllDevices = exports.SignoutUsersWithPromise = exports.SignoutUserFromAllDevices = exports.SyncUserDetailsWithMasterDB = exports.GenerateId = exports.VerifyAWSEmailConfig = exports.GetMaxKeyValueListSchema = exports.ExtractChildUsersTree = exports.GetMyTeamUsers = exports.VerifyEmailPassword = exports.CheckFilterFieldsProjection = exports.AddLog = exports.GirdHeaderFilters = exports.FilterConditions = exports.BuildLookupFieldProjection = exports.BuildFieldProjection = exports.BuildGridFieldProjection = exports.CheckDataBeforeUpdate = exports.CheckDataBeforeAdd = exports.BuildLookupDataField = exports.SyncUserInOtherCollection = exports.SyncFieldInOtherCollection = exports.SyncFieldInSameCollectionByObjectIDWithPromise = exports.SyncFieldInSameCollectionByObjectID = exports.SyncFieldInSameCollection = exports.DeleteFieldInOtherCollection = exports.SyncParentObjectData = exports.SyncChildObjectData = exports.UpdateRecentViewObject = exports.GetFieldDetail = exports.GetPageObjectSchema = exports.GetPageFieldData = exports.CheckUserProfileField = exports.IsEqualValue = exports.IsEqualArrays = exports.GetObjectByKeyValueFromList = exports.ConvertFileByteSize = exports.ReturnJsonResponse = exports.CheckForWhiteListedDomain = void 0;
|
|
84
84
|
var moment_1 = __importDefault(require("moment"));
|
|
85
85
|
var nodemailer_1 = __importDefault(require("nodemailer"));
|
|
86
86
|
var mongodb_1 = require("mongodb");
|
|
@@ -88,13 +88,13 @@ var bson_1 = require("bson");
|
|
|
88
88
|
var Excel = __importStar(require("exceljs"));
|
|
89
89
|
var path_1 = __importDefault(require("path"));
|
|
90
90
|
var fs_1 = __importDefault(require("fs"));
|
|
91
|
-
var
|
|
91
|
+
var geoip = __importStar(require("geoip-lite"));
|
|
92
92
|
var crypto_1 = __importDefault(require("crypto"));
|
|
93
93
|
var constants_1 = __importDefault(require("../constants"));
|
|
94
94
|
var mail_1 = require("../utility/mail");
|
|
95
95
|
var errorHandlerForServices_1 = __importDefault(require("../utility/errorHandlerForServices"));
|
|
96
96
|
var cryptoService = __importStar(require("../utility/crypto"));
|
|
97
|
-
var
|
|
97
|
+
var countrycode_1 = require("./countrycode");
|
|
98
98
|
require("moment-timezone");
|
|
99
99
|
var sanitize = require('mongo-sanitize');
|
|
100
100
|
function GetObjectByKeyValueFromList(list, key, val) {
|
|
@@ -185,11 +185,10 @@ function CheckUserProfileField(pageData, profileData) {
|
|
|
185
185
|
exports.CheckUserProfileField = CheckUserProfileField;
|
|
186
186
|
function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
|
|
187
187
|
db.collection("Page").findOne({ 'PageName': pageName }, function (err, pageData) {
|
|
188
|
-
var _a, _b;
|
|
189
188
|
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
-
var hasAccess
|
|
191
|
-
return __generator(this, function (
|
|
192
|
-
switch (
|
|
189
|
+
var hasAccess;
|
|
190
|
+
return __generator(this, function (_a) {
|
|
191
|
+
switch (_a.label) {
|
|
193
192
|
case 0:
|
|
194
193
|
if (err) {
|
|
195
194
|
next(err);
|
|
@@ -198,40 +197,16 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
|
|
|
198
197
|
callback(pageData);
|
|
199
198
|
return [2 /*return*/];
|
|
200
199
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
hasAccess =
|
|
204
|
-
return [3 /*break*/, 3];
|
|
205
|
-
case 1: return [4 /*yield*/, GetUserProfile(msp_d, db, mdb, next)];
|
|
206
|
-
case 2:
|
|
207
|
-
response = _c.sent();
|
|
208
|
-
if (response && response.message == 'success') {
|
|
209
|
-
userProfile = response.data;
|
|
210
|
-
auth = userProfile.Permissions;
|
|
211
|
-
for (i = 0; i < auth.length; i++) {
|
|
212
|
-
moduleData = auth[i].ModuleData;
|
|
213
|
-
if (moduleData) {
|
|
214
|
-
if (((_a = moduleData.Objects) === null || _a === void 0 ? void 0 : _a.indexOf(pageData.ObjectName)) >= 0 || ((_b = moduleData.Pages) === null || _b === void 0 ? void 0 : _b.indexOf(pageData.PageName)) >= 0) {
|
|
215
|
-
hasAccess = true;
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
console.log(response === null || response === void 0 ? void 0 : response.message);
|
|
223
|
-
callback('Unauthorised');
|
|
224
|
-
}
|
|
225
|
-
_c.label = 3;
|
|
226
|
-
case 3:
|
|
227
|
-
// ** Ends ** //
|
|
200
|
+
return [4 /*yield*/, CheckPageAuthentication(pageData, msp_d, db, mdb, next)];
|
|
201
|
+
case 1:
|
|
202
|
+
hasAccess = _a.sent();
|
|
228
203
|
if (!hasAccess) {
|
|
229
204
|
callback('Unauthorised');
|
|
230
205
|
}
|
|
231
206
|
else {
|
|
232
207
|
db.collection("ObjectSchema").findOne({ 'Name': pageData.ObjectName }, function (err, objectData) {
|
|
233
208
|
return __awaiter(this, void 0, void 0, function () {
|
|
234
|
-
var _loop_2, i, g, group, childObjectSchema, _loop_3, i, _loop_4, i;
|
|
209
|
+
var _loop_2, i, g, group, childObjectSchema, _loop_3, i, _loop_4, i, idObject, idObject_1;
|
|
235
210
|
return __generator(this, function (_a) {
|
|
236
211
|
switch (_a.label) {
|
|
237
212
|
case 0:
|
|
@@ -294,6 +269,34 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
|
|
|
294
269
|
g++;
|
|
295
270
|
return [3 /*break*/, 1];
|
|
296
271
|
case 5:
|
|
272
|
+
if (pageData.Fields && pageData.Type == "ObjectGrid") {
|
|
273
|
+
idObject = {
|
|
274
|
+
Name: "_id",
|
|
275
|
+
Schema: { Name: "_id", DisplayName: "ID", ApiName: "ID", UIDataType: "objectid" },
|
|
276
|
+
Sequence: 0,
|
|
277
|
+
UniqueID: "_id",
|
|
278
|
+
DisplayName: "ID",
|
|
279
|
+
Width: 100
|
|
280
|
+
};
|
|
281
|
+
pageData.Fields.splice(0, 0, idObject);
|
|
282
|
+
}
|
|
283
|
+
if (pageData.Fields && pageData.Type == "ObjectDetail") {
|
|
284
|
+
idObject_1 = {
|
|
285
|
+
Name: "_id",
|
|
286
|
+
Sequence: 0,
|
|
287
|
+
UIDataType: "objectid",
|
|
288
|
+
UniqueID: "_id",
|
|
289
|
+
DisplayName: "ID"
|
|
290
|
+
};
|
|
291
|
+
pageData.Fields == pageData.Fields.map(function (s) {
|
|
292
|
+
if (s.Schema && s.Schema.UIDataType == "collection") {
|
|
293
|
+
s.Schema.Fields.splice(0, 0, idObject_1);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
s;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
297
300
|
callback(pageData);
|
|
298
301
|
return [2 /*return*/];
|
|
299
302
|
}
|
|
@@ -2034,6 +2037,8 @@ function GirdHeaderFilters(filters, fields) {
|
|
|
2034
2037
|
matchValue = { '$eq': parseInt(obj.Value) };
|
|
2035
2038
|
else if (["decimal", "percent"].includes(field.Schema.UIDataType))
|
|
2036
2039
|
matchValue = { '$eq': mongodb_1.Decimal128.fromString(obj.Value) };
|
|
2040
|
+
else if (field.Schema.UIDataType == 'objectid')
|
|
2041
|
+
matchValue = { '$eq': obj.Value };
|
|
2037
2042
|
else
|
|
2038
2043
|
matchValue = { '$regex': obj.Value.trim().replace(/[-[\]{}()*+?.,\\/^$|#\s]/g, "\\$&"), '$options': 'i' };
|
|
2039
2044
|
var fieldMatch = {};
|
|
@@ -2973,40 +2978,39 @@ function ConvertFileByteSize(bytes) {
|
|
|
2973
2978
|
exports.ConvertFileByteSize = ConvertFileByteSize;
|
|
2974
2979
|
function GetIPDetailsFromReq(req) {
|
|
2975
2980
|
return __awaiter(this, void 0, void 0, function () {
|
|
2976
|
-
var ip,
|
|
2981
|
+
var ip, ipDetails;
|
|
2977
2982
|
return __generator(this, function (_a) {
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
})
|
|
2999
|
-
})];
|
|
3000
|
-
case 1:
|
|
3001
|
-
ipDetails = (_a.sent()).data;
|
|
3002
|
-
ipDetails = ipDetails.data;
|
|
3003
|
-
/* if (ipDetails) {
|
|
3004
|
-
ipDetails.countryName = countryCode(ipDetails.country)
|
|
3005
|
-
ipDetails.ip = ip
|
|
3006
|
-
} */
|
|
3007
|
-
console.log('>>IP DE ', ipDetails);
|
|
3008
|
-
return [2 /*return*/, ipDetails];
|
|
2983
|
+
if (req.headers['x-original-forwarded-for']) {
|
|
2984
|
+
//console.log("In req.headers['x-original-forwarded-for']");
|
|
2985
|
+
ip = req.headers['x-original-forwarded-for'];
|
|
2986
|
+
}
|
|
2987
|
+
else if (req.headers['x-forwarded-for']) {
|
|
2988
|
+
//console.log("In req.headers['x-forwarded-for']");
|
|
2989
|
+
ip = req.headers['x-forwarded-for'].split(",")[0];
|
|
2990
|
+
}
|
|
2991
|
+
else if (req.connection && req.connection.remoteAddress) {
|
|
2992
|
+
ip = req.connection.remoteAddress;
|
|
2993
|
+
}
|
|
2994
|
+
else {
|
|
2995
|
+
ip = req.ip;
|
|
2996
|
+
}
|
|
2997
|
+
ipDetails = geoip.lookup(ip);
|
|
2998
|
+
if (ipDetails) {
|
|
2999
|
+
ipDetails.countryName = countrycode_1.getCountryFromCode(ipDetails.country);
|
|
3000
|
+
ipDetails.ip = ip;
|
|
3001
|
+
// }
|
|
3002
|
+
//return connection.ReturnJsonResponse(req, res, { Status: 200, Message: 'success', Data: ipDetails, Type: 'POST', LogData: false });
|
|
3009
3003
|
}
|
|
3004
|
+
else {
|
|
3005
|
+
ipDetails = '';
|
|
3006
|
+
}
|
|
3007
|
+
//ipDetails = ipDetails.data;
|
|
3008
|
+
/* if (ipDetails) {
|
|
3009
|
+
ipDetails.countryName = countryCode(ipDetails.country)
|
|
3010
|
+
ipDetails.ip = ip
|
|
3011
|
+
} */
|
|
3012
|
+
console.log('>>IP DE ', ipDetails);
|
|
3013
|
+
return [2 /*return*/, ipDetails];
|
|
3010
3014
|
});
|
|
3011
3015
|
});
|
|
3012
3016
|
}
|
|
@@ -3765,6 +3769,43 @@ function GetUserProfile(msp_d, db, mdb, next) {
|
|
|
3765
3769
|
});
|
|
3766
3770
|
}
|
|
3767
3771
|
exports.GetUserProfile = GetUserProfile;
|
|
3772
|
+
function CheckPageAuthentication(pageData, msp_d, db, mdb, next) {
|
|
3773
|
+
var _a, _b;
|
|
3774
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3775
|
+
var hasAccess, response, userProfile, auth, i, moduleData;
|
|
3776
|
+
return __generator(this, function (_c) {
|
|
3777
|
+
switch (_c.label) {
|
|
3778
|
+
case 0:
|
|
3779
|
+
hasAccess = false;
|
|
3780
|
+
if (!(pageData.IsPermissionRequired == false)) return [3 /*break*/, 1];
|
|
3781
|
+
hasAccess = true;
|
|
3782
|
+
return [3 /*break*/, 3];
|
|
3783
|
+
case 1: return [4 /*yield*/, GetUserProfile(msp_d, db, mdb, next)];
|
|
3784
|
+
case 2:
|
|
3785
|
+
response = _c.sent();
|
|
3786
|
+
if (response && response.message == 'success') {
|
|
3787
|
+
userProfile = response.data;
|
|
3788
|
+
auth = userProfile.Permissions;
|
|
3789
|
+
for (i = 0; i < auth.length; i++) {
|
|
3790
|
+
moduleData = auth[i].ModuleData;
|
|
3791
|
+
if (moduleData) {
|
|
3792
|
+
if (((_a = moduleData.Objects) === null || _a === void 0 ? void 0 : _a.indexOf(pageData.ObjectName)) >= 0 || ((_b = moduleData.Pages) === null || _b === void 0 ? void 0 : _b.indexOf(pageData.PageName)) >= 0) {
|
|
3793
|
+
hasAccess = true;
|
|
3794
|
+
break;
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
else {
|
|
3800
|
+
console.log(response === null || response === void 0 ? void 0 : response.message);
|
|
3801
|
+
}
|
|
3802
|
+
_c.label = 3;
|
|
3803
|
+
case 3: return [2 /*return*/, hasAccess];
|
|
3804
|
+
}
|
|
3805
|
+
});
|
|
3806
|
+
});
|
|
3807
|
+
}
|
|
3808
|
+
exports.CheckPageAuthentication = CheckPageAuthentication;
|
|
3768
3809
|
/**
|
|
3769
3810
|
* @param Error Error object
|
|
3770
3811
|
* @param ServiceOrigin - Error Occur in Service (Service Name)
|
|
@@ -3902,7 +3943,7 @@ function ValidateSanitizeUserInput(inputFields, pageData) {
|
|
|
3902
3943
|
elmValue = inputItem[elm];
|
|
3903
3944
|
if (item.IsRequired == true && item.IsRequired !== undefined) {
|
|
3904
3945
|
// check for required input fileds
|
|
3905
|
-
if (item.UIDataType == 'email' && elmValue != '') {
|
|
3946
|
+
if (elmValue && item.UIDataType == 'email' && elmValue != '' && elmValue != null && elmValue !== undefined) {
|
|
3906
3947
|
if (!EmailValidation(elmValue.toString())) {
|
|
3907
3948
|
msg = 'Invalid email format!';
|
|
3908
3949
|
}
|