Browse Source

fix: make shared base readonly

pull/9678/head
Pranav C 1 month ago
parent
commit
cc2393712a
  1. 14
      packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue
  2. 2
      packages/nocodb/src/services/shared-bases.service.ts
  3. 4
      packages/nocodb/src/strategies/base-view.strategy/base-view.strategy.ts

14
packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue

@ -119,11 +119,11 @@ const onRoleToggle = async () => {
isRoleToggleLoading.value = true isRoleToggleLoading.value = true
try { try {
if (sharedBase.value.role === ShareBaseRole.Viewer) { // if (sharedBase.value.role === ShareBaseRole.Viewer) {
await createShareBase(ShareBaseRole.Editor) // await createShareBase(ShareBaseRole.Editor)
} else { // } else {
await createShareBase(ShareBaseRole.Viewer) await createShareBase(ShareBaseRole.Viewer)
} // }
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} finally { } finally {
@ -149,13 +149,13 @@ const onRoleToggle = async () => {
<GeneralCopyUrl v-model:url="url" /> <GeneralCopyUrl v-model:url="url" />
<div v-if="!appInfo.ee" class="flex flex-row justify-between mt-3 bg-gray-50 px-3 py-2 rounded-md"> <div v-if="!appInfo.ee" class="flex flex-row justify-between mt-3 bg-gray-50 px-3 py-2 rounded-md">
<div class="text-black">{{ $t('activity.editingAccess') }}</div> <div class="text-black">{{ $t('activity.editingAccess') }}</div>
<a-switch <!-- <a-switch
v-e="['c:share:base:role:toggle']" v-e="['c:share:base:role:toggle']"
:loading="isRoleToggleLoading" :loading="isRoleToggleLoading"
:checked="sharedBase?.role === ShareBaseRole.Editor" :checked="sharedBase?.role === ShareBaseRole.Editor"
class="ml-2" class="ml-2"
@click="onRoleToggle" @click="onRoleToggle"
/> /> -->
</div> </div>
</div> </div>
</div> </div>

2
packages/nocodb/src/services/shared-bases.service.ts

@ -40,7 +40,7 @@ export class SharedBasesService {
roles = 'viewer'; roles = 'viewer';
} }
if (roles === 'editor' && process.env.NC_CLOUD === 'true') { if (roles === 'editor') {
NcError.badRequest('Only viewer role is supported'); NcError.badRequest('Only viewer role is supported');
} }

4
packages/nocodb/src/strategies/base-view.strategy/base-view.strategy.ts

@ -23,8 +23,8 @@ export class BaseViewStrategy extends PassportStrategy(Strategy, 'base-view') {
} }
user = { user = {
roles: extractRolesObj(sharedProject?.roles), roles: extractRolesObj('viewer'),
base_roles: extractRolesObj(sharedProject?.roles), base_roles: extractRolesObj('viewer'),
}; };
} }

Loading…
Cancel
Save