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!

fix: allow shared admins to manage members

Blue Mouse55fa2c707328
diff --git a/backend/apps/cloud/src/project/project.controller.ts b/backend/apps/cloud/src/project/project.controller.ts
index 13711340a..57616512b 100644
--- a/backend/apps/cloud/src/project/project.controller.ts
+++ b/backend/apps/cloud/src/project/project.controller.ts
@@ -1017,14 +1017,14 @@ export class ProjectController {
throw new NotFoundException(`Project with ID ${pid} does not exist`)
}
- if (!this.userService.isPaidTier(user)) {
+ this.projectService.allowedToManage(project, userId)
+
+ if (!this.userService.isPaidTier(project.admin)) {
throw new BadRequestException(
'You must be a paid tier subscriber to use this feature.',
)
}
- this.projectService.allowedToManage(project, userId)
-
const invitee = await this.userService.findOne({
where: { email: shareDTO.email },
relations: ['sharedProjects'],
diff --git a/backend/apps/cloud/src/project/project.service.ts b/backend/apps/cloud/src/project/project.service.ts
index f974e49c8..4a750f25e 100644
--- a/backend/apps/cloud/src/project/project.service.ts
+++ b/backend/apps/cloud/src/project/project.service.ts
@@ -262,6 +262,7 @@ export class ProjectService {
id: true,
dashboardBlockReason: true,
isAccountBillingSuspended: true,
+ planCode: true,
},
organisation: {
id: true,
@@ -1272,9 +1273,15 @@ export class ProjectService {
}
async getOwnProject(projectId: string, userId: string) {
- return this.projectsRepository.findOne({
- where: { id: projectId, admin: { id: userId } },
- })
+ const project = await this.getFullProject(projectId)
+
+ if (!project) {
+ return project
+ }
+
+ this.allowedToManage(project, userId)
+
+ return project
}
createUnsubscribeKey(subscriberId: string): string {
diff --git a/backend/apps/community/src/project/project.service.ts b/backend/apps/community/src/project/project.service.ts
index 160c46ac3..35994c47d 100644
--- a/backend/apps/community/src/project/project.service.ts
+++ b/backend/apps/community/src/project/project.service.ts
@@ -162,10 +162,12 @@ export class ProjectService {
async getOwnProject(projectId: string, userId: string) {
const project = await this.getFullProject(projectId)
- if (project?.adminId !== userId) {
- throw new ForbiddenException('You are not allowed to manage this project')
+ if (!project) {
+ return project
}
+ this.allowedToManage(project, userId)
+
return project
}