Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore: remove dashboard collaborator api (#113924)

Reece Jonesfd033f500cec
diff --git a/ee/api/dashboard_collaborator.py b/ee/api/dashboard_collaborator.py
deleted file mode 100644
index b2f62f7189ec..000000000000
--- a/ee/api/dashboard_collaborator.py
+++ /dev/null
@@ -1,126 +0,0 @@
-from typing import Any, cast
-
-from django.db import IntegrityError
-
-from drf_spectacular.utils import extend_schema
-from rest_framework import exceptions, mixins, serializers, viewsets
-from rest_framework.permissions import SAFE_METHODS, BasePermission
-from rest_framework.request import Request
-
-from posthog.api.routing import TeamAndOrgViewSetMixin
-from posthog.api.shared import UserBasicSerializer
-from posthog.models import User
-from posthog.user_permissions import UserPermissions, UserPermissionsSerializerMixin
-
-from products.dashboards.backend.models.dashboard import Dashboard
-
-from ee.models.dashboard_privilege import DashboardPrivilege
-
-
-class CanEditDashboardCollaborator(BasePermission):
- message = "You don't have edit permissions for this dashboard."
-
- def has_permission(self, request: Request, view) -> bool:
- if request.method in SAFE_METHODS:
- return True
- try:
- dashboard: Dashboard = Dashboard.objects.get(
- id=view.parents_query_dict["dashboard_id"], team__project_id=view.team.project_id
- )
- except Dashboard.DoesNotExist:
- raise exceptions.NotFound("Dashboard not found.")
-
- return view.user_permissions.dashboard(dashboard).can_edit
-
-
-class DashboardCollaboratorSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixin):
- user = UserBasicSerializer(read_only=True)
- dashboard_id = serializers.IntegerField(read_only=True)
-
- user_uuid = serializers.UUIDField(required=True, write_only=True)
-
- class Meta:
- model = DashboardPrivilege
- fields = [
- "id",
- "dashboard_id",
- "user",
- "level",
- "added_at",
- "updated_at",
- "user_uuid", # write_only (see above)
- ]
- read_only_fields = ["id", "dashboard_id", "user"]
-
- def validate(self, attrs: dict[str, Any]) -> dict[str, Any]:
- dashboard: Dashboard = self.context["dashboard"]
- dashboard_permissions = self.user_permissions.dashboard(dashboard)
- if dashboard_permissions.effective_restriction_level <= Dashboard.RestrictionLevel.EVERYONE_IN_PROJECT_CAN_EDIT:
- raise exceptions.ValidationError("Cannot add collaborators to a dashboard on the lowest restriction level.")
- attrs = super().validate(attrs)
- level = attrs.get("level")
- if level is not None and level != Dashboard.PrivilegeLevel.CAN_EDIT:
- raise serializers.ValidationError("Only edit access can be explicitly specified currently.")
- return attrs
-
- def create(self, validated_data):
- dashboard: Dashboard = self.context["dashboard"]
- user_uuid = validated_data.pop("user_uuid")
- try:
- validated_data["user"] = User.objects.filter(is_active=True).get(uuid=user_uuid)
- except User.DoesNotExist:
- raise serializers.ValidationError("User does not exist.")
-
- modified_user_permissions = UserPermissions(
- user=validated_data["user"],
- team=self.context["view"].team,
- )
- if modified_user_permissions.current_team.effective_membership_level is None:
- raise exceptions.ValidationError("Cannot add collaborators that have no access to the project.")
- if modified_user_permissions.dashboard(dashboard).can_restrict:
- raise exceptions.ValidationError(
- "Cannot add collaborators that already have inherent access (the dashboard owner or a project admins)."
- )
- validated_data["dashboard_id"] = self.context["dashboard_id"]
- try:
- return super().create(validated_data)
- except IntegrityError:
- raise serializers.ValidationError("User already is a collaborator.")
-
-
-@extend_schema(extensions={"x-product": "dashboards"})
-class DashboardCollaboratorViewSet(
- TeamAndOrgViewSetMixin,
- mixins.ListModelMixin,
- mixins.CreateModelMixin,
- mixins.DestroyModelMixin,
- viewsets.GenericViewSet,
-):
- scope_object = "dashboard"
- permission_classes = [CanEditDashboardCollaborator]
- pagination_class = None
- queryset = DashboardPrivilege.objects.select_related("dashboard", "dashboard__team").filter(user__is_active=True)
- lookup_field = "user__uuid"
- serializer_class = DashboardCollaboratorSerializer
- filter_rewrite_rules = {"project_id": "dashboard__team__project_id"}
-
- def get_serializer_context(self) -> dict[str, Any]:
- context = super().get_serializer_context()
- try:
- context["dashboard"] = Dashboard.objects.get(
- id=context["dashboard_id"], team__project_id=self.team.project_id
- )
- except Dashboard.DoesNotExist:
- raise exceptions.NotFound("Dashboard not found.")
- return context
-
- def perform_destroy(self, instance) -> None:
- dashboard = cast(Dashboard, instance.dashboard)
- if (
- self.user_permissions.dashboard(dashboard).effective_restriction_level
- <= Dashboard.RestrictionLevel.EVERYONE_IN_PROJECT_CAN_EDIT
- ):
- raise exceptions.ValidationError(
- "Cannot remove collaborators from a dashboard on the lowest restriction level."
- )
- return super().perform_destroy(instance)
diff --git a/ee/api/test/test_dashboard_collaborators.py b/ee/api/test/test_dashboard_collaborators.py
deleted file mode 100644
index 79a09d848963..000000000000
--- a/ee/api/test/test_dashboard_collaborators.py
+++ /dev/null
@@ -1,337 +0,0 @@
-from rest_framework import status
-
-from posthog.constants import AvailableFeature
-from posthog.models import OrganizationMembership, User
-
-from products.access_control.backend.models.access_control import AccessControl
-from products.dashboards.backend.models.dashboard import Dashboard
-
-from ee.api.test.base import APILicensedTest
-from ee.models.dashboard_privilege import DashboardPrivilege
-
-
-class TestDashboardCollaboratorsAPI(APILicensedTest):
- CONFIG_FORCE_ACCESS_CONTROL_ON_SETUP = True
- test_dashboard: Dashboard
-
- def setUp(self):
- super().setUp()
-
- if not self.organization.is_feature_available(AvailableFeature.ACCESS_CONTROL):
- self.skipTest("Dashboard collaborators tests require access control")
-
- AccessControl.objects.create(
- team=self.team,
- resource="project",
- resource_id=str(self.team.id),
- organization_member=None,
- role=None,
- access_level="member",
- )
-
- self.test_dashboard = Dashboard.objects.create(team=self.team, name="Test Insights 9001", created_by=self.user)
-
- def test_list_collaborators_as_person_without_edit_access(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT
- self.test_dashboard.created_by = None
- self.test_dashboard.save()
- other_user_a = User.objects.create_and_join(self.organization, "[email protected]", None)
- other_user_b = User.objects.create_and_join(self.organization, "[email protected]", None)
- DashboardPrivilege.objects.create(
- user=other_user_a,
- dashboard=self.test_dashboard,
- level=Dashboard.PrivilegeLevel.CAN_VIEW,
- )
- DashboardPrivilege.objects.create(
- user=other_user_b,
- dashboard=self.test_dashboard,
- level=Dashboard.PrivilegeLevel.CAN_EDIT,
- )
-
- response = self.client.get(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/"
- )
- self.assertEqual(response.status_code, status.HTTP_200_OK)
-
- response_data = response.json()
- response_data = sorted(response_data, key=lambda entry: entry["user"]["email"])
-
- self.assertEqual(len(response_data), 2)
- self.assertEqual(response_data[0]["user"]["email"], other_user_a.email)
- self.assertEqual(response_data[0]["level"], Dashboard.PrivilegeLevel.CAN_VIEW)
- self.assertEqual(response_data[1]["user"]["email"], other_user_b.email)
- self.assertEqual(response_data[1]["level"], Dashboard.PrivilegeLevel.CAN_EDIT)
-
- def test_cannot_add_collaborator_to_unrestricted_dashboard_as_creator(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.EVERYONE_IN_PROJECT_CAN_EDIT
- self.test_dashboard.save()
- other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
-
- response = self.client.post(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/",
- {
- "user_uuid": str(other_user.uuid),
- "level": Dashboard.PrivilegeLevel.CAN_EDIT,
- },
- )
- response_data = response.json()
-
- self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
- self.assertEqual(
- response_data,
- self.validation_error_response("Cannot add collaborators to a dashboard on the lowest restriction level."),
- )
-
- def test_can_add_collaborator_to_edit_restricted_dashboard_as_creator(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT
- self.test_dashboard.save()
- other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
-
- response = self.client.post(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/",
- {
- "user_uuid": str(other_user.uuid),
- "level": Dashboard.PrivilegeLevel.CAN_EDIT,
- },
- )
- response_data = response.json()
-
- self.assertEqual(response.status_code, status.HTTP_201_CREATED)
- self.assertEqual(response_data["dashboard_id"], self.test_dashboard.id)
- self.assertEqual(response_data["user"]["email"], other_user.email)
- self.assertEqual(response_data["level"], Dashboard.PrivilegeLevel.CAN_EDIT)
-
- def test_cannot_add_yourself_to_restricted_dashboard_as_creator(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT
- self.test_dashboard.save()
-
- response = self.client.post(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/",
- {
- "user_uuid": str(self.user.uuid),
- "level": Dashboard.PrivilegeLevel.CAN_EDIT,
- },
- )
- response_data = response.json()
-
- self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
-
- self.assertEqual(
- response_data,
- self.validation_error_response(
- "Cannot add collaborators that already have inherent access (the dashboard owner or a project admins)."
- ),
- )
-
- def test_cannot_add_collaborator_to_edit_restricted_dashboard_as_other_user(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT
- self.test_dashboard.created_by = None
- self.test_dashboard.save()
- other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
-
- response = self.client.post(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/",
- {
- "user_uuid": str(other_user.uuid),
- "level": Dashboard.PrivilegeLevel.CAN_EDIT,
- },
- )
- response_data = response.json()
-
- self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
- self.assertEqual(
- response_data,
- self.permission_denied_response("You don't have edit permissions for this dashboard."),
- )
-
- def test_cannot_add_collaborator_from_other_org_to_edit_restricted_dashboard_as_creator(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT
- self.test_dashboard.save()
- _, _, other_user = User.objects.bootstrap("Beta", "[email protected]", None)
-
- response = self.client.post(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/",
- {
- "user_uuid": str(other_user.uuid),
- "level": Dashboard.PrivilegeLevel.CAN_EDIT,
- },
- )
- response_data = response.json()
-
- self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
-
- self.assertEqual(
- response_data,
- self.validation_error_response("Cannot add collaborators that have no access to the project."),
- )
-
- def test_cannot_add_collaborator_to_other_org_to_edit_restricted_dashboard_as_creator(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT
- self.test_dashboard.save()
- self.organization_membership.delete()
- _, _, other_user = User.objects.bootstrap("Beta", "[email protected]", None)
-
- response = self.client.post(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/",
- {
- "user_uuid": str(other_user.uuid),
- "level": Dashboard.PrivilegeLevel.CAN_EDIT,
- },
- )
- response_data = response.json()
-
- self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
- self.assertEqual(
- response_data,
- self.permission_denied_response("You don't have access to the project."),
- )
-
- def test_cannot_update_existing_collaborator(self):
- # This will change once there are more levels, but with just two it doesn't make sense to PATCH privileges
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.EVERYONE_IN_PROJECT_CAN_EDIT
- self.test_dashboard.save()
- other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
- DashboardPrivilege.objects.create(
- user=other_user,
- dashboard=self.test_dashboard,
- level=Dashboard.PrivilegeLevel.CAN_EDIT,
- )
-
- response = self.client.patch(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/{other_user.uuid}",
- {"level": Dashboard.PrivilegeLevel.CAN_VIEW},
- )
-
- self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
-
- def test_cannot_remove_collaborator_from_unrestricted_dashboard_as_creator(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.EVERYONE_IN_PROJECT_CAN_EDIT
- self.test_dashboard.save()
- other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
- DashboardPrivilege.objects.create(
- user=other_user,
- dashboard=self.test_dashboard,
- level=Dashboard.PrivilegeLevel.CAN_EDIT,
- )
-
- response = self.client.delete(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/{other_user.uuid}"
- )
- response_data = response.json()
-
- self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
- self.assertEqual(
- response_data,
- self.validation_error_response(
- "Cannot remove collaborators from a dashboard on the lowest restriction level."
- ),
- )
-
- def test_can_remove_collaborator_from_restricted_dashboard_as_creator(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT
- self.test_dashboard.save()
- other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
- DashboardPrivilege.objects.create(
- user=other_user,
- dashboard=self.test_dashboard,
- level=Dashboard.PrivilegeLevel.CAN_EDIT,
- )
-
- response = self.client.delete(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/{other_user.uuid}"
- )
-
- self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
-
- def test_cannot_remove_collaborator_from_restricted_dashboard_as_other_user(self):
- self.organization_membership.level = OrganizationMembership.Level.MEMBER
- self.organization_membership.save()
- self.test_dashboard.restriction_level = Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT
- self.test_dashboard.created_by = None
- self.test_dashboard.save()
- other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
- DashboardPrivilege.objects.create(
- user=other_user,
- dashboard=self.test_dashboard,
- level=Dashboard.PrivilegeLevel.CAN_EDIT,
- )
-
- response = self.client.delete(
- f"/api/projects/{self.test_dashboard.team_id}/dashboards/{self.test_dashboard.id}/collaborators/{other_user.uuid}"
- )
- response_data = response.json()
-
- self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
- self.assertEqual(
- response_data,
- self.permission_denied_response("You don't have edit permissions for this dashboard."),
- )
-
- def test_cannot_add_collaborator_to_dashboard_in_another_project(self):
- # Admin of their own project must not be able to manage collaborators on a dashboard
- # that belongs to a different organization, by passing their own project_id in the URL.
- self.organization_membership.level = OrganizationMembership.Level.ADMIN
- self.organization_membership.save()
- org_a_collaborator = User.objects.create_and_join(self.organization, "[email protected]", None)
-
- _, victim_team, _ = User.objects.bootstrap("VictimOrg", "[email protected]", None)
- victim_dashboard = Dashboard.objects.create(
- team=victim_team,
- name="Victim Dashboard",
- restriction_level=Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT,
- )
-
- response = self.client.post(
- f"/api/projects/{self.team.id}/dashboards/{victim_dashboard.id}/collaborators/",
- {
- "user_uuid": str(org_a_collaborator.uuid),
- "level": Dashboard.PrivilegeLevel.CAN_EDIT,
- },
- )
-
- self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
- self.assertFalse(DashboardPrivilege.objects.filter(dashboard=victim_dashboard).exists())
-
- def test_cannot_remove_collaborator_from_dashboard_in_another_project(self):
- self.organization_membership.level = OrganizationMembership.Level.ADMIN
- self.organization_membership.save()
-
- _, victim_team, _ = User.objects.bootstrap("VictimOrg", "[email protected]", None)
- victim_dashboard = Dashboard.objects.create(
- team=victim_team,
- name="Victim Dashboard",
- restriction_level=Dashboard.RestrictionLevel.ONLY_COLLABORATORS_CAN_EDIT,
- )
- collaborator = User.objects.create_and_join(victim_team.organization, "[email protected]", None)
- privilege = DashboardPrivilege.objects.create(
- user=collaborator,
- dashboard=victim_dashboard,
- level=Dashboard.PrivilegeLevel.CAN_EDIT,
- )
-
- response = self.client.delete(
- f"/api/projects/{self.team.id}/dashboards/{victim_dashboard.id}/collaborators/{collaborator.uuid}"
- )
-
- self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
- self.assertTrue(DashboardPrivilege.objects.filter(id=privilege.id).exists())
diff --git a/frontend/src/lib/api-ratchet-baseline.txt b/frontend/src/lib/api-ratchet-baseline.txt
index 225329ecdbf8..077d2ffd9f80 100644
--- a/frontend/src/lib/api-ratchet-baseline.txt
+++ b/frontend/src/lib/api-ratchet-baseline.txt
@@ -46,8 +46,6 @@ customerJourneys projects/{}/customer_journeys
customerJourneysDetail projects/{}/customer_journeys/{}
customerProfileConfigs projects/{}/customer_profile_configs
customerProfileConfigsDetail projects/{}/customer_profile_configs/{}
-dashboardCollaborators projects/{}/dashboards/{}/collaborators
-dashboardCollaboratorsDetail projects/{}/dashboards/{}/collaborators/{}
dashboardSharing projects/{}/dashboards/{}/sharing
dashboardSharingPassword projects/{}/dashboards/{}/sharing/passwords/{}
dashboardSharingPasswords projects/{}/dashboards/{}/sharing/passwords
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index c07739ba404f..cc08cadc0ac7 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -966,13 +966,6 @@ export class ApiRequest {
return this.dashboards(teamId).addPathComponent(dashboardId)
}
- public dashboardCollaborators(
- dashboardId: DashboardType['id'],
- projectId: ProjectType['id'] = ApiConfig.getCurrentProjectId() // Collaborators endpoint is project-level, not team-level
- ): ApiRequest {
- return this.dashboardsDetail(dashboardId, projectId).addPathComponent('collaborators')
- }
-
public dashboardSharing(dashboardId: DashboardType['id'], teamId?: TeamType['id']): ApiRequest {
return this.dashboardsDetail(dashboardId, teamId).addPathComponent('sharing')
}
@@ -1005,14 +998,6 @@ export class ApiRequest {
return this.dashboardSharingPasswords(dashboardId, teamId).addPathComponent(passwordId)
}
- public dashboardCollaboratorsDetail(
- dashboardId: DashboardType['id'],
- userUuid: UserType['uuid'],
- projectId?: ProjectType['id']
- ): ApiRequest {
- return this.dashboardCollaborators(dashboardId, projectId).addPathComponent(userUuid)
- }
-
// # Dashboard templates
public dashboardTemplates(teamId?: TeamType['id']): ApiRequest {
return this.projectsDetail(teamId).addPathComponent('dashboard_templates')
diff --git a/frontend/src/scenes/project-homepage/ProjectHomepage.stories.tsx b/frontend/src/scenes/project-homepage/ProjectHomepage.stories.tsx
index a8573d870cc2..a80007b08b88 100644
--- a/frontend/src/scenes/project-homepage/ProjectHomepage.stories.tsx
+++ b/frontend/src/scenes/project-homepage/ProjectHomepage.stories.tsx
@@ -76,7 +76,6 @@ const meta: Meta = {
'/api/environments/:team_id/dashboards/1/': dashboard,
...insightMocks,
'/api/environments/:team_id/insights/:id/': insightFetchMock,
- '/api/environments/:team_id/dashboards/1/collaborators/': [],
'/api/environments/:team_id/session_recordings/': EMPTY_PAGINATED_RESPONSE,
'/api/environments/:team_id/insights/my_last_viewed/': [],
// Add variable data mock to prevent loading issues
diff --git a/products/dashboards/backend/routes.py b/products/dashboards/backend/routes.py
index 6a95a39e604a..9e54263ee912 100644
--- a/products/dashboards/backend/routes.py
+++ b/products/dashboards/backend/routes.py
@@ -1,6 +1,5 @@
from posthog.api import sharing
from posthog.api.routing import RouterRegistry
-from posthog.settings import EE_AVAILABLE
from products.dashboards.backend.api import dashboard, dashboard_templates
@@ -29,16 +28,3 @@ def register_routes(routers: RouterRegistry) -> None:
"project_dashboard_sharing",
["team_id", "dashboard_id"],
)
-
- # EE-only collaborator sub-route. Previously registered in ee/urls.py against
- # the (now product-local) dashboards routers — co-locating it here removes
- # ee/urls.py's coupling to dashboards' router handles.
- if EE_AVAILABLE:
- from ee.api import dashboard_collaborator
-
- dashboards_router.register(
- r"collaborators",
- dashboard_collaborator.DashboardCollaboratorViewSet,
- "project_dashboard_collaborators",
- ["project_id", "dashboard_id"],
- )
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 14a5ba23620b..04f963f9d642 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -638,16 +638,6 @@ export interface DashboardApi {
_create_in_folder?: string
}
-export interface DashboardCollaboratorApi {
- readonly id: string
- readonly dashboard_id: number
- readonly user: UserBasicApi
- level: RestrictionLevelEnumApi
- readonly added_at: string
- readonly updated_at: string
- user_uuid: string
-}
-
/**
* OpenAPI-only shape for a dashboard's filters object (agents/MCP).
*
diff --git a/products/dashboards/frontend/generated/api.ts b/products/dashboards/frontend/generated/api.ts
index 2648f8db6e7b..4f08e7c1327f 100644
--- a/products/dashboards/frontend/generated/api.ts
+++ b/products/dashboards/frontend/generated/api.ts
@@ -17,7 +17,6 @@ import type {
CopyDashboardTileRequestApi,
CreateTextTileRequestApi,
DashboardApi,
- DashboardCollaboratorApi,
DashboardSubscribeNudgeResponseApi,
DashboardTemplateApi,
DashboardTemplatesListParams,
@@ -285,55 +284,6 @@ export const dashboardsCreate = async (
})
}
-export const getDashboardsCollaboratorsListUrl = (projectId: string, dashboardId: number) => {
- return `/api/projects/${projectId}/dashboards/${dashboardId}/collaborators/`
-}
-
-export const dashboardsCollaboratorsList = async (
- projectId: string,
- dashboardId: number,
- options?: RequestInit
-): Promise<DashboardCollaboratorApi[]> => {
- return apiMutator<DashboardCollaboratorApi[]>(getDashboardsCollaboratorsListUrl(projectId, dashboardId), {
- ...options,
- method: 'GET',
- })
-}
-
-export const getDashboardsCollaboratorsCreateUrl = (projectId: string, dashboardId: number) => {
- return `/api/projects/${projectId}/dashboards/${dashboardId}/collaborators/`
-}
-
-export const dashboardsCollaboratorsCreate = async (
- projectId: string,
- dashboardId: number,
- dashboardCollaboratorApi: NonReadonly<DashboardCollaboratorApi>,
- options?: RequestInit
-): Promise<DashboardCollaboratorApi> => {
- return apiMutator<DashboardCollaboratorApi>(getDashboardsCollaboratorsCreateUrl(projectId, dashboardId), {
- ...options,
- method: 'POST',
- headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(dashboardCollaboratorApi),
- })
-}
-
-export const getDashboardsCollaboratorsDestroyUrl = (projectId: string, dashboardId: number, userUuid: string) => {
- return `/api/projects/${projectId}/dashboards/${dashboardId}/collaborators/${userUuid}/`
-}
-
-export const dashboardsCollaboratorsDestroy = async (
- projectId: string,
- dashboardId: number,
- userUuid: string,
- options?: RequestInit
-): Promise<void> => {
- return apiMutator<void>(getDashboardsCollaboratorsDestroyUrl(projectId, dashboardId, userUuid), {
- ...options,
- method: 'DELETE',
- })
-}
-
export const getDashboardsRetrieveUrl = (projectId: string, id: number, params?: DashboardsRetrieveParams) => {
const normalizedParams = new URLSearchParams()
diff --git a/products/dashboards/frontend/generated/api.zod.ts b/products/dashboards/frontend/generated/api.zod.ts
index 67ffd9aae107..f5f8a4f71e39 100644
--- a/products/dashboards/frontend/generated/api.zod.ts
+++ b/products/dashboards/frontend/generated/api.zod.ts
@@ -227,15 +227,6 @@ export const DashboardsCreateBody = /* @__PURE__ */ zod
})
.describe('Serializer mixin that handles tags for objects.')
-export const DashboardsCollaboratorsCreateBody = /* @__PURE__ */ zod.object({
- level: zod
- .union([zod.literal(21), zod.literal(37)])
- .describe(
- '\* `21` - Everyone in the project can edit\n\* `37` - Only those invited to this dashboard can edit'
- ),
- user_uuid: zod.uuid(),
-})
-
export const dashboardsUpdateBodyNameMax = 400
export const dashboardsUpdateBodyBreakdownColorsItemColorTokenRegExp = new RegExp('^preset-[1-9][0-9]\*$')
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 7b646d2abe56..3c70a9519b07 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -27401,16 +27401,6 @@ export namespace Schemas {
readonly search_match_type: SearchMatchTypeEnum | null;
}
- export interface DashboardCollaborator {
- readonly id: string;
- readonly dashboard_id: number;
- readonly user: UserBasic;
- level: RestrictionLevelEnum;
- readonly added_at: string;
- readonly updated_at: string;
- user_uuid: string;
- }
-
/**
* OpenAPI-only shape for a dashboard's filters object (agents/MCP).
*