Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: set VIEW_KEY for personal views when viewId parameter is present

Pranav Ce1b3dbb8dcef
diff --git a/packages/nocodb/src/middlewares/extract-ids/extract-ids.middleware.ts b/packages/nocodb/src/middlewares/extract-ids/extract-ids.middleware.ts
index 228d09507a..8fd179a7e0 100644
--- a/packages/nocodb/src/middlewares/extract-ids/extract-ids.middleware.ts
+++ b/packages/nocodb/src/middlewares/extract-ids/extract-ids.middleware.ts
@@ -203,6 +203,12 @@ export class ExtractIdsMiddleware implements NestMiddleware, CanActivate {
}
req.ncSourceId = view.source_id;
+
+ // if view API and view is personal view then check if user has access to view
+ // Check if it's a View (not a Model) by checking for lock_type property
+ if (view && 'lock_type' in view && view.lock_type === ViewLockType.Personal) {
+ req[VIEW_KEY] = view;
+ }
} else if (
formViewId ||
gridViewId ||
@@ -230,6 +236,11 @@ export class ExtractIdsMiddleware implements NestMiddleware, CanActivate {
}
req.ncSourceId = view.source_id;
+
+ // if view API and view is personal view then check if user has access to view
+ if (view && view.lock_type === ViewLockType.Personal) {
+ req[VIEW_KEY] = view;
+ }
} else if (publicDataUuid) {
const view = await View.getByUUID(context, publicDataUuid);