zet-lib 1.2.70 → 1.2.72

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.
Files changed (2) hide show
  1. package/lib/zRoute.js +21 -0
  2. package/package.json +1 -1
package/lib/zRoute.js CHANGED
@@ -1228,6 +1228,13 @@ zRoute.selectAllowedField = (req, res, MYMODEL, arr = []) => {
1228
1228
  }
1229
1229
 
1230
1230
  zRoute.excelQuery = async (req, res, MYMODEL, paramsObject = {}) => {
1231
+ const cacheRole = myCache.get("ROLES")[res.locals.roleId].params;
1232
+ const levels = cacheRole[MYMODEL.table] || []
1233
+ if(!levels.includes("export")) {
1234
+ res.json("no access")
1235
+ return false;
1236
+ }
1237
+
1231
1238
  let virtuals = []
1232
1239
  let customs = []
1233
1240
  let asDate = []
@@ -1348,6 +1355,13 @@ zRoute.excelQuery = async (req, res, MYMODEL, paramsObject = {}) => {
1348
1355
 
1349
1356
  // for excels
1350
1357
  zRoute.excel = async (req, res, MYMODEL, fields, rows, callback, fileName) => {
1358
+ const cacheRole = myCache.get("ROLES")[res.locals.roleId].params;
1359
+ const levels = cacheRole[MYMODEL.table] || []
1360
+ if(!levels.includes("export")) {
1361
+ res.json("no access")
1362
+ return false;
1363
+ }
1364
+
1351
1365
  //if any other custom value then callback needed
1352
1366
  callback = callback || function () {}
1353
1367
  const workbook = new Excel.Workbook()
@@ -3546,6 +3560,13 @@ zRoute.deleteSQL = async (table, id, company_id) => {
3546
3560
 
3547
3561
  //for import
3548
3562
  zRoute.import = async (req, res, MYMODEL) => {
3563
+ const cacheRole = myCache.get("ROLES")[res.locals.roleId].params;
3564
+ const levels = cacheRole[MYMODEL.table] || []
3565
+ if(!levels.includes("export")) {
3566
+ res.json("no access")
3567
+ return false;
3568
+ }
3569
+
3549
3570
  const userId = res.locals.userId
3550
3571
  const room = res.locals.token
3551
3572
  let progress = 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "1.2.70",
3
+ "version": "1.2.72",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"