Browse Source

fix(gui): public shared view issues

- hide virtual columns from filters and sort
- password protected form
- hide filter
- should be available without auth

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/669/head
Pranav C 3 years ago
parent
commit
63a27f0ed5
  1. 3
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue
  2. 2
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItemsModal.vue
  3. 4
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue
  4. 1
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/lookupCell.vue
  5. 1
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue
  6. 1
      packages/nc-gui/components/project/spreadsheet/public/xcForm.vue
  7. 15
      packages/nc-gui/components/project/spreadsheet/public/xcTable.vue
  8. 4
      packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue
  9. 9
      packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts

3
packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue

@ -147,7 +147,8 @@ export default {
isPublic: Boolean, isPublic: Boolean,
rowId: [String, Number], rowId: [String, Number],
column: Object, column: Object,
type: String type: String,
password: String
}, },
data: () => ({ data: () => ({
data: null, data: null,

2
packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItemsModal.vue

@ -12,6 +12,7 @@
:is-new="isNew" :is-new="isNew"
:size="10" :size="10"
:meta="meta" :meta="meta"
:password="password"
:parent-meta="parentMeta" :parent-meta="parentMeta"
:primary-col="primaryCol" :primary-col="primaryCol"
:primary-key="primaryKey" :primary-key="primaryKey"
@ -37,6 +38,7 @@ export default {
readOnly: Boolean, readOnly: Boolean,
localState: Array, localState: Array,
isNew: Boolean, isNew: Boolean,
password: String,
value: Boolean, value: Boolean,
title: { title: {
type: String, type: String,

4
packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue

@ -72,7 +72,9 @@
:is-new="isNew" :is-new="isNew"
:size="10" :size="10"
:meta="childMeta" :meta="childMeta"
:parent-meta="meta" :parent-meta="meta
:password="
password"
:primary-col="childPrimaryCol" :primary-col="childPrimaryCol"
:primary-key="childPrimaryKey" :primary-key="childPrimaryKey"
:api="childApi" :api="childApi"

1
packages/nc-gui/components/project/spreadsheet/components/virtualCell/lookupCell.vue

@ -36,6 +36,7 @@
:parent-meta="meta" :parent-meta="meta"
:primary-col="lookUpColumnAlias" :primary-col="lookUpColumnAlias"
:api="lookupApi" :api="lookupApi"
:password="password"
:read-only="true" :read-only="true"
:query-params="queryParams" :query-params="queryParams"
/> />

1
packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue

@ -75,6 +75,7 @@
:row-id="row && row[parentPrimaryKey]" :row-id="row && row[parentPrimaryKey]"
:column="column" :column="column"
type="mm" type="mm"
:password="password"
@new-record="showNewRecordModal" @new-record="showNewRecordModal"
@edit="editChild" @edit="editChild"
@unlink="unlinkChild" @unlink="unlinkChild"

1
packages/nc-gui/components/project/spreadsheet/public/xcForm.vue

@ -243,6 +243,7 @@ export default {
active: null, active: null,
loading: false, loading: false,
showPasswordModal: false, showPasswordModal: false,
password: '',
submitting: false, submitting: false,
submitted: false, submitted: false,
client: null, client: null,

15
packages/nc-gui/components/project/spreadsheet/public/xcTable.vue

@ -5,6 +5,7 @@
</div> </div>
<v-toolbar v-if="meta" height="40" dense class="elevation-0 xc-toolbar xc-border-bottom" style="z-index: 7;border-radius: 4px"> <v-toolbar v-if="meta" height="40" dense class="elevation-0 xc-toolbar xc-border-bottom" style="z-index: 7;border-radius: 4px">
<!--
<div class="d-flex xc-border align-center search-box"> <div class="d-flex xc-border align-center search-box">
<v-menu bottom offset-y> <v-menu bottom offset-y>
<template #activator="{on}"> <template #activator="{on}">
@ -58,10 +59,11 @@
<span <span
v-if="relationType && false" v-if="relationType && false"
class="caption grey--text" class="caption grey&#45;&#45;text"
>{{ refTable }}({{ >{{ refTable }}({{
relationPrimaryValue relationPrimaryValue
}}) -> {{ relationType === 'hm' ? ' Has Many ' : ' Belongs To ' }} -> {{ table }}</span> }}) -> {{ relationType === 'hm' ? ' Has Many ' : ' Belongs To ' }} -> {{ table }}</span>
-->
<v-spacer /> <v-spacer />
@ -74,11 +76,11 @@
<!-- <fields-menu v-model="showFields" :field-list="fieldList" />--> <!-- <fields-menu v-model="showFields" :field-list="fieldList" />-->
<sort-list-menu v-model="sortList" :field-list="fieldList" /> <sort-list-menu v-model="sortList" :field-list="realFieldList" />
<column-filter-menu v-model="filters" :field-list="fieldList" /> <column-filter-menu v-model="filters" :field-list="realFieldList" />
<v-menu> <!-- <v-menu>
<template #activator="{ on, attrs }"> <template #activator="{ on, attrs }">
<v-icon <v-icon
v-bind="attrs" v-bind="attrs"
@ -98,12 +100,12 @@
{{ h.icon }} {{ h.icon }}
</v-icon> </v-icon>
</v-list-item-icon> </v-list-item-icon>
<v-list-item-title :class="{'primary--text' : cellHeight === h.size}" style="text-transform: capitalize"> <v-list-item-title :class="{'primary&#45;&#45;text' : cellHeight === h.size}" style="text-transform: capitalize">
{{ h.size }} {{ h.size }}
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
</v-list> </v-list>
</v-menu> </v-menu>-->
</v-toolbar> </v-toolbar>
<div <div
@ -129,6 +131,7 @@
:nodes="{dbAlias:''}" :nodes="{dbAlias:''}"
:sql-ui="sqlUi" :sql-ui="sqlUi"
:columns-width="columnsWidth" :columns-width="columnsWidth"
:password="password"
/> />
</div> </div>

4
packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue

@ -151,6 +151,7 @@
> >
<virtual-cell <virtual-cell
v-if="columnObj.virtual" v-if="columnObj.virtual"
:password="password"
:is-public="isPublicView" :is-public="isPublicView"
:metas="metas" :metas="metas"
:is-locked="isLocked " :is-locked="isLocked "
@ -273,7 +274,8 @@ export default {
isVirtual: Boolean, isVirtual: Boolean,
isLocked: Boolean, isLocked: Boolean,
columnsWidth: { type: Object }, columnsWidth: { type: Object },
isPkAvail: Boolean isPkAvail: Boolean,
password: String
}, },
data: () => ({ data: () => ({
resizingCol: null, resizingCol: null,

9
packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts

@ -3391,7 +3391,6 @@ export default class NcMetaMgr {
protected async getSharedViewData(req, args: any): Promise<any> { protected async getSharedViewData(req, args: any): Promise<any> {
try { try {
console.log(args);
const viewMeta = await this.xcMeta const viewMeta = await this.xcMeta
.knex('nc_shared_views') .knex('nc_shared_views')
.where({ .where({
@ -3403,6 +3402,14 @@ export default class NcMetaMgr {
// throw new Error('Invalid password') // throw new Error('Invalid password')
// } // }
if (
viewMeta &&
viewMeta.password &&
viewMeta.password !== args.args.password
) {
throw new Error(this.INVALID_PASSWORD_ERROR);
}
const apiBuilder = this.app?.projectBuilders const apiBuilder = this.app?.projectBuilders
?.find(pb => pb.id === viewMeta.project_id) ?.find(pb => pb.id === viewMeta.project_id)
?.apiBuilders?.find(ab => ab.dbAlias === viewMeta.db_alias); ?.apiBuilders?.find(ab => ab.dbAlias === viewMeta.db_alias);

Loading…
Cancel
Save