diff --git a/api/organisations/urls.py b/api/organisations/urls.py index c32d9d2ad304..6ed337017abc 100644 --- a/api/organisations/urls.py +++ b/api/organisations/urls.py @@ -102,14 +102,24 @@ RoleEnvironmentPermissionsViewSet, RoleOrganisationPermissionViewSet, RoleProjectPermissionsViewSet, + RolesByUserViewSet, RoleViewSet, UserRoleViewSet, ) + nested_user_roles_routes = routers.NestedSimpleRouter( + parent_router=organisations_router, parent_prefix=r"users", lookup="user" + ) + organisations_router.register("roles", RoleViewSet, basename="organisation-roles") nested_roles_router = routers.NestedSimpleRouter( organisations_router, r"roles", lookup="role" ) + nested_user_roles_routes.register( + prefix="roles", + viewset=RolesByUserViewSet, + basename="role-users", + ) nested_roles_router.register( "environments-permissions", RoleEnvironmentPermissionsViewSet, @@ -134,5 +144,6 @@ [ url(r"^", include(organisations_router.urls)), url(r"^", include(nested_roles_router.urls)), + url(r"^", include(nested_user_roles_routes.urls)), ] )