: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(roles): move code out of ee (#108441)
Reece Jones67d8bffc2ef6
diff --git a/ee/urls.py b/ee/urls.pyindex ce79ed1b59eb..49237e48e9df 100644--- a/ee/urls.py+++ b/ee/urls.py@@ -26,7 +26,6 @@ from ee.middleware import admin_oauth2_callbackfrom ee.support_sidebar_max.views import MaxChatViewSetfrom .api import authentication, billing, conversation, core_memory, organization_billing, subscription-from .api.rbac import rolefrom .api.scim import views as scim_views@@ -44,18 +43,6 @@ def extend_api_router() -> None:r"billing", organization_billing.OrganizationBillingViewSet, "organization_billing", ["organization_id"])root_router.register(r"integrations", integration.PublicIntegrationViewSet)- organization_roles_router = organizations_router.register(- r"roles",- role.RoleViewSet,- "organization_roles",- ["organization_id"],- )- organization_roles_router.register(- r"role_memberships",- role.RoleMembershipViewSet,- "organization_role_memberships",- ["organization_id", "role_id"],- )projects_router.register(r"hooks", hooks.HookViewSet, "project_hooks", ["team_id"])project_subscriptions_router = projects_router.register(diff --git a/ee/api/rbac/role.py b/products/access_control/backend/presentation/role.pysimilarity index 100%rename from ee/api/rbac/role.pyrename to products/access_control/backend/presentation/role.pydiff --git a/products/access_control/backend/routes.py b/products/access_control/backend/routes.pynew file mode 100644index 000000000000..4a98209f1ee5--- /dev/null+++ b/products/access_control/backend/routes.py@@ -0,0 +1,18 @@+from posthog.api.routing import RouterRegistry++from products.access_control.backend.presentation.role import RoleMembershipViewSet, RoleViewSet+++def register_routes(routers: RouterRegistry) -> None:+ roles = routers.organizations.register(+ r"roles",+ RoleViewSet,+ "organization_roles",+ ["organization_id"],+ )+ roles.register(+ r"role_memberships",+ RoleMembershipViewSet,+ "organization_role_memberships",+ ["organization_id", "role_id"],+ )diff --git a/ee/api/test/test_role.py b/products/access_control/backend/tests/test_role.pysimilarity index 100%rename from ee/api/test/test_role.pyrename to products/access_control/backend/tests/test_role.pydiff --git a/ee/api/test/test_role_membership.py b/products/access_control/backend/tests/test_role_membership.pysimilarity index 100%rename from ee/api/test/test_role_membership.pyrename to products/access_control/backend/tests/test_role_membership.pydiff --git a/products/ruff.toml b/products/ruff.tomlindex 4d1b1f124f0f..08836e8cf2cd 100644--- a/products/ruff.toml+++ b/products/ruff.toml@@ -66,6 +66,7 @@ extend-select = ["ANN001", "ANN201", "ANN202", "ANN204"]"workflows/backend/**" = ["ANN"]"access_control/backend/presentation/access_control.py" = ["ANN"]+"access_control/backend/presentation/role.py" = ["ANN"]"access_control/backend/presentation/access_control_settings.py" = ["ANN"]"access_control/backend/facade/user_access_control.py" = ["ANN"]diff --git a/pyproject.toml b/pyproject.tomlindex e16b2569fb2c..e54217e40e9f 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -771,6 +771,7 @@ ignore_imports = ["products.access_control.backend.presentation.access_control -> products.access_control.backend.models.access_control","products.access_control.backend.presentation.access_control_settings -> products.access_control.backend.models.access_control","products.access_control.backend.presentation.access_control_settings -> products.access_control.backend.models.role",+ "products.access_control.backend.presentation.role -> products.access_control.backend.models.role",]# routes.py is the one module core reads to assemble a product's API router, so it is the