Browse Source

fix: Role reference error

pull/6399/head
mertmit 1 year ago
parent
commit
7535f71e66
  1. 5
      packages/nc-gui/components/account/UserList.vue
  2. 4
      packages/nc-gui/components/account/UsersModal.vue
  3. 1
      packages/nc-gui/lib/constants.ts
  4. 7
      packages/nc-gui/store/workspace.ts

5
packages/nc-gui/components/account/UserList.vue

@ -1,4 +1,5 @@
<script lang="ts" setup>
import { OrgUserRoles } from 'nocodb-sdk'
import type { OrgUserReqType, RequestParams, Roles, UserType } from 'nocodb-sdk'
import type { User } from '#imports'
import { extractSdkResponseErrorMsg, iconMap, useApi, useCopy, useDashboard, useNuxtApp } from '#imports'
@ -195,7 +196,7 @@ const copyPasswordResetUrl = async (user: User) => {
>
<a-select-option
class="nc-users-list-role-option"
:value="Role.OrgLevelCreator"
:value="OrgUserRoles.CREATOR"
:label="$t(`objects.roleType.orgLevelCreator`)"
>
<div>{{ $t(`objects.roleType.orgLevelCreator`) }}</div>
@ -206,7 +207,7 @@ const copyPasswordResetUrl = async (user: User) => {
<a-select-option
class="nc-users-list-role-option"
:value="Role.OrgLevelViewer"
:value="OrgUserRoles.VIEWER"
:label="$t(`objects.roleType.orgLevelViewer`)"
>
<div>{{ $t(`objects.roleType.orgLevelViewer`) }}</div>

4
packages/nc-gui/components/account/UsersModal.vue

@ -196,7 +196,7 @@ const emailInput: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
<a-select v-model:value="usersData.role" class="nc-user-roles" dropdown-class-name="nc-dropdown-user-role">
<a-select-option
class="nc-role-option"
:value="Role.OrgLevelCreator"
:value="OrgUserRoles.CREATOR"
:label="$t(`objects.roleType.orgLevelCreator`)"
>
<div>{{ $t(`objects.roleType.orgLevelCreator`) }}</div>
@ -207,7 +207,7 @@ const emailInput: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
<a-select-option
class="nc-role-option"
:value="Role.OrgLevelViewer"
:value="OrgUserRoles.VIEWER"
:label="$t(`objects.roleType.orgLevelViewer`)"
>
<div>{{ $t(`objects.roleType.orgLevelViewer`) }}</div>

1
packages/nc-gui/lib/constants.ts

@ -43,6 +43,7 @@ const rolePermissions = {
projectMove: true,
projectDelete: true,
projectDuplicate: true,
newUser: true,
},
},
[OrgUserRoles.VIEWER]: {

7
packages/nc-gui/store/workspace.ts

@ -1,3 +1,4 @@
import { OrgUserRoles } from 'nocodb-sdk'
import type { ProjectType } from 'nocodb-sdk'
import { acceptHMRUpdate, defineStore } from 'pinia'
import { message } from 'ant-design-vue'
@ -66,17 +67,17 @@ export const useWorkspace = defineStore('workspaceStore', () => {
/** getters */
const isWorkspaceCreator = computed(() => {
// todo: type correction
return orgRoles.value?.[Role.OrgLevelCreator]
return orgRoles.value?.[OrgUserRoles.CREATOR]
})
const isWorkspaceOwner = computed(() => {
// todo: type correction
return orgRoles.value?.[Role.OrgLevelCreator]
return orgRoles.value?.[OrgUserRoles.CREATOR]
})
const isWorkspaceOwnerOrCreator = computed(() => {
// todo: type correction
return orgRoles.value?.[Role.OrgLevelCreator]
return orgRoles.value?.[OrgUserRoles.CREATOR]
})
/** actions */

Loading…
Cancel
Save