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
try {
if (sharedBase.value.role === ShareBaseRole.Viewer) {
await createShareBase(ShareBaseRole.Editor)
} else {
await createShareBase(ShareBaseRole.Viewer)
}
// if (sharedBase.value.role === ShareBaseRole.Viewer) {
// await createShareBase(ShareBaseRole.Editor)
// } else {
await createShareBase(ShareBaseRole.Viewer)
// }
} catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e))
} finally {
@ -149,13 +149,13 @@ const onRoleToggle = async () => {
<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 class="text-black">{{ $t('activity.editingAccess') }}</div>
<a-switch
<!-- <a-switch
v-e="['c:share:base:role:toggle']"
:loading="isRoleToggleLoading"
:checked="sharedBase?.role === ShareBaseRole.Editor"
class="ml-2"
@click="onRoleToggle"
/>
/> -->
</div>
</div>
</div>

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

@ -40,7 +40,7 @@ export class SharedBasesService {
roles = 'viewer';
}
if (roles === 'editor' && process.env.NC_CLOUD === 'true') {
if (roles === 'editor') {
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 = {
roles: extractRolesObj(sharedProject?.roles),
base_roles: extractRolesObj(sharedProject?.roles),
roles: extractRolesObj('viewer'),
base_roles: extractRolesObj('viewer'),
};
}

Loading…
Cancel
Save