@finema/finework-layer 1.0.63 → 1.0.64
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/CHANGELOG.md +6 -0
- package/app/composables/useAuth.ts +17 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.64](https://gitlab.finema.co/finema/finework/finework-frontend-layer/compare/1.0.63...1.0.64) (2026-05-25)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* enhance hasPermission to support array-based module permissions ([869121a](https://gitlab.finema.co/finema/finework/finework-frontend-layer/commit/869121afc544939c6b578fef84b0ca82cad6d270))
|
|
8
|
+
|
|
3
9
|
## [1.0.63](https://gitlab.finema.co/finema/finework/finework-frontend-layer/compare/1.0.62...1.0.63) (2026-05-23)
|
|
4
10
|
|
|
5
11
|
### Features
|
|
@@ -225,12 +225,26 @@ export const useAuth = () => {
|
|
|
225
225
|
me.set(null)
|
|
226
226
|
})
|
|
227
227
|
|
|
228
|
-
const hasPermission = (module: UserModule, ...
|
|
229
|
-
|
|
228
|
+
const hasPermission = (module: UserModule, ...permissions: Permission[]) => {
|
|
229
|
+
const accessLevel = me.value?.access_level
|
|
230
|
+
|
|
231
|
+
if (!accessLevel) {
|
|
230
232
|
return false
|
|
231
233
|
}
|
|
232
234
|
|
|
233
|
-
|
|
235
|
+
const modulePermission = accessLevel[module]
|
|
236
|
+
|
|
237
|
+
if (!modulePermission) {
|
|
238
|
+
return false
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (Array.isArray(modulePermission)) {
|
|
242
|
+
return modulePermission.some((permission) =>
|
|
243
|
+
permissions.includes(permission),
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return permissions.includes(modulePermission)
|
|
234
248
|
}
|
|
235
249
|
|
|
236
250
|
const isSuperAdmin = computed(() => {
|