Browse Source

fix: pass org roles to project role check

pull/6399/head
mertmit 1 year ago
parent
commit
37c42f24d3
  1. 8
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
  2. 3
      packages/nocodb-sdk/src/lib/helperFunctions.ts

8
packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue

@ -1,6 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick } from '@vue/runtime-core' import { nextTick } from '@vue/runtime-core'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { stringifyRolesObj } from 'nocodb-sdk'
import type { BaseType, ProjectType, TableType } from 'nocodb-sdk' import type { BaseType, ProjectType, TableType } from 'nocodb-sdk'
import { LoadingOutlined } from '@ant-design/icons-vue' import { LoadingOutlined } from '@ant-design/icons-vue'
import { useTitle } from '@vueuse/core' import { useTitle } from '@vueuse/core'
@ -43,6 +44,8 @@ const { activeTable } = storeToRefs(useTablesStore())
const { appInfo, navigateToProject } = useGlobal() const { appInfo, navigateToProject } = useGlobal()
const { orgRoles } = useRoles()
useTabs() useTabs()
const editMode = ref(false) const editMode = ref(false)
@ -469,7 +472,10 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string
<GeneralIcon icon="copy" class="group-hover:text-black" /> <GeneralIcon icon="copy" class="group-hover:text-black" />
{{ $t('activity.account.projInfo') }} {{ $t('activity.account.projInfo') }}
</NcMenuItem> </NcMenuItem>
<NcMenuItem v-if="isUIAllowed('projectDuplicate', true, projectRole)" @click="duplicateProject(project)"> <NcMenuItem
v-if="isUIAllowed('projectDuplicate', true, [stringifyRolesObj(orgRoles), projectRole].join())"
@click="duplicateProject(project)"
>
<GeneralIcon icon="duplicate" class="text-gray-700" /> <GeneralIcon icon="duplicate" class="text-gray-700" />
{{ $t('general.duplicate') }} {{ $t('general.duplicate') }}
</NcMenuItem> </NcMenuItem>

3
packages/nocodb-sdk/src/lib/helperFunctions.ts

@ -39,7 +39,8 @@ const extractRolesObj = (roles: RolesType): RolesObj => {
}, {}); }, {});
}; };
const stringifyRolesObj = (roles: Roles): string => { const stringifyRolesObj = (roles?: Roles | null): string => {
if (!roles) return '';
const rolesArr = Object.keys(roles).filter((r) => roles[r]); const rolesArr = Object.keys(roles).filter((r) => roles[r]);
return rolesArr.join(','); return rolesArr.join(',');
}; };

Loading…
Cancel
Save