Browse Source

Merge pull request #3948 from nocodb/fix/3865-disable-external-project-create

Fix: Project create - disable external project create using env
pull/3951/head
Pranav C 2 years ago committed by GitHub
parent
commit
987b020b44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      packages/nc-gui/pages/index/index/index.vue
  2. 9
      packages/nocodb/src/lib/meta/api/projectApis.ts

5
packages/nc-gui/pages/index/index/index.vue

@ -14,6 +14,7 @@ import {
ref,
themeV2Colors,
useApi,
useGlobal,
useNuxtApp,
useUIPermission,
} from '#imports'
@ -32,6 +33,8 @@ const filterQuery = ref('')
const projects = ref<ProjectType[]>()
const { appInfo } = useGlobal()
const loadProjects = async () => {
const response = await api.project.list({})
projects.value = response.list
@ -177,7 +180,7 @@ onBeforeMount(loadProjects)
</div>
</a-menu-item>
<a-menu-item>
<a-menu-item v-if="appInfo.connectToExternalDB">
<div
v-e="['c:project:create:extdb']"
class="nc-project-menu-item group nc-create-external-db-project"

9
packages/nocodb/src/lib/meta/api/projectApis.ts

@ -55,7 +55,11 @@ export async function projectUpdate(
'color',
]);
if (data?.title && project.title !== data.title && await Project.getByTitle(data.title)) {
if (
data?.title &&
project.title !== data.title &&
(await Project.getByTitle(data.title))
) {
NcError.badRequest('Project title already in use');
}
@ -114,6 +118,9 @@ async function projectCreate(req: Request<any, any>, res) {
},
];
} else {
if (process.env.NC_CONNECT_TO_EXTERNAL_DB_DISABLED) {
NcError.badRequest('Connecting to external db is disabled');
}
projectBody.is_meta = false;
}

Loading…
Cancel
Save