Browse Source

fix(gui): type correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3796/head
Pranav C 2 years ago
parent
commit
4b4561c6fc
  1. 4
      packages/nc-gui/composables/useUIPermission/index.ts
  2. 2
      packages/nc-gui/composables/useUIPermission/rolePermissions.ts
  3. 1
      packages/nc-gui/pages/index/apps.vue

4
packages/nc-gui/composables/useUIPermission/index.ts

@ -12,10 +12,10 @@ const hasPermission = (role: Role | ProjectRole, hasRole: boolean, permission: P
if (isString(rolePermission) && rolePermission === '*') return true
// todo: type correction
if ('include' in rolePermission) {
if ('include' in rolePermission && rolePermission.include) {
return rolePermission.include[permission]
}
if ('exclude' in rolePermission) {
if ('exclude' in rolePermission && rolePermission.exclude) {
return !rolePermission.exclude[permission]
}

2
packages/nc-gui/composables/useUIPermission/rolePermissions.ts

@ -1,6 +1,6 @@
import { ProjectRole, Role } from '~/lib'
const rolePermissions = {
const rolePermissions: Record<Role | ProjectRole, '*' | Partial<Record<'include' | 'exclude', Record<string, boolean>>>> = {
// general role permissions
/** todo: enable wildcard permission
* limited permission due to unexpected behaviour in shared base if opened in same window */

1
packages/nc-gui/pages/index/apps.vue

@ -5,6 +5,7 @@ import { Role } from '~/lib'
definePageMeta({
requiresAuth: true,
allowedRoles: [Role.Super],
title: 'title.appStore',
})
</script>

Loading…
Cancel
Save