Fix access control on view searching and handle errors when fetching view definitions

This commit is contained in:
Andrew Kingston 2023-08-16 11:00:14 +01:00
parent c115a87cd6
commit abc072cbbe
2 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,10 @@ export default class ViewV2Fetch extends DataFetch {
const res = await this.API.viewV2.fetchDefinition(datasource.id) const res = await this.API.viewV2.fetchDefinition(datasource.id)
return res?.data return res?.data
} catch (error) { } catch (error) {
this.store.update(state => ({
...state,
error,
}))
return null return null
} }
} }

View File

@ -269,6 +269,7 @@ router
router.post( router.post(
"/api/v2/views/:viewId/search", "/api/v2/views/:viewId/search",
paramResource("viewId"),
authorized(PermissionType.TABLE, PermissionLevel.READ), authorized(PermissionType.TABLE, PermissionLevel.READ),
rowController.views.searchView rowController.views.searchView
) )