Browse Source

Merge pull request #5570 from nocodb/fix/ltar-gallery

fix(nocodb): allow gallery to access hm / bt / mm list
pull/5581/head
Pranav C 1 year ago committed by GitHub
parent
commit
4f924be506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 51
      packages/nocodb-nest/src/db/BaseModelSqlv2.ts
  2. 18
      packages/nocodb-nest/src/services/public-datas.service.ts

51
packages/nocodb-nest/src/db/BaseModelSqlv2.ts

@ -1601,17 +1601,16 @@ class BaseModelSqlv2 {
// hide if column marked as hidden in view
// of if column is system field and system field is hidden
if (
fieldsSet
? !fieldsSet.has(column.title)
: !extractPkAndPv &&
!(viewOrTableColumn instanceof Column) &&
(!(viewOrTableColumn as GridViewColumn)?.show ||
(!view?.show_system_fields &&
column.uidt !== UITypes.ForeignKey &&
!column.pk &&
isSystemColumn(column)))
)
shouldSkipField(
fieldsSet,
viewOrTableColumn,
view,
column,
extractPkAndPv,
)
) {
continue;
}
if (!checkColumnRequired(column, fields, extractPkAndPv)) continue;
@ -3347,4 +3346,36 @@ function haveFormulaColumn(columns: Column[]) {
return columns.some((c) => c.uidt === UITypes.Formula);
}
function shouldSkipField(
fieldsSet,
viewOrTableColumn,
view,
column,
extractPkAndPv,
) {
if (fieldsSet) {
return !fieldsSet.has(column.title);
} else {
if (!extractPkAndPv) {
if (!(viewOrTableColumn instanceof Column)) {
if (
!(viewOrTableColumn as GridViewColumn)?.show &&
!(column.rqd && !column.cdf && !column.ai) &&
!column.pk &&
column.uidt !== UITypes.ForeignKey
)
return true;
if (
!view?.show_system_fields &&
column.uidt !== UITypes.ForeignKey &&
!column.pk &&
isSystemColumn(column)
)
return true;
}
}
return false;
}
}
export { BaseModelSqlv2 };

18
packages/nocodb-nest/src/services/public-datas.service.ts

@ -305,7 +305,9 @@ export class PublicDatasService {
if (!view) NcError.notFound('Not found');
if (view.type !== ViewTypes.FORM) NcError.notFound('Not found');
if (view.type !== ViewTypes.FORM && view.type !== ViewTypes.GALLERY) {
NcError.notFound('Not found');
}
if (view.password && view.password !== param.password) {
NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD);
@ -360,8 +362,13 @@ export class PublicDatasService {
const view = await View.getByUUID(param.sharedViewUuid);
if (!view) NcError.notFound('Not found');
if (view.type !== ViewTypes.GRID && view.type !== ViewTypes.KANBAN)
if (
view.type !== ViewTypes.GRID &&
view.type !== ViewTypes.KANBAN &&
view.type !== ViewTypes.GALLERY
) {
NcError.notFound('Not found');
}
if (view.password && view.password !== param.password) {
NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD);
@ -426,8 +433,13 @@ export class PublicDatasService {
const view = await View.getByUUID(param.sharedViewUuid);
if (!view) NcError.notFound('Not found');
if (view.type !== ViewTypes.GRID && view.type !== ViewTypes.KANBAN)
if (
view.type !== ViewTypes.GRID &&
view.type !== ViewTypes.KANBAN &&
view.type !== ViewTypes.GALLERY
) {
NcError.notFound('Not found');
}
if (view.password && view.password !== param.password) {
NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD);

Loading…
Cancel
Save