@simitgroup/simpleapp-generator 2.0.0-z-alpha → 2.0.1-c-alpha
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/ReleaseNote.md +14 -0
- package/dist/buildinschemas/autoincreament.js +1 -1
- package/dist/buildinschemas/docnoformat.js +1 -1
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/documentevent.js +1 -1
- package/package.json +1 -1
- package/templates/nest/src/simple-app/_core/framework/base/simple-app.service.ts.eta +56 -56
- package/templates/nuxt/composables/getMenus.generate.ts.eta +86 -0
- package/templates/nuxt/middleware/30.acl.global.ts._eta +26 -11
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +43 -49
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPageIframe.vue.eta +1 -0
- package/dist/buildinschemas/message.d.ts +0 -3
- package/dist/buildinschemas/message.d.ts.map +0 -1
- package/dist/buildinschemas/message.js +0 -34
- package/dist/buildinschemas/message.js.map +0 -1
- package/dist/buildinschemas/webhookhistory.d.ts +0 -3
- package/dist/buildinschemas/webhookhistory.d.ts.map +0 -1
- package/dist/buildinschemas/webhookhistory.js +0 -44
- package/dist/buildinschemas/webhookhistory.js.map +0 -1
- package/dist/createproject.js +0 -138
- package/dist/createproject.js.map +0 -1
- package/dist/generate-allow-changebackend.js +0 -305
- package/dist/generate-allow-changebackend.js.map +0 -1
- package/dist/index2.js +0 -118
- package/dist/index2.js.map +0 -1
- package/dist/installdependency.js +0 -20
- package/dist/installdependency.js.map +0 -1
- package/dist/installnest.js +0 -2
- package/dist/installnest.js.map +0 -1
- package/dist/installnuxt.js +0 -2
- package/dist/installnuxt.js.map +0 -1
- package/dist/processors/groupsbuilder.js +0 -2
- package/dist/processors/groupsbuilder.js.map +0 -1
- package/dist/schematype/baseschema.js +0 -25
- package/dist/schematype/baseschema.js.map +0 -1
- package/dist/schematype/default.js +0 -2
- package/dist/schematype/default.js.map +0 -1
- package/dist/schematype/index.js +0 -12
- package/dist/schematype/index.js.map +0 -1
- package/dist/schematype/primarymasterdata.js +0 -38
- package/dist/schematype/primarymasterdata.js.map +0 -1
- package/dist/schematype/simple.js +0 -24
- package/dist/schematype/simple.js.map +0 -1
- package/dist/schematype/simplemasterdata.js +0 -31
- package/dist/schematype/simplemasterdata.js.map +0 -1
- package/dist/schematype/transaction.js +0 -74
- package/dist/schematype/transaction.js.map +0 -1
package/ReleaseNote.md
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
[2.0.1c-alpha]
|
|
2
|
+
|
|
3
|
+
1. Reopen searchWithRelation code
|
|
4
|
+
|
|
5
|
+
[2.0.1b-alpha]
|
|
6
|
+
|
|
7
|
+
1. Update menu permission
|
|
8
|
+
|
|
9
|
+
[2.0.1a-alpha]
|
|
10
|
+
|
|
11
|
+
1. Add allow clipboard-write for mini app iframe
|
|
12
|
+
|
|
1
13
|
[2.0.0z-alpha]
|
|
14
|
+
|
|
2
15
|
1. add more roles like support, billings
|
|
3
16
|
2. environment allow add more type of users
|
|
4
17
|
3. user context can obtain environment collection value
|
|
@@ -6,6 +19,7 @@
|
|
|
6
19
|
5. improve frontend userstore get xorg method
|
|
7
20
|
|
|
8
21
|
[2.0.0y-alpha]
|
|
22
|
+
|
|
9
23
|
1. Allow mini app adjust built in schema
|
|
10
24
|
|
|
11
25
|
[2.0.0x-alpha]
|
|
@@ -15,7 +15,7 @@ exports.autoincreament = {
|
|
|
15
15
|
entryPoint: 'gennextno/:collection/:field',
|
|
16
16
|
requiredRole: ['User'],
|
|
17
17
|
method: type_1.RESTMethods.get,
|
|
18
|
-
responseType: '
|
|
18
|
+
responseType: 'Autoincreament',
|
|
19
19
|
description: 'Get next no and trigger increase nextno'
|
|
20
20
|
}
|
|
21
21
|
],
|
|
@@ -17,7 +17,7 @@ exports.docnoformat = {
|
|
|
17
17
|
action: 'listDocFormats',
|
|
18
18
|
entryPoint: '/listdocformats/:doctype',
|
|
19
19
|
requiredRole: ['User'],
|
|
20
|
-
responseType: '[
|
|
20
|
+
responseType: '[Docnoformat]',
|
|
21
21
|
method: type_1.RESTMethods.get,
|
|
22
22
|
description: 'get list of document format for 1 doctype'
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docnoformat.js","sourceRoot":"","sources":["../../src/buildinschemas/docnoformat.ts"],"names":[],"mappings":";;;AAAA,kCAAiE;AAEpD,QAAA,WAAW,GAAe;IACrC,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE;QACpB,aAAa,EAAE,oBAAa,CAAC,GAAG;QAChC,YAAY,EAAE,OAAO;QACrB,YAAY,EAAE,aAAa;QAC3B,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,eAAe;QAC1B,aAAa,EAAE,iBAAiB;QAChC,4BAA4B,EAAE,CAAC,SAAS,CAAC;QACzC,cAAc,EAAE;YACd;gBACE,MAAM,EAAE,gBAAgB;gBACxB,UAAU,EAAE,0BAA0B;gBACtC,YAAY,EAAE,CAAC,MAAM,CAAC;gBACtB,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"docnoformat.js","sourceRoot":"","sources":["../../src/buildinschemas/docnoformat.ts"],"names":[],"mappings":";;;AAAA,kCAAiE;AAEpD,QAAA,WAAW,GAAe;IACrC,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE;QACpB,aAAa,EAAE,oBAAa,CAAC,GAAG;QAChC,YAAY,EAAE,OAAO;QACrB,YAAY,EAAE,aAAa;QAC3B,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,eAAe;QAC1B,aAAa,EAAE,iBAAiB;QAChC,4BAA4B,EAAE,CAAC,SAAS,CAAC;QACzC,cAAc,EAAE;YACd;gBACE,MAAM,EAAE,gBAAgB;gBACxB,UAAU,EAAE,0BAA0B;gBACtC,YAAY,EAAE,CAAC,MAAM,CAAC;gBACtB,YAAY,EAAE,eAAe;gBAC7B,MAAM,EAAE,kBAAW,CAAC,GAAG;gBACvB,WAAW,EAAE,2CAA2C;aACzD;SACF;QACD,YAAY,EAAE,kBAAkB;KACjC;IACD,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC7B,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC7B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;QACrD,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;QAClD,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;QACrD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACvB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aAC9B;SACF;QACD,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE;QACpD,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,wBAAwB,CAAC,EAAE;QACzE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5D,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;QAC7D,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;QACrD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;YAC9C,WAAW,EAAE,iCAAiC;SAC/C;QACD,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE;KAC5C;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1316,63 +1316,63 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
1316
1316
|
},
|
|
1317
1317
|
];
|
|
1318
1318
|
|
|
1319
|
-
//
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
// const subPipeline: PipelineStage.Lookup['$lookup']['pipeline'] = [];
|
|
1327
|
-
|
|
1328
|
-
// subPipeline.push({
|
|
1329
|
-
// $match: {
|
|
1330
|
-
// $expr: { $eq: [`$${relationOption.foreignField}`, '$$localValue'] },
|
|
1331
|
-
// },
|
|
1332
|
-
// ...relationOption.filter,
|
|
1333
|
-
// });
|
|
1334
|
-
|
|
1335
|
-
// // Relation sort
|
|
1336
|
-
// if (relationOption.sort) {
|
|
1337
|
-
// subPipeline.push({
|
|
1338
|
-
// $sort: relationOption.sort,
|
|
1339
|
-
// });
|
|
1340
|
-
// }
|
|
1341
|
-
|
|
1342
|
-
// // Relation projection
|
|
1343
|
-
// if (relationOption.projection) {
|
|
1344
|
-
// subPipeline.push({
|
|
1345
|
-
// $project: {
|
|
1346
|
-
// ...(relationOption.projection ?? {}),
|
|
1347
|
-
// },
|
|
1348
|
-
// });
|
|
1349
|
-
// }
|
|
1350
|
-
|
|
1351
|
-
// pipeline.push({
|
|
1352
|
-
// $lookup: {
|
|
1353
|
-
// from: relationName.toLowerCase(),
|
|
1354
|
-
// as: `_${relationName}`,
|
|
1355
|
-
// let: { localValue: `$${relationOption.localField}` },
|
|
1356
|
-
// pipeline: subPipeline,
|
|
1357
|
-
// },
|
|
1358
|
-
// });
|
|
1359
|
-
// });
|
|
1360
|
-
|
|
1361
|
-
// // Root sort
|
|
1362
|
-
// if (option.root?.sort) {
|
|
1363
|
-
// pipeline.push({
|
|
1364
|
-
// $sort: option.root.sort,
|
|
1365
|
-
// });
|
|
1366
|
-
// }
|
|
1319
|
+
// Relation lookups
|
|
1320
|
+
Object.entries(option.relations).forEach(([relationName, relationOption]) => {
|
|
1321
|
+
// Prevent mini api user lookup sensitive data
|
|
1322
|
+
if (!allowedRelations.includes(relationName)) {
|
|
1323
|
+
throw new BadRequestException(`Not allowed to lookup ${relationName}`);
|
|
1324
|
+
}
|
|
1367
1325
|
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1326
|
+
const subPipeline: PipelineStage.Lookup['$lookup']['pipeline'] = [];
|
|
1327
|
+
|
|
1328
|
+
subPipeline.push({
|
|
1329
|
+
$match: {
|
|
1330
|
+
$expr: { $eq: [`$${relationOption.foreignField}`, '$$localValue'] },
|
|
1331
|
+
},
|
|
1332
|
+
...relationOption.filter,
|
|
1333
|
+
});
|
|
1334
|
+
|
|
1335
|
+
// Relation sort
|
|
1336
|
+
if (relationOption.sort) {
|
|
1337
|
+
subPipeline.push({
|
|
1338
|
+
$sort: relationOption.sort,
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
// Relation projection
|
|
1343
|
+
if (relationOption.projection) {
|
|
1344
|
+
subPipeline.push({
|
|
1345
|
+
$project: {
|
|
1346
|
+
...(relationOption.projection ?? {}),
|
|
1347
|
+
},
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
pipeline.push({
|
|
1352
|
+
$lookup: {
|
|
1353
|
+
from: relationName.toLowerCase(),
|
|
1354
|
+
as: `_${relationName}`,
|
|
1355
|
+
let: { localValue: `$${relationOption.localField}` },
|
|
1356
|
+
pipeline: subPipeline,
|
|
1357
|
+
},
|
|
1358
|
+
});
|
|
1359
|
+
});
|
|
1360
|
+
|
|
1361
|
+
// Root sort
|
|
1362
|
+
if (option.root?.sort) {
|
|
1363
|
+
pipeline.push({
|
|
1364
|
+
$sort: option.root.sort,
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
// Root Projection
|
|
1369
|
+
if (option.root.projection) {
|
|
1370
|
+
pipeline.push({
|
|
1371
|
+
$project: {
|
|
1372
|
+
...(option.root?.projection ?? {}),
|
|
1373
|
+
},
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
1376
|
|
|
1377
1377
|
return await this.aggregate(appUser, pipeline);
|
|
1378
1378
|
}
|
|
@@ -67,4 +67,90 @@ export const getMenustFromPageMeta =() =>{
|
|
|
67
67
|
|
|
68
68
|
return allmenus.sort((one:string, two:string) => (one > two ? -1 : 1))
|
|
69
69
|
|
|
70
|
+
}
|
|
71
|
+
export const hasAccessByPageMeta = (pageName: string): boolean => {
|
|
72
|
+
const userGroups = getUserStore().groups || []
|
|
73
|
+
const userRoles = getUserStore().roles || []
|
|
74
|
+
|
|
75
|
+
if (
|
|
76
|
+
userRoles.includes('superadmin') ||
|
|
77
|
+
userRoles.includes('tenantowner') ||
|
|
78
|
+
userRoles.includes('superuser')
|
|
79
|
+
) {
|
|
80
|
+
return true
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const routes = useRouter().getRoutes()
|
|
84
|
+
const route = routes.find((r) => {
|
|
85
|
+
const menuPath = r.meta?.menuPath as string | undefined
|
|
86
|
+
return menuPath && menuPath.endsWith(`/${pageName}`)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
if (!route || !route.meta) {
|
|
90
|
+
return false
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const requiredGroups = route.meta.requiredGroups as string[] | undefined
|
|
94
|
+
|
|
95
|
+
if (!requiredGroups || requiredGroups.length === 0) {
|
|
96
|
+
return false
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return requiredGroups.some((group) => userGroups.includes(group))
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const getMenusWithPageMetaAccess = (xorg: string): MenuData[] => {
|
|
103
|
+
const routes = useRouter().getRoutes()
|
|
104
|
+
const allowedMenus: MenuData[] = []
|
|
105
|
+
const { getDescription, getIcon, getIconColor } = useSettingsMenu()
|
|
106
|
+
|
|
107
|
+
const menuRoutes = routes.filter((route) => route.meta && route.meta.menuPath)
|
|
108
|
+
|
|
109
|
+
for (const route of menuRoutes) {
|
|
110
|
+
const menuPath = route.meta.menuPath as string
|
|
111
|
+
const requiredGroups = route.meta.requiredGroups as string[] | undefined
|
|
112
|
+
|
|
113
|
+
const pathParts = menuPath.split('/')
|
|
114
|
+
const pageName = pathParts[pathParts.length - 1]
|
|
115
|
+
|
|
116
|
+
if (hasAccessByPageMeta(pageName)) {
|
|
117
|
+
const icon = getIcon(pageName)
|
|
118
|
+
const iconClass = getIconColor(pageName)
|
|
119
|
+
|
|
120
|
+
const menuItem: MenuData = {
|
|
121
|
+
label: t(pageName),
|
|
122
|
+
url: `/${xorg}/${pageName}`,
|
|
123
|
+
isolationType: 'none',
|
|
124
|
+
icon: typeof icon === 'string' ? icon : '',
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
allowedMenus.push(menuItem)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return allowedMenus
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export const getMenuMetadata = (pageName: string) => {
|
|
135
|
+
const routes = useRouter().getRoutes()
|
|
136
|
+
const route = routes.find((r) => {
|
|
137
|
+
const menuPath = r.meta?.menuPath as string | undefined
|
|
138
|
+
return menuPath && menuPath.endsWith(`/${pageName}`)
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
if (route?.meta) {
|
|
142
|
+
return {
|
|
143
|
+
description: route.meta.description ? t(route.meta.description as string) : t(pageName),
|
|
144
|
+
icon: route.meta.icon || '',
|
|
145
|
+
colorClass: route.meta.colorClass || '',
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const { getDescription, getIcon, getIconColor } = useSettingsMenu()
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
description: t(getDescription(pageName)),
|
|
153
|
+
icon: getIcon(pageName),
|
|
154
|
+
colorClass: getIconColor(pageName),
|
|
155
|
+
}
|
|
70
156
|
}
|
|
@@ -2,17 +2,24 @@ import { RouteLocationNormalizedGeneric } from 'vue-router';
|
|
|
2
2
|
import { getUserProfile } from './../composables/getUserStore.generate';
|
|
3
3
|
|
|
4
4
|
export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
5
|
-
console.log(to.path)
|
|
6
|
-
const
|
|
5
|
+
// console.log("to",to.path)
|
|
6
|
+
const uauth = useAuthState()
|
|
7
|
+
|
|
8
|
+
if(isPublicPath(to.path)) return true
|
|
9
|
+
if(!uauth.data.value) return navigateTo('/login')
|
|
10
|
+
|
|
11
|
+
let userProfile = getUserProfile()
|
|
7
12
|
const xorg = <string>to.params['xorg'] ?? 'MC0wLTA'
|
|
8
13
|
useNuxtApp().$userstore.xOrg=xorg
|
|
9
14
|
if(!userProfile?._id){
|
|
10
15
|
// console.error("middleware detect no user id, reload under xorg",xorg)
|
|
11
16
|
await reloadUserStoreFromMiddleware(xorg)
|
|
17
|
+
userProfile = getUserProfile()
|
|
12
18
|
// console.log("after reload",userProfile)
|
|
13
|
-
}else if(userProfile
|
|
19
|
+
}else if(userProfile?.branchId===0 && xorg !='MC0wLTA'){
|
|
14
20
|
// console.error("middleware detect wrong xorg reload profile for",xorg)
|
|
15
21
|
await reloadUserStoreFromMiddleware(xorg)
|
|
22
|
+
userProfile = getUserProfile()
|
|
16
23
|
// console.log("after reload",userProfile)
|
|
17
24
|
}else{
|
|
18
25
|
// console.log("use exists, use back the user store")
|
|
@@ -21,9 +28,9 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
21
28
|
|
|
22
29
|
|
|
23
30
|
const currentgroup = useCookie('currentGroup').value
|
|
24
|
-
if(currentgroup && userProfile
|
|
31
|
+
if(currentgroup && userProfile?.groups?.includes(currentgroup)){
|
|
25
32
|
//use back ground
|
|
26
|
-
}else if(userProfile
|
|
33
|
+
}else if(userProfile?.groups?.length>0){
|
|
27
34
|
goTo('pickgroup')
|
|
28
35
|
}
|
|
29
36
|
// if (!currentgroup)goTo('pickgroup')
|
|
@@ -43,7 +50,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
const license = useLicense().getLicense()
|
|
46
|
-
console.log("metas check",metas)
|
|
53
|
+
// console.log("metas check",metas)
|
|
47
54
|
if(metas.length == 0){
|
|
48
55
|
throw createError({
|
|
49
56
|
statusCode: 404,
|
|
@@ -83,7 +90,8 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
83
90
|
if(to.meta['requiredGroups']){
|
|
84
91
|
|
|
85
92
|
const requiredGroups:string[] = to.meta['requiredGroups']
|
|
86
|
-
const userGroups = userProfile
|
|
93
|
+
const userGroups = userProfile?.groups || []
|
|
94
|
+
const userRoles = userProfile?.roles || []
|
|
87
95
|
let allowAccess = false
|
|
88
96
|
if(['','/'].includes(to.path)) allowAccess= true
|
|
89
97
|
|
|
@@ -92,7 +100,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
92
100
|
if(userGroups.includes(g)){
|
|
93
101
|
allowAccess = true
|
|
94
102
|
}
|
|
95
|
-
if(
|
|
103
|
+
if(userRoles.includes(g)){
|
|
96
104
|
allowAccess = true
|
|
97
105
|
}
|
|
98
106
|
|
|
@@ -106,7 +114,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
106
114
|
});
|
|
107
115
|
}
|
|
108
116
|
}
|
|
109
|
-
console.log("middleware check isexpired",useLicense().isExpired())
|
|
117
|
+
// console.log("middleware check isexpired",useLicense().isExpired())
|
|
110
118
|
if(!useLicense().isExpired()) {
|
|
111
119
|
return true
|
|
112
120
|
}else if(allowAccessExpired(to)){
|
|
@@ -125,15 +133,22 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
125
133
|
const allowAccessExpired = (to:RouteLocationNormalizedGeneric)=>{
|
|
126
134
|
const userProfile = getUserProfile()
|
|
127
135
|
let allowPass = false
|
|
128
|
-
const isSuperAdmin = userProfile
|
|
136
|
+
const isSuperAdmin = userProfile?.groups?.includes('superadmin') ?? false
|
|
129
137
|
if(isSuperAdmin){
|
|
130
138
|
allowPass=true
|
|
131
139
|
}
|
|
132
140
|
const allowedPath = ['/billing','/pickgroup']
|
|
133
141
|
for(const p of allowedPath){
|
|
134
|
-
console.log("to.path.includes",to.path,p)
|
|
142
|
+
// console.log("to.path.includes",to.path,p)
|
|
135
143
|
if(to.path.includes(p))allowPass = true
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
return allowPass
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const isPublicPath=(path:string)=>{
|
|
150
|
+
if(path.includes('/login')) return true
|
|
151
|
+
if(path.includes('/relogin')) return true
|
|
152
|
+
if(path.includes('/logout')) return true
|
|
153
|
+
return false
|
|
139
154
|
}
|
|
@@ -180,59 +180,57 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
180
180
|
this.roles.includes(permission),
|
|
181
181
|
);
|
|
182
182
|
},
|
|
183
|
-
canPerform(resourcename: string, action: string): boolean {
|
|
183
|
+
canPerform(resourcename: string, action: string): boolean {
|
|
184
|
+
const normalizedResource = resourcename.toLowerCase();
|
|
185
|
+
|
|
184
186
|
if (
|
|
185
187
|
this.roles.includes("superadmin") ||
|
|
186
188
|
this.roles.includes("tenantowner") ||
|
|
187
189
|
this.roles.includes("superuser")
|
|
188
190
|
) {
|
|
189
191
|
return true;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
} else if (resourcename == "Upgradelevel") {
|
|
207
|
-
if (
|
|
208
|
-
this.roles.includes("admin") ||
|
|
209
|
-
this.roles.includes("manager") ||
|
|
210
|
-
this.roles.includes("executive")
|
|
211
|
-
) {
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
} else if (resourcename == "Appintegration") {
|
|
215
|
-
if (this.roles.includes("admin") || this.roles.includes("manager")) {
|
|
216
|
-
return true;
|
|
217
|
-
}
|
|
218
|
-
} else if (resourcename == "Postingtosimbiz") {
|
|
219
|
-
if (this.roles.includes("admin")) {
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const specialCases: Record<string, string[]> = {
|
|
195
|
+
// paymentverify: ["admin", "manager"],
|
|
196
|
+
// reminder: ["admin", "manager"],
|
|
197
|
+
// generateinvoice: ["admin", "manager", "executive"],
|
|
198
|
+
// upgradelevel: ["admin", "manager", "executive"],
|
|
199
|
+
appintegration: ["admin", "manager"],
|
|
200
|
+
miniapp: ["admin", "manager"],
|
|
201
|
+
studentdescription: ["admin", "manager", "executive"],
|
|
202
|
+
miniappinstallation: ["admin", "manager"],
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
if (specialCases[normalizedResource]) {
|
|
206
|
+
const requiredGroups = specialCases[normalizedResource];
|
|
207
|
+
if (requiredGroups.some((group) => this.roles.includes(group))) {
|
|
220
208
|
return true;
|
|
221
209
|
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
try {
|
|
213
|
+
const routes = useRouter().getRoutes();
|
|
214
|
+
const route = routes.find((r) => {
|
|
215
|
+
const menuPath = r.meta?.menuPath as string | undefined;
|
|
216
|
+
return menuPath && menuPath.endsWith(`/${normalizedResource}`);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
if (route?.meta?.requiredGroups) {
|
|
220
|
+
const requiredGroups = route.meta.requiredGroups as string[];
|
|
221
|
+
const userGroups = this.groups || [];
|
|
222
|
+
|
|
223
|
+
if (requiredGroups.some((group) => userGroups.includes(group))) {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
229
226
|
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// console.log("verify",checkstr)
|
|
233
|
-
return this.roles.includes(checkstr);
|
|
227
|
+
} catch (e) {
|
|
228
|
+
console.error(e)
|
|
234
229
|
}
|
|
235
|
-
|
|
230
|
+
|
|
231
|
+
const checkstr = `${normalizedResource}:${action}`;
|
|
232
|
+
const checkstrOriginal = `${resourcename}:${action}`;
|
|
233
|
+
return this.roles.includes(checkstr) || this.roles.includes(checkstrOriginal);
|
|
236
234
|
},
|
|
237
235
|
haveAccess(resourcename: string) {
|
|
238
236
|
//super admin always full access right
|
|
@@ -244,11 +242,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
244
242
|
this.roles.includes("superuser")
|
|
245
243
|
) {
|
|
246
244
|
return true;
|
|
247
|
-
}
|
|
248
|
-
if (this.roles.includes("admin") || this.roles.includes("manager")) {
|
|
249
|
-
return true;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
245
|
+
}
|
|
252
246
|
for (let i = 0; i < this.roles.length; i++) {
|
|
253
247
|
const role: string = this.roles[i];
|
|
254
248
|
if (role.includes(resourcename)) {
|
|
@@ -339,7 +333,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
339
333
|
},
|
|
340
334
|
};
|
|
341
335
|
}
|
|
342
|
-
}
|
|
336
|
+
}
|
|
343
337
|
// else
|
|
344
338
|
//
|
|
345
339
|
}
|
package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPageIframe.vue.eta
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"
|
|
13
13
|
:title="pageInfo.title || t('miniAppLang.content')"
|
|
14
14
|
sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-modals"
|
|
15
|
+
allow="clipboard-write"
|
|
15
16
|
referrerpolicy="origin"
|
|
16
17
|
loading="lazy"
|
|
17
18
|
@error="handleError"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/buildinschemas/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,SAAS,CAAA;AAE5D,eAAO,MAAM,WAAW,EAAC,UA6BtB,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.docnoformat = void 0;
|
|
4
|
-
const type_1 = require("../type");
|
|
5
|
-
exports.docnoformat = {
|
|
6
|
-
"type": "object",
|
|
7
|
-
"x-simpleapp-config": {
|
|
8
|
-
"documentType": "msg",
|
|
9
|
-
"documentName": "message",
|
|
10
|
-
"isolationType": type_1.IsolationType.tenant,
|
|
11
|
-
"documentTitle": "messageTitle"
|
|
12
|
-
},
|
|
13
|
-
"properties": {
|
|
14
|
-
"_id": { "type": "string" },
|
|
15
|
-
"created": { "type": "string" },
|
|
16
|
-
"updated": { "type": "string" },
|
|
17
|
-
"createdBy": { "type": "string" },
|
|
18
|
-
"updatedBy": { "type": "string" },
|
|
19
|
-
"tenantId": { "type": "integer", "default": 1 },
|
|
20
|
-
"orgId": { "type": "integer", "default": 1 },
|
|
21
|
-
"branchId": { "type": "integer", "default": 1 },
|
|
22
|
-
"messageTitle": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"minLength": 3
|
|
25
|
-
},
|
|
26
|
-
"read": { "type": "boolean", "default": false },
|
|
27
|
-
"url": { "type": "string" },
|
|
28
|
-
"description": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"format": "text"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=message.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/buildinschemas/message.ts"],"names":[],"mappings":";;;AAAA,kCAA4D;AAE/C,QAAA,WAAW,GACxB;IACI,MAAM,EAAE,QAAQ;IAChB,oBAAoB,EAAE;QACpB,cAAc,EAAE,KAAK;QACrB,cAAc,EAAE,SAAS;QACzB,eAAe,EAAE,oBAAa,CAAC,MAAM;QACrC,eAAe,EAAE,cAAc;KAChC;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;QAC3B,SAAS,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;QAC/B,SAAS,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;QAC/B,WAAW,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;QACjC,WAAW,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;QACjC,UAAU,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE;QAC/C,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE;QAC5C,UAAU,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE;QAC/C,cAAc,EAAE;YACd,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,CAAC;SACf;QACD,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAC;QAC9C,KAAK,EAAC,EAAE,MAAM,EAAE,QAAQ,EAAC;QACzB,aAAa,EAAE;YACb,MAAM,EAAE,QAAQ;YAChB,QAAQ,EAAE,MAAM;SACjB;KACF;CACF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhookhistory.d.ts","sourceRoot":"","sources":["../../src/buildinschemas/webhookhistory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,SAAS,CAAA;AAE5D,eAAO,MAAM,cAAc,EAAC,UAsC3B,CAAA"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.webhookhistory = void 0;
|
|
4
|
-
const type_1 = require("../type");
|
|
5
|
-
exports.webhookhistory = {
|
|
6
|
-
type: "object",
|
|
7
|
-
"x-simpleapp-config": {
|
|
8
|
-
documentType: 'webhookhistory',
|
|
9
|
-
documentName: 'webhookhistory',
|
|
10
|
-
isolationType: type_1.IsolationType.tenant,
|
|
11
|
-
// uniqueKey:'documentName',
|
|
12
|
-
// documentTitle:'documentName'
|
|
13
|
-
// pageType:"crud",
|
|
14
|
-
},
|
|
15
|
-
required: ["documentName", "url"],
|
|
16
|
-
properties: {
|
|
17
|
-
_id: { type: 'string' },
|
|
18
|
-
created: { type: 'string' },
|
|
19
|
-
updated: { type: 'string' },
|
|
20
|
-
createdBy: { type: 'string' },
|
|
21
|
-
updatedBy: { type: 'string' },
|
|
22
|
-
tenantId: { type: 'integer', default: 1, minimum: 0 },
|
|
23
|
-
orgId: { type: 'integer', default: 1, minimum: 0 },
|
|
24
|
-
branchId: { type: 'integer', default: 1, minimum: 0 },
|
|
25
|
-
webHookId: { type: "string", format: "uuid" },
|
|
26
|
-
url: { type: "string", format: 'uri' },
|
|
27
|
-
authentication: { type: "string" },
|
|
28
|
-
headers: {
|
|
29
|
-
type: "array",
|
|
30
|
-
items: {
|
|
31
|
-
type: "object",
|
|
32
|
-
description: "http headers",
|
|
33
|
-
properties: {
|
|
34
|
-
name: { type: 'string' },
|
|
35
|
-
value: { type: 'string' }
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
description: { type: "string", format: "text" },
|
|
40
|
-
setting: { type: "string", format: "text" },
|
|
41
|
-
result: { type: "string" }
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=webhookhistory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhookhistory.js","sourceRoot":"","sources":["../../src/buildinschemas/webhookhistory.ts"],"names":[],"mappings":";;;AAAA,kCAA4D;AAE/C,QAAA,cAAc,GAAc;IACrC,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAC;QACnB,YAAY,EAAC,gBAAgB;QAC7B,YAAY,EAAC,gBAAgB;QAC7B,aAAa,EAAC,oBAAa,CAAC,MAAM;QAClC,4BAA4B;QAC5B,+BAA+B;QAC/B,yBAAyB;KAC1B;IACD,QAAQ,EAAC,CAAC,cAAc,EAAC,KAAK,CAAC;IAC/B,UAAU,EAAE;QACV,GAAG,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACnB,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACvB,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACvB,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACzB,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACzB,QAAQ,EAAE,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,OAAO,EAAC,CAAC,EAAE;QAC/C,KAAK,EAAE,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,OAAO,EAAC,CAAC,EAAE;QAC5C,QAAQ,EAAE,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,OAAO,EAAC,CAAC,EAAE;QAC/C,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,MAAM,EAAC;QACvC,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAC,KAAK,EAAC;QACnC,cAAc,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAChC,OAAO,EAAE;YACP,IAAI,EAAE,OAAO;YACb,KAAK,EAAC;gBACJ,IAAI,EAAC,QAAQ;gBACb,WAAW,EAAC,cAAc;gBAC1B,UAAU,EAAC;oBACT,IAAI,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;oBACpB,KAAK,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;iBACtB;aACF;SACF;QACD,WAAW,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,EAAC,MAAM,EAAC;QAC3C,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,MAAM,EAAC;QACrC,MAAM,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;KACvB;CACJ,CAAA"}
|