Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Allow unauthorised users to access public GET View endpoints

Blue Mousec61b29ffe513
diff --git a/apps/production/src/project/project.controller.ts b/apps/production/src/project/project.controller.ts
index 4b4a41380..dfe1c817e 100644
--- a/apps/production/src/project/project.controller.ts
+++ b/apps/production/src/project/project.controller.ts
@@ -1944,8 +1944,7 @@ export class ProjectController {
@ApiOkResponse({ type: ProjectViewEntity })
@ApiBearerAuth()
@Get(':projectId/views/:viewId')
- @UseGuards(JwtAccessTokenGuard, RolesGuard)
- @Roles(UserType.CUSTOMER, UserType.ADMIN)
+ @Auth([], true, true)
async getProjectView(
@Param() params: ProjectViewIdsDto,
@CurrentUserId() userId: string,
@@ -1960,12 +1959,6 @@ export class ProjectController {
throw new NotFoundException('Project not found.')
}
- const user = await this.userService.findUserV2(userId, ['roles'])
-
- if (!user) {
- throw new NotFoundException('User not found.')
- }
-
this.projectService.allowedToView(project, userId, headers['x-password'])
return this.projectsViewsRepository.findProjectView(
@@ -2019,8 +2012,7 @@ export class ProjectController {
@ApiOkResponse({ type: ProjectViewEntity })
@ApiBearerAuth()
@Get(':projectId/views')
- @UseGuards(JwtAccessTokenGuard, RolesGuard)
- @Roles(UserType.CUSTOMER, UserType.ADMIN)
+ @Auth([], true, true)
async getProjectViews(
@Param() params: ProjectIdDto,
@CurrentUserId() userId: string,
@@ -2035,12 +2027,6 @@ export class ProjectController {
throw new NotFoundException('Project not found.')
}
- const user = await this.userService.findUserV2(userId, ['roles'])
-
- if (!user) {
- throw new NotFoundException('User not found.')
- }
-
this.projectService.allowedToView(project, userId, headers['x-password'])
return this.projectsViewsRepository.findViews(params.projectId)