Browse Source

fix: pass fn names manually to ncMetaAclMw instead of using minified ones

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>
pull/1645/head
Wing-Kam Wong 3 years ago
parent
commit
999b93d0a9
  1. 12
      packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts
  2. 2
      packages/nocodb/src/lib/noco/meta/api/attachmentApis.ts
  3. 11
      packages/nocodb/src/lib/noco/meta/api/auditApis.ts
  4. 14
      packages/nocodb/src/lib/noco/meta/api/columnApis.ts
  5. 10
      packages/nocodb/src/lib/noco/meta/api/dataApis/bulkDataAliasApis.ts
  6. 12
      packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts
  7. 24
      packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts
  8. 22
      packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts
  9. 2
      packages/nocodb/src/lib/noco/meta/api/exportApis.ts
  10. 24
      packages/nocodb/src/lib/noco/meta/api/filterApis.ts
  11. 14
      packages/nocodb/src/lib/noco/meta/api/formViewApis.ts
  12. 5
      packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts
  13. 15
      packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts
  14. 5
      packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts
  15. 10
      packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts
  16. 10
      packages/nocodb/src/lib/noco/meta/api/hookApis.ts
  17. 24
      packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts
  18. 7
      packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts
  19. 10
      packages/nocodb/src/lib/noco/meta/api/pluginApis.ts
  20. 16
      packages/nocodb/src/lib/noco/meta/api/projectApis.ts
  21. 11
      packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts
  22. 11
      packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts
  23. 16
      packages/nocodb/src/lib/noco/meta/api/sortApis.ts
  24. 21
      packages/nocodb/src/lib/noco/meta/api/tableApis.ts
  25. 6
      packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts
  26. 2
      packages/nocodb/src/lib/noco/meta/api/utilApis.ts
  27. 35
      packages/nocodb/src/lib/noco/meta/api/viewApis.ts
  28. 4
      packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts
  29. 2
      packages/nocodb/src/lib/noco/meta/helpers/ncMetaAclMw.ts

12
packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts

@ -17,11 +17,17 @@ export async function apiTokenDelete(req: Request, res: Response) {
const router = Router({ mergeParams: true });
router.get('/projects/:projectId/apiTokens', ncMetaAclMw(apiTokenList));
router.post('/projects/:projectId/apiTokens', ncMetaAclMw(apiTokenCreate));
router.get(
'/projects/:projectId/apiTokens',
ncMetaAclMw(apiTokenList, 'apiTokenList')
);
router.post(
'/projects/:projectId/apiTokens',
ncMetaAclMw(apiTokenCreate, 'apiTokenCreate')
);
router.delete(
'/projects/:projectId/apiTokens/:token',
ncMetaAclMw(apiTokenDelete)
ncMetaAclMw(apiTokenDelete, 'apiTokenDelete')
);
export default router;

2
packages/nocodb/src/lib/noco/meta/api/attachmentApis.ts

@ -87,7 +87,7 @@ router.post(
multer({
storage: multer.diskStorage({})
}).any(),
ncMetaAclMw(upload)
ncMetaAclMw(upload, 'upload')
);
router.get('/download/:projectId/:viewId/:fileName', catchError(fileRead));

11
packages/nocodb/src/lib/noco/meta/api/auditApis.ts

@ -58,9 +58,12 @@ export async function commentsCount(req: Request<any, any, any>, res) {
}
const router = Router({ mergeParams: true });
router.get('/audits/comments', ncMetaAclMw(commentList));
router.get('/audits/comments', ncMetaAclMw(commentList, 'commentList'));
router.post('/audits/rowUpdate', ncMetaAclMw(auditRowUpdate, 'auditRowUpdate'));
router.post('/audits/comments', ncMetaAclMw(commentRow));
router.get('/audits/comments/count', ncMetaAclMw(commentsCount));
router.get('/project/:projectId/audits', ncMetaAclMw(auditList));
router.post('/audits/comments', ncMetaAclMw(commentRow, 'commentRow'));
router.get(
'/audits/comments/count',
ncMetaAclMw(commentsCount, 'commentsCount')
);
router.get('/project/:projectId/audits', ncMetaAclMw(auditList, 'auditList'));
export default router;

14
packages/nocodb/src/lib/noco/meta/api/columnApis.ts

@ -900,11 +900,17 @@ const deleteHmOrBtRelation = async (
};
const router = Router({ mergeParams: true });
router.post('/tables/:tableId/columns/', ncMetaAclMw(columnAdd));
router.put('/tables/:tableId/columns/:columnId', ncMetaAclMw(columnUpdate));
router.delete('/tables/:tableId/columns/:columnId', ncMetaAclMw(columnDelete));
router.post('/tables/:tableId/columns/', ncMetaAclMw(columnAdd, 'columnAdd'));
router.put(
'/tables/:tableId/columns/:columnId',
ncMetaAclMw(columnUpdate, 'columnUpdate')
);
router.delete(
'/tables/:tableId/columns/:columnId',
ncMetaAclMw(columnDelete, 'columnDelete')
);
router.post(
'/tables/:tableId/columns/:columnId/primary',
ncMetaAclMw(columnSetAsPrimary)
ncMetaAclMw(columnSetAsPrimary, 'columnSetAsPrimary')
);
export default router;

10
packages/nocodb/src/lib/noco/meta/api/dataApis/bulkDataAliasApis.ts

@ -92,23 +92,23 @@ const router = Router({ mergeParams: true });
router.post(
'/bulkData/:orgs/:projectName/:tableAlias',
ncMetaAclMw(bulkDataInsert)
ncMetaAclMw(bulkDataInsert, 'bulkDataInsert')
);
router.patch(
'/bulkData/:orgs/:projectName/:tableAlias',
ncMetaAclMw(bulkDataUpdate)
ncMetaAclMw(bulkDataUpdate, 'bulkDataUpdate')
);
router.patch(
'/bulkData/:orgs/:projectName/:tableAlias/all',
ncMetaAclMw(bulkDataUpdateAll)
ncMetaAclMw(bulkDataUpdateAll, 'bulkDataUpdateAll')
);
router.delete(
'/bulkData/:orgs/:projectName/:tableAlias',
ncMetaAclMw(bulkDataDelete)
ncMetaAclMw(bulkDataDelete, 'bulkDataDelete')
);
router.delete(
'/bulkData/:orgs/:projectName/:tableAlias/all',
ncMetaAclMw(bulkDataDeleteAll)
ncMetaAclMw(bulkDataDeleteAll, 'bulkDataDeleteAll')
);
export default router;

12
packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts

@ -125,27 +125,27 @@ async function dataRead(req: Request, res: Response) {
const router = Router({ mergeParams: true });
router.get('/data/:orgs/:projectName/:tableName', ncMetaAclMw(dataList));
router.get('/data/:orgs/:projectName/:tableName', ncMetaAclMw(dataList, 'dataList'));
router.get(
'/data/:orgs/:projectName/:tableName/views/:viewName',
ncMetaAclMw(dataList)
ncMetaAclMw(dataList, 'dataList')
);
router.post(
'/data/:orgs/:projectName/:tableName/views/:viewName',
ncMetaAclMw(dataInsert)
ncMetaAclMw(dataInsert, 'dataInsert')
);
router.put(
'/data/:orgs/:projectName/:tableName/views/:viewName/:rowId',
ncMetaAclMw(dataUpdate)
ncMetaAclMw(dataUpdate, 'dataUpdate')
);
router.get(
'/data/:orgs/:projectName/:tableName/views/:viewName/:rowId',
ncMetaAclMw(dataRead)
ncMetaAclMw(dataRead, 'dataRead')
);
router.delete(
'/data/:orgs/:projectName/:tableName/views/:viewName/:rowId',
ncMetaAclMw(dataDelete)
ncMetaAclMw(dataDelete, 'dataDelete')
);
export default router;

24
packages/nocodb/src/lib/noco/meta/api/dataApis/dataApis.ts

@ -563,34 +563,34 @@ const router = Router({ mergeParams: true });
// ncMetaAclMw(dataDeleteNew)
// );
router.get('/data/:viewId/', ncMetaAclMw(dataList));
router.post('/data/:viewId/', ncMetaAclMw(dataInsert));
router.get('/data/:viewId/:rowId', ncMetaAclMw(dataRead));
router.put('/data/:viewId/:rowId', ncMetaAclMw(dataUpdate));
router.delete('/data/:viewId/:rowId', ncMetaAclMw(dataDelete));
router.get('/data/:viewId/', ncMetaAclMw(dataList, 'dataList'));
router.post('/data/:viewId/', ncMetaAclMw(dataInsert, 'dataInsert'));
router.get('/data/:viewId/:rowId', ncMetaAclMw(dataRead, 'dataRead'));
router.put('/data/:viewId/:rowId', ncMetaAclMw(dataUpdate, 'dataUpdate'));
router.delete('/data/:viewId/:rowId', ncMetaAclMw(dataDelete, 'dataDelete'));
router.get('/data/:viewId/:rowId/mm/:colId', ncMetaAclMw(mmList));
router.get('/data/:viewId/:rowId/hm/:colId', ncMetaAclMw(hmList));
router.get('/data/:viewId/:rowId/mm/:colId', ncMetaAclMw(mmList, 'mmList'));
router.get('/data/:viewId/:rowId/hm/:colId', ncMetaAclMw(hmList, 'hmList'));
router.get(
'/data/:viewId/:rowId/mm/:colId/exclude',
ncMetaAclMw(mmExcludedList)
ncMetaAclMw(mmExcludedList, 'mmExcludedList')
);
router.get(
'/data/:viewId/:rowId/hm/:colId/exclude',
ncMetaAclMw(hmExcludedList)
ncMetaAclMw(hmExcludedList, 'hmExcludedList')
);
router.get(
'/data/:viewId/:rowId/bt/:colId/exclude',
ncMetaAclMw(btExcludedList)
ncMetaAclMw(btExcludedList, 'btExcludedList')
);
router.post(
'/data/:viewId/:rowId/:relationType/:colId/:childId',
ncMetaAclMw(relationDataAdd)
ncMetaAclMw(relationDataAdd, 'relationDataAdd')
);
router.delete(
'/data/:viewId/:rowId/:relationType/:colId/:childId',
ncMetaAclMw(relationDataDelete)
ncMetaAclMw(relationDataDelete, 'relationDataDelete')
);
export default router;

22
packages/nocodb/src/lib/noco/meta/api/dataApis/oldDataApis.ts

@ -125,14 +125,26 @@ async function dataRead(req: Request, res: Response) {
const router = Router({ mergeParams: true });
router.get('/nc/:projectId/api/v2/:tableName', ncMetaAclMw(dataList));
router.get(
'/nc/:projectId/api/v2/:tableName',
ncMetaAclMw(dataList, 'dataList')
);
router.post('/nc/:projectId/api/v2/:tableName', ncMetaAclMw(dataInsert));
router.get('/nc/:projectId/api/v2/:tableName/:rowId', ncMetaAclMw(dataRead));
router.put('/nc/:projectId/api/v2/:tableName/:rowId', ncMetaAclMw(dataUpdate));
router.post(
'/nc/:projectId/api/v2/:tableName',
ncMetaAclMw(dataInsert, 'dataInsert')
);
router.get(
'/nc/:projectId/api/v2/:tableName/:rowId',
ncMetaAclMw(dataRead, 'dataRead')
);
router.put(
'/nc/:projectId/api/v2/:tableName/:rowId',
ncMetaAclMw(dataUpdate, 'dataUpdate')
);
router.delete(
'/nc/:projectId/api/v2/:tableName/:rowId',
ncMetaAclMw(dataDelete)
ncMetaAclMw(dataDelete, 'dataDelete')
);
export default router;

2
packages/nocodb/src/lib/noco/meta/api/exportApis.ts

@ -173,5 +173,5 @@ async function serializeCellValue({
}
const router = Router({ mergeParams: true });
router.get('/data/:viewId/export/csv', ncMetaAclMw(exportCsv));
router.get('/data/:viewId/export/csv', ncMetaAclMw(exportCsv, 'exportCsv'));
export default router;

24
packages/nocodb/src/lib/noco/meta/api/filterApis.ts

@ -106,13 +106,25 @@ export async function filterDelete(req: Request, res: Response, next) {
}
const router = Router({ mergeParams: true });
router.get('/views/:viewId/filters/', ncMetaAclMw(filterList));
router.post('/views/:viewId/filters/', ncMetaAclMw(filterCreate));
router.get('/views/:viewId/filters/:filterId', ncMetaAclMw(filterGet));
router.put('/views/:viewId/filters/:filterId', ncMetaAclMw(filterUpdate));
router.delete('/views/:viewId/filters/:filterId', ncMetaAclMw(filterDelete));
router.get('/views/:viewId/filters/', ncMetaAclMw(filterList, 'filterList'));
router.post(
'/views/:viewId/filters/',
ncMetaAclMw(filterCreate, 'filterCreate')
);
router.get(
'/views/:viewId/filters/:filterId',
ncMetaAclMw(filterGet, 'filterGet')
);
router.put(
'/views/:viewId/filters/:filterId',
ncMetaAclMw(filterUpdate, 'filterUpdate')
);
router.delete(
'/views/:viewId/filters/:filterId',
ncMetaAclMw(filterDelete, 'filterDelete')
);
router.get(
'/views/:viewId/filters/:filterParentId/children',
ncMetaAclMw(filterChildrenRead)
ncMetaAclMw(filterChildrenRead, 'filterChildrenRead')
);
export default router;

14
packages/nocodb/src/lib/noco/meta/api/formViewApis.ts

@ -39,8 +39,14 @@ export async function formViewUpdate(req, res) {
export async function formViewDelete(req: Request, res: Response, next) {}
const router = Router({ mergeParams: true });
router.post('/tables/:tableId/forms', ncMetaAclMw(formViewCreate));
router.get('/forms/:formViewId', ncMetaAclMw(formViewGet));
router.put('/forms/:formViewId', ncMetaAclMw(formViewUpdate));
router.delete('/forms/:formViewId', ncMetaAclMw(formViewDelete));
router.post(
'/tables/:tableId/forms',
ncMetaAclMw(formViewCreate, 'formViewCreate')
);
router.get('/forms/:formViewId', ncMetaAclMw(formViewGet, 'formViewGet'));
router.put('/forms/:formViewId', ncMetaAclMw(formViewUpdate, 'formViewUpdate'));
router.delete(
'/forms/:formViewId',
ncMetaAclMw(formViewDelete, 'formViewDelete')
);
export default router;

5
packages/nocodb/src/lib/noco/meta/api/formViewColumnApis.ts

@ -9,5 +9,8 @@ export async function columnUpdate(req: Request, res: Response) {
}
const router = Router({ mergeParams: true });
router.put('/formColumns/:formViewColumnId', ncMetaAclMw(columnUpdate));
router.put(
'/formColumns/:formViewColumnId',
ncMetaAclMw(columnUpdate, 'columnUpdate')
);
export default router;

15
packages/nocodb/src/lib/noco/meta/api/galleryViewApis.ts

@ -46,9 +46,18 @@ export async function galleyViewDelete(req: Request, res: Response, next) {}
const router = Router({ mergeParams: true });
// router.get('/', galleyViewList);
router.post('/tables/:tableId/galleries', ncMetaAclMw(galleryViewCreate));
router.post(
'/tables/:tableId/galleries',
ncMetaAclMw(galleryViewCreate, 'galleryViewCreate')
);
// router.get('/:galleryViewId', galleyViewGet);
router.put('/galleries/:galleryViewId', ncMetaAclMw(galleryViewUpdate));
router.get('/galleries/:galleryViewId', ncMetaAclMw(galleryViewGet));
router.put(
'/galleries/:galleryViewId',
ncMetaAclMw(galleryViewUpdate, 'galleryViewUpdate')
);
router.get(
'/galleries/:galleryViewId',
ncMetaAclMw(galleryViewGet, 'galleryViewGet')
);
// router.delete('/:galleryViewId', galleyViewDelete);
export default router;

5
packages/nocodb/src/lib/noco/meta/api/gridViewApis.ts

@ -25,5 +25,8 @@ export async function gridViewCreate(req: Request<any, any>, res) {
}
const router = Router({ mergeParams: true });
router.post('/tables/:tableId/grids/', ncMetaAclMw(gridViewCreate));
router.post(
'/tables/:tableId/grids/',
ncMetaAclMw(gridViewCreate, 'gridViewCreate')
);
export default router;

10
packages/nocodb/src/lib/noco/meta/api/gridViewColumnApis.ts

@ -13,6 +13,12 @@ export async function gridColumnUpdate(req: Request, res: Response) {
}
const router = Router({ mergeParams: true });
router.get('/grid/:gridViewId/gridColumns', ncMetaAclMw(columnList));
router.put('/gridColumns/:gridViewColumnId', ncMetaAclMw(gridColumnUpdate));
router.get(
'/grid/:gridViewId/gridColumns',
ncMetaAclMw(columnList, 'columnList')
);
router.put(
'/gridColumns/:gridViewColumnId',
ncMetaAclMw(gridColumnUpdate, 'gridColumnUpdate')
);
export default router;

10
packages/nocodb/src/lib/noco/meta/api/hookApis.ts

@ -75,11 +75,11 @@ export async function tableSampleData(req: Request, res: Response) {
}
const router = Router({ mergeParams: true });
router.get('/tables/:tableId/hooks', ncMetaAclMw(hookList));
router.post('/tables/:tableId/hooks/test', ncMetaAclMw(hookTest));
router.post('/tables/:tableId/hooks', ncMetaAclMw(hookCreate));
router.delete('/hooks/:hookId', ncMetaAclMw(hookDelete));
router.put('/hooks/:hookId', ncMetaAclMw(hookUpdate));
router.get('/tables/:tableId/hooks', ncMetaAclMw(hookList, 'hookList'));
router.post('/tables/:tableId/hooks/test', ncMetaAclMw(hookTest, 'hookTest'));
router.post('/tables/:tableId/hooks', ncMetaAclMw(hookCreate, 'hookCreate'));
router.delete('/hooks/:hookId', ncMetaAclMw(hookDelete, 'hookDelete'));
router.put('/hooks/:hookId', ncMetaAclMw(hookUpdate, 'hookUpdate'));
router.get(
'/tables/:tableId/hooks/samplePayload/:operation',
catchError(tableSampleData)

24
packages/nocodb/src/lib/noco/meta/api/hookFilterApis.ts

@ -108,13 +108,25 @@ export async function filterDelete(req: Request, res: Response, next) {
}
const router = Router({ mergeParams: true });
router.get('/hooks/:hookId/filters/', ncMetaAclMw(filterList));
router.post('/hooks/:hookId/filters/', ncMetaAclMw(filterCreate));
router.get('/hooks/:hookId/filters/:filterId', ncMetaAclMw(filterGet));
router.put('/hooks/:hookId/filters/:filterId', ncMetaAclMw(filterUpdate));
router.delete('/hooks/:hookId/filters/:filterId', ncMetaAclMw(filterDelete));
router.get('/hooks/:hookId/filters/', ncMetaAclMw(filterList, 'filterList'));
router.post(
'/hooks/:hookId/filters/',
ncMetaAclMw(filterCreate, 'filterCreate')
);
router.get(
'/hooks/:hookId/filters/:filterId',
ncMetaAclMw(filterGet, 'filterGet')
);
router.put(
'/hooks/:hookId/filters/:filterId',
ncMetaAclMw(filterUpdate, 'filterUpdate')
);
router.delete(
'/hooks/:hookId/filters/:filterId',
ncMetaAclMw(filterDelete, 'filterDelete')
);
router.get(
'/hooks/:hookId/filters/:filterParentId/children',
ncMetaAclMw(filterChildrenRead)
ncMetaAclMw(filterChildrenRead, 'filterChildrenRead')
);
export default router;

7
packages/nocodb/src/lib/noco/meta/api/metaDiffApis.ts

@ -826,6 +826,9 @@ export async function extractAndGenerateManyToManyRelations(
}
const router = Router();
router.get('/projects/:projectId/metaDiff', ncMetaAclMw(metaDiff));
router.post('/projects/:projectId/metaDiff', ncMetaAclMw(metaDiffSync));
router.get('/projects/:projectId/metaDiff', ncMetaAclMw(metaDiff, 'metaDiff'));
router.post(
'/projects/:projectId/metaDiff',
ncMetaAclMw(metaDiffSync, 'metaDiffSync')
);
export default router;

10
packages/nocodb/src/lib/noco/meta/api/pluginApis.ts

@ -34,9 +34,9 @@ export async function isPluginActive(req: Request, res: Response) {
}
const router = Router({ mergeParams: true });
router.get('/plugins', ncMetaAclMw(pluginList));
router.post('/plugins/test', ncMetaAclMw(pluginTest));
router.get('/plugins/:pluginId', ncMetaAclMw(pluginRead));
router.put('/plugins/:pluginId', ncMetaAclMw(pluginUpdate));
router.get('/plugins/:pluginTitle/status', ncMetaAclMw(isPluginActive));
router.get('/plugins', ncMetaAclMw(pluginList, 'pluginList'));
router.post('/plugins/test', ncMetaAclMw(pluginTest, 'pluginTest'));
router.get('/plugins/:pluginId', ncMetaAclMw(pluginRead, 'pluginRead'));
router.put('/plugins/:pluginId', ncMetaAclMw(pluginUpdate, 'pluginUpdate'));
router.get('/plugins/:pluginTitle/status', ncMetaAclMw(isPluginActive, 'isPluginActive'));
export default router;

16
packages/nocodb/src/lib/noco/meta/api/projectApis.ts

@ -391,9 +391,15 @@ export async function projectInfoGet(req, res) {
}
export default router => {
router.get('/projects/:projectId/info', ncMetaAclMw(projectInfoGet));
router.get('/projects/:projectId', ncMetaAclMw(projectGet));
router.delete('/projects/:projectId', ncMetaAclMw(projectDelete));
router.post('/projects', ncMetaAclMw(projectCreate));
router.get('/projects', ncMetaAclMw(projectList));
router.get(
'/projects/:projectId/info',
ncMetaAclMw(projectInfoGet, 'projectInfoGet')
);
router.get('/projects/:projectId', ncMetaAclMw(projectGet, 'projectGet'));
router.delete(
'/projects/:projectId',
ncMetaAclMw(projectDelete, 'projectDelete')
);
router.post('/projects', ncMetaAclMw(projectCreate, 'projectCreate'));
router.get('/projects', ncMetaAclMw(projectList, 'projectList'));
};

11
packages/nocodb/src/lib/noco/meta/api/projectUserApis.ts

@ -249,14 +249,17 @@ async function resendInvite(req, res, next): Promise<any> {
}
const router = Router({ mergeParams: true });
router.get('/projects/:projectId/users', ncMetaAclMw(userList));
router.post('/projects/:projectId/users', ncMetaAclMw(userInvite));
router.get('/projects/:projectId/users', ncMetaAclMw(userList, 'userList'));
router.post(
'/projects/:projectId/users',
ncMetaAclMw(userInvite, 'userInvite')
);
router.put(
'/projects/:projectId/users/:userId',
ncMetaAclMw(projectUserUpdate)
ncMetaAclMw(projectUserUpdate, 'projectUserUpdate')
);
router.delete(
'/projects/:projectId/users/:userId',
ncMetaAclMw(projectUserDelete)
ncMetaAclMw(projectUserDelete, 'projectUserDelete')
);
export default router;

11
packages/nocodb/src/lib/noco/meta/api/sharedBaseApis.ts

@ -99,18 +99,21 @@ async function publicSharedBaseGet(req, res): Promise<any> {
}
const router = Router({ mergeParams: true });
router.get('/projects/:projectId/sharedBase', ncMetaAclMw(getSharedBaseLink));
router.get(
'/projects/:projectId/sharedBase',
ncMetaAclMw(getSharedBaseLink, 'getSharedBaseLink')
);
router.post(
'/projects/:projectId/sharedBase',
ncMetaAclMw(createSharedBaseLink)
ncMetaAclMw(createSharedBaseLink, 'createSharedBaseLink')
);
router.put(
'/projects/:projectId/sharedBase',
ncMetaAclMw(updateSharedBaseLink)
ncMetaAclMw(updateSharedBaseLink, 'updateSharedBaseLink')
);
router.delete(
'/projects/:projectId/sharedBase',
ncMetaAclMw(disableSharedBaseLink)
ncMetaAclMw(disableSharedBaseLink, 'disableSharedBaseLink')
);
router.get('/public/sharedBase/:uuid', catchError(publicSharedBaseGet));
export default router;

16
packages/nocodb/src/lib/noco/meta/api/sortApis.ts

@ -51,9 +51,15 @@ export async function sortDelete(req: Request, res: Response, next) {
}
const router = Router({ mergeParams: true });
router.get('/views/:viewId/sorts/', ncMetaAclMw(sortList));
router.post('/views/:viewId/sorts/', ncMetaAclMw(sortCreate));
router.get('/views/:viewId/sorts/:sortId', ncMetaAclMw(sortGet));
router.put('/views/:viewId/sorts/:sortId', ncMetaAclMw(sortUpdate));
router.delete('/views/:viewId/sorts/:sortId', ncMetaAclMw(sortDelete));
router.get('/views/:viewId/sorts/', ncMetaAclMw(sortList, 'sortList'));
router.post('/views/:viewId/sorts/', ncMetaAclMw(sortCreate, 'sortCreate'));
router.get('/views/:viewId/sorts/:sortId', ncMetaAclMw(sortGet, 'sortGet'));
router.put(
'/views/:viewId/sorts/:sortId',
ncMetaAclMw(sortUpdate, 'sortUpdate')
);
router.delete(
'/views/:viewId/sorts/:sortId',
ncMetaAclMw(sortDelete, 'sortDelete')
);
export default router;

21
packages/nocodb/src/lib/noco/meta/api/tableApis.ts

@ -222,10 +222,19 @@ export async function tableDelete(req: Request, res: Response, next) {
}
const router = Router({ mergeParams: true });
router.get('/projects/:projectId/:baseId/tables', ncMetaAclMw(tableList));
router.post('/projects/:projectId/:baseId/tables', ncMetaAclMw(tableCreate));
router.get('/tables/:tableId', ncMetaAclMw(tableGet));
router.put('/tables/:tableId', ncMetaAclMw(tableUpdate));
router.delete('/tables/:tableId', ncMetaAclMw(tableDelete));
router.post('/tables/:tableId/reorder', ncMetaAclMw(tableReorder));
router.get(
'/projects/:projectId/:baseId/tables',
ncMetaAclMw(tableList, 'tableList')
);
router.post(
'/projects/:projectId/:baseId/tables',
ncMetaAclMw(tableCreate, 'tableCreate')
);
router.get('/tables/:tableId', ncMetaAclMw(tableGet, 'tableGet'));
router.put('/tables/:tableId', ncMetaAclMw(tableUpdate, 'tableUpdate'));
router.delete('/tables/:tableId', ncMetaAclMw(tableDelete, 'tableDelete'));
router.post(
'/tables/:tableId/reorder',
ncMetaAclMw(tableReorder, 'tableReorder')
);
export default router;

6
packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts

@ -401,7 +401,9 @@ const mapRoutes = router => {
router.post('/auth/token/validate/:tokenId', catchError(tokenValidate));
router.post('/auth/password/reset/:tokenId', catchError(passwordReset));
router.post('/auth/email/validate/:tokenId', catchError(emailVerification));
router.post('/user/password/change', ncMetaAclMw(passwordChange));
router.post(
'/user/password/change',
ncMetaAclMw(passwordChange, 'passwordChange')
);
};
export { mapRoutes as userApis };

2
packages/nocodb/src/lib/noco/meta/api/utilApis.ts

@ -44,6 +44,6 @@ export async function appInfo(_req: Request, res: Response) {
}
export default router => {
router.post('/testConnection', ncMetaAclMw(testConnection));
router.post('/testConnection', ncMetaAclMw(testConnection, 'testConnection'));
router.get('/appInfo', catchError(appInfo));
};

35
packages/nocodb/src/lib/noco/meta/api/viewApis.ts

@ -101,15 +101,30 @@ async function shareViewList(req: Request<any, any>, res) {
}
const router = Router({ mergeParams: true });
router.get('/tables/:tableId/views', ncMetaAclMw(viewList));
router.put('/views/:viewId', ncMetaAclMw(viewUpdate));
router.delete('/views/:viewId', ncMetaAclMw(viewDelete));
router.post('/views/:viewId/showAll', ncMetaAclMw(showAllColumns));
router.post('/views/:viewId/hideAll', ncMetaAclMw(hideAllColumns));
router.get('/tables/:tableId/share', ncMetaAclMw(shareViewList));
router.post('/views/:viewId/share', ncMetaAclMw(shareView));
router.put('/views/:viewId/share', ncMetaAclMw(shareViewPasswordUpdate));
router.delete('/views/:viewId/share', ncMetaAclMw(shareViewDelete));
router.get('/tables/:tableId/views', ncMetaAclMw(viewList, 'viewList'));
router.put('/views/:viewId', ncMetaAclMw(viewUpdate, 'viewUpdate'));
router.delete('/views/:viewId', ncMetaAclMw(viewDelete, 'viewDelete'));
router.post(
'/views/:viewId/showAll',
ncMetaAclMw(showAllColumns, 'showAllColumns')
);
router.post(
'/views/:viewId/hideAll',
ncMetaAclMw(hideAllColumns, 'hideAllColumns')
);
router.get(
'/tables/:tableId/share',
ncMetaAclMw(shareViewList, 'shareViewList')
);
router.post('/views/:viewId/share', ncMetaAclMw(shareView, 'shareView'));
router.put(
'/views/:viewId/share',
ncMetaAclMw(shareViewPasswordUpdate, 'shareViewPasswordUpdate')
);
router.delete(
'/views/:viewId/share',
ncMetaAclMw(shareViewDelete, 'shareViewDelete')
);
export default router;

4
packages/nocodb/src/lib/noco/meta/api/viewColumnApis.ts

@ -31,8 +31,8 @@ export async function columnUpdate(req: Request, res: Response) {
}
const router = Router({ mergeParams: true });
router.get('/views/:viewId/columns/', ncMetaAclMw(columnList));
router.post('/views/:viewId/columns/', ncMetaAclMw(columnAdd));
router.get('/views/:viewId/columns/', ncMetaAclMw(columnList, 'columnList'));
router.post('/views/:viewId/columns/', ncMetaAclMw(columnAdd, 'columnAdd'));
router.put(
'/views/:viewId/columns/:columnId',
ncMetaAclMw(columnUpdate, 'viewColumnUpdate')

2
packages/nocodb/src/lib/noco/meta/helpers/ncMetaAclMw.ts

@ -2,7 +2,7 @@ import projectAcl from '../../../utils/projectAcl';
import { NextFunction, Request, Response } from 'express';
import catchError, { NcError } from './catchError';
import extractProjectIdAndAuthenticate from './extractProjectIdAndAuthenticate';
export default function(handlerFn, permissionName = handlerFn.name) {
export default function(handlerFn, permissionName) {
return [
extractProjectIdAndAuthenticate,
catchError(function authMiddleware(req, _res, next) {

Loading…
Cancel
Save