Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(organization): confirm policy narrowing

Max63090d8a201a
diff --git a/tests/test_cloud_management.py b/tests/test_cloud_management.py
index 5c238b06b..e08ee8155 100644
--- a/tests/test_cloud_management.py
+++ b/tests/test_cloud_management.py
@@ -361,6 +361,40 @@ def test_remote_viewer_can_use_identity_gate_but_only_allowlisted_proxy_paths(
)
+def test_chunked_proxy_request_is_bounded_before_json_parsing(monkeypatch, tmp_path) -> None:
+ config = _save_config(monkeypatch, tmp_path)
+ client = _remote_client(config, role="viewer")
+ client.set_cookie(cloud_management.HANDLE_COOKIE_NAME, "grant-1", domain="alex.avibe.bot")
+ client.set_cookie(cloud_management.BROWSER_COOKIE_NAME, "browser-1", domain="alex.avibe.bot")
+ monkeypatch.setattr(cloud_management, "resolve_grant", lambda *args, **kwargs: (_grant(), None))
+ proxy_called = False
+
+ def fake_proxy(*args, **kwargs):
+ nonlocal proxy_called
+ proxy_called = True
+ return 200, {"ok": True}
+
+ monkeypatch.setattr(cloud_management, "proxy_request", fake_proxy)
+ oversized_body = b'{"value":"' + (b"x" * cloud_management.MAX_REQUEST_BYTES) + b'"}'
+ headers = csrf_headers(client, REMOTE_ORIGIN)
+ headers["Content-Type"] = "application/json"
+ headers["Transfer-Encoding"] = "chunked"
+
+ response = client.patch(
+ "/api/cloud-management/organizations/org_1/resources/inst_123/agent/agent_1/access",
+ base_url=REMOTE_ORIGIN,
+ headers=headers,
+ content=iter((oversized_body[:1024], oversized_body[1024:])),
+ )
+
+ assert response.status_code == 413
+ assert response.get_json() == {
+ "error": "cloud_management_request_too_large",
+ "retryable": False,
+ }
+ assert proxy_called is False
+
+
@pytest.mark.parametrize(
("status", "content_type", "body", "expected_code"),
[
diff --git a/ui/src/features/organization/pages/OrganizationInstancePages.tsx b/ui/src/features/organization/pages/OrganizationInstancePages.tsx
index 8b9493793..33dac6e07 100644
--- a/ui/src/features/organization/pages/OrganizationInstancePages.tsx
+++ b/ui/src/features/organization/pages/OrganizationInstancePages.tsx
@@ -63,10 +63,11 @@ import {
hasDuplicateProjectPrincipals,
isCurrentOrganizationLoad,
normalizeOrganizationPrincipal,
+ type ProjectAccessMode,
+ requiresProjectAccessNarrowingConfirmation,
} from '../policy';
type PrincipalKind = InstanceAccessEntry['kind'];
-type ProjectMode = 'inherit' | 'owner_only' | 'restricted';
function displayPrincipal(kind: PrincipalKind, value: string, groups: OrganizationGroup[]): string {
if (kind === 'organization_group') {
@@ -82,7 +83,7 @@ function principalIcon(kind: PrincipalKind) {
return Mail;
}
-function projectMode(project: OrganizationProject): ProjectMode {
+function projectMode(project: OrganizationProject): ProjectAccessMode {
if (project.access.mode === 'inherit') return 'inherit';
return project.access.bindings.length === 0 ? 'owner_only' : 'restricted';
}
@@ -627,13 +628,14 @@ function ProjectAccessDialog({
}) {
const { t } = useTranslation();
const { request } = useOrganization();
- const [mode, setMode] = useState<ProjectMode>('inherit');
+ const [mode, setMode] = useState<ProjectAccessMode>('inherit');
const [bindings, setBindings] = useState<ProjectBinding[]>([]);
const [saving, setSaving] = useState(false);
const [error, setError] = useState<string>();
const [conflict, setConflict] = useState(false);
const [authoritativeProject, setAuthoritativeProject] = useState<OrganizationProject | null>(null);
const [revision, setRevision] = useState(0);
+ const [confirmNarrowing, setConfirmNarrowing] = useState(false);
useEffect(() => {
if (!project) return;
@@ -643,6 +645,7 @@ function ProjectAccessDialog({
setError(undefined);
setConflict(false);
setAuthoritativeProject(null);
+ setConfirmNarrowing(false);
}, [project]);
const activeGroups = groups.filter((group) => !group.archived_at);
@@ -662,21 +665,17 @@ function ProjectAccessDialog({
)));
};
- const save = async () => {
+ const wireBindings = mode === 'restricted'
+ ? bindings.map((binding) => ({
+ ...binding,
+ principal_value: normalizeOrganizationPrincipal(binding.principal_kind, binding.principal_value),
+ }))
+ : [];
+
+ const commit = async () => {
if (!project || (mode === 'restricted' && bindings.length === 0)) return;
setSaving(true);
setError(undefined);
- const wireBindings = mode === 'restricted'
- ? bindings.map((binding) => ({
- ...binding,
- principal_value: normalizeOrganizationPrincipal(binding.principal_kind, binding.principal_value),
- }))
- : [];
- if (hasDuplicateProjectPrincipals(wireBindings)) {
- setError('duplicate_project_access_principal');
- setSaving(false);
- return;
- }
try {
await request(
`/api/cloud-management/instances/${encodeURIComponent(instanceId)}/projects/${encodeURIComponent(project.project_id)}/access`,
@@ -701,7 +700,27 @@ function ProjectAccessDialog({
}
} finally {
setSaving(false);
+ setConfirmNarrowing(false);
+ }
+ };
+
+ const save = () => {
+ if (!project || (mode === 'restricted' && bindings.length === 0)) return;
+ setError(undefined);
+ if (hasDuplicateProjectPrincipals(wireBindings)) {
+ setError('duplicate_project_access_principal');
+ return;
}
+ if (requiresProjectAccessNarrowingConfirmation(
+ projectMode(project),
+ project.access.bindings,
+ mode,
+ wireBindings,
+ )) {
+ setConfirmNarrowing(true);
+ return;
+ }
+ void commit();
};
const reloadAuthoritativeProject = () => {
@@ -718,7 +737,8 @@ function ProjectAccessDialog({
};
return (
- <Dialog open={Boolean(project)} onOpenChange={onOpenChange}>
+ <>
+ <Dialog open={Boolean(project)} onOpenChange={onOpenChange}>
<DialogContent className="max-w-2xl">
<DialogHeader>
<DialogTitle>{t('organization.projects.dialogTitle', { name: project?.display_name })}</DialogTitle>
@@ -805,13 +825,22 @@ function ProjectAccessDialog({
<Button
variant="brand"
disabled={saving || conflict || (mode === 'restricted' && (bindings.length === 0 || bindings.some((binding) => !binding.principal_value.trim())))}
- onClick={() => void save()}
+ onClick={save}
>
{saving ? t('organization.actions.saving') : t('organization.actions.saveChanges')}
</Button>
</DialogFooter>
</DialogContent>
- </Dialog>
+ </Dialog>
+ <ConfirmDialog
+ open={confirmNarrowing}
+ onOpenChange={setConfirmNarrowing}
+ title={t('organization.projects.narrowTitle')}
+ description={t('organization.projects.narrowBody')}
+ confirmLabel={t('organization.actions.saveChanges')}
+ onConfirm={commit}
+ />
+ </>
);
}
diff --git a/ui/src/features/organization/pages/OrganizationResourcesPage.tsx b/ui/src/features/organization/pages/OrganizationResourcesPage.tsx
index 89724980e..fe3101191 100644
--- a/ui/src/features/organization/pages/OrganizationResourcesPage.tsx
+++ b/ui/src/features/organization/pages/OrganizationResourcesPage.tsx
@@ -21,6 +21,7 @@ import clsx from 'clsx';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
+import { ConfirmDialog } from '@/components/ui/confirm-dialog';
import {
Dialog,
DialogContent,
@@ -51,7 +52,10 @@ import {
TableFrame,
} from '../components';
import { useOrganization } from '../context';
-import { isCurrentOrganizationLoad } from '../policy';
+import {
+ isCurrentOrganizationLoad,
+ requiresResourceAccessNarrowingConfirmation,
+} from '../policy';
const RESOURCE_KINDS: Array<{ kind: ResourceKind; icon: typeof Bot }> = [
{ kind: 'agent', icon: Bot },
@@ -86,6 +90,7 @@ function ResourceAccessDialog({
const [error, setError] = useState<string>();
const [conflict, setConflict] = useState(false);
const [authoritativeResource, setAuthoritativeResource] = useState<OrganizationResource | null>(null);
+ const [confirmNarrowing, setConfirmNarrowing] = useState(false);
useEffect(() => {
if (!resource) return;
@@ -95,6 +100,7 @@ function ResourceAccessDialog({
setError(undefined);
setConflict(false);
setAuthoritativeResource(null);
+ setConfirmNarrowing(false);
}, [resource]);
const visibleGroups = groups.filter((group) => !group.archived_at || groupIds.includes(group.id));
@@ -106,7 +112,9 @@ function ResourceAccessDialog({
: [...current, group.id]);
};
- const save = async () => {
+ const wireGroupIds = level === 'scope' ? [...new Set(groupIds)] : [];
+
+ const commit = async () => {
if (!resource || !selectedOrganizationId || (level === 'scope' && groupIds.length === 0)) return;
setSaving(true);
setError(undefined);
@@ -117,7 +125,7 @@ function ResourceAccessDialog({
method: 'PATCH',
body: jsonBody({
access_level: level,
- group_ids: level === 'scope' ? [...new Set(groupIds)] : [],
+ group_ids: wireGroupIds,
if_match_revision: revision,
}),
},
@@ -133,7 +141,24 @@ function ResourceAccessDialog({
}
} finally {
setSaving(false);
+ setConfirmNarrowing(false);
+ }
+ };
+
+ const save = () => {
+ if (!resource || !selectedOrganizationId || (level === 'scope' && groupIds.length === 0)) return;
+ const currentLevel = resource.access?.access_level ?? 'private';
+ const currentGroupIds = resource.access?.group_ids ?? [];
+ if (requiresResourceAccessNarrowingConfirmation(
+ currentLevel,
+ currentGroupIds,
+ level,
+ wireGroupIds,
+ )) {
+ setConfirmNarrowing(true);
+ return;
}
+ void commit();
};
const reloadAuthoritativeResource = () => {
@@ -150,7 +175,8 @@ function ResourceAccessDialog({
};
return (
- <Dialog open={Boolean(resource)} onOpenChange={onOpenChange}>
+ <>
+ <Dialog open={Boolean(resource)} onOpenChange={onOpenChange}>
<DialogContent className="max-w-xl">
<DialogHeader>
<DialogTitle>{t('organization.resources.dialogTitle', { name: resource?.display_name })}</DialogTitle>
@@ -207,12 +233,21 @@ function ResourceAccessDialog({
</div>
<DialogFooter>
<Button variant="ghost" onClick={() => onOpenChange(false)}>{t('common.cancel')}</Button>
- <Button variant="brand" disabled={saving || conflict || (level === 'scope' && groupIds.length === 0)} onClick={() => void save()}>
+ <Button variant="brand" disabled={saving || conflict || (level === 'scope' && groupIds.length === 0)} onClick={save}>
{saving ? t('organization.actions.saving') : t('organization.actions.saveChanges')}
</Button>
</DialogFooter>
</DialogContent>
- </Dialog>
+ </Dialog>
+ <ConfirmDialog
+ open={confirmNarrowing}
+ onOpenChange={setConfirmNarrowing}
+ title={t('organization.resources.narrowTitle')}
+ description={t('organization.resources.narrowBody')}
+ confirmLabel={t('organization.actions.saveChanges')}
+ onConfirm={commit}
+ />
+ </>
);
}
diff --git a/ui/src/features/organization/policy.test.ts b/ui/src/features/organization/policy.test.ts
index a309803c4..e7c29ee92 100644
--- a/ui/src/features/organization/policy.test.ts
+++ b/ui/src/features/organization/policy.test.ts
@@ -7,6 +7,8 @@ import {
normalizeOrganizationPrincipal,
organizationSwitchDestination,
requiresMemberRoleDowngradeConfirmation,
+ requiresProjectAccessNarrowingConfirmation,
+ requiresResourceAccessNarrowingConfirmation,
} from './policy';
describe('Organization policy helpers', () => {
@@ -47,6 +49,32 @@ describe('Organization policy helpers', () => {
expect(requiresMemberRoleDowngradeConfirmation('member', 'member')).toBe(false);
});
+ it('requires confirmation for every Project access narrowing', () => {
+ const editor = { principal_kind: 'email' as const, principal_value: '[email protected]', access_role: 'editor' as const };
+ const viewer = { ...editor, access_role: 'viewer' as const };
+ const secondViewer = { principal_kind: 'email' as const, principal_value: '[email protected]', access_role: 'viewer' as const };
+
+ expect(requiresProjectAccessNarrowingConfirmation('inherit', [], 'restricted', [viewer])).toBe(true);
+ expect(requiresProjectAccessNarrowingConfirmation('inherit', [], 'owner_only', [])).toBe(true);
+ expect(requiresProjectAccessNarrowingConfirmation('restricted', [viewer], 'owner_only', [])).toBe(true);
+ expect(requiresProjectAccessNarrowingConfirmation('restricted', [viewer, secondViewer], 'restricted', [viewer])).toBe(true);
+ expect(requiresProjectAccessNarrowingConfirmation('restricted', [editor], 'restricted', [viewer])).toBe(true);
+ expect(requiresProjectAccessNarrowingConfirmation('restricted', [viewer], 'restricted', [secondViewer])).toBe(true);
+ expect(requiresProjectAccessNarrowingConfirmation('restricted', [viewer], 'restricted', [viewer, secondViewer])).toBe(false);
+ expect(requiresProjectAccessNarrowingConfirmation('restricted', [viewer], 'restricted', [editor])).toBe(false);
+ expect(requiresProjectAccessNarrowingConfirmation('restricted', [viewer], 'inherit', [])).toBe(false);
+ });
+
+ it('requires confirmation only when a Resource audience shrinks', () => {
+ expect(requiresResourceAccessNarrowingConfirmation('public', [], 'scope', ['group-1'])).toBe(true);
+ expect(requiresResourceAccessNarrowingConfirmation('public', [], 'private', [])).toBe(true);
+ expect(requiresResourceAccessNarrowingConfirmation('scope', ['group-1'], 'private', [])).toBe(true);
+ expect(requiresResourceAccessNarrowingConfirmation('scope', ['group-1', 'group-2'], 'scope', ['group-1'])).toBe(true);
+ expect(requiresResourceAccessNarrowingConfirmation('private', [], 'scope', ['group-1'])).toBe(false);
+ expect(requiresResourceAccessNarrowingConfirmation('scope', ['group-1'], 'public', [])).toBe(false);
+ expect(requiresResourceAccessNarrowingConfirmation('scope', ['group-1'], 'scope', ['group-1', 'group-2'])).toBe(false);
+ });
+
it('leaves object detail routes when switching Organizations', () => {
expect(organizationSwitchDestination('/admin/organization/groups/group-1')).toBe(
'/admin/organization/groups',
diff --git a/ui/src/features/organization/policy.ts b/ui/src/features/organization/policy.ts
index 8081b5e76..5fb2cf57e 100644
--- a/ui/src/features/organization/policy.ts
+++ b/ui/src/features/organization/policy.ts
@@ -1,6 +1,12 @@
-import type { OrganizationRole, ProjectBinding, SyncCounts } from './api/types';
+import type {
+ OrganizationRole,
+ ProjectBinding,
+ ResourceAccessLevel,
+ SyncCounts,
+} from './api/types';
export type OrganizationPrincipalKind = ProjectBinding['principal_kind'];
+export type ProjectAccessMode = 'inherit' | 'owner_only' | 'restricted';
export type AggregateSyncStatus = 'none' | 'in_sync' | 'applying' | 'offline' | 'error';
const ORGANIZATION_GROUP_DETAIL_PATH = /^\/admin\/organization\/groups\/[^/]+\/?$/;
@@ -22,6 +28,52 @@ export function hasDuplicateProjectPrincipals(bindings: ProjectBinding[]): boole
return new Set(keys).size !== keys.length;
}
+function projectBindingKey(binding: ProjectBinding): string {
+ return `${binding.principal_kind}:${normalizeOrganizationPrincipal(
+ binding.principal_kind,
+ binding.principal_value,
+ )}`;
+}
+
+export function requiresProjectAccessNarrowingConfirmation(
+ currentMode: ProjectAccessMode,
+ currentBindings: ProjectBinding[],
+ nextMode: ProjectAccessMode,
+ nextBindings: ProjectBinding[],
+): boolean {
+ if (currentMode === 'inherit') return nextMode !== 'inherit';
+ if (currentMode === 'owner_only') return false;
+ if (nextMode === 'owner_only') return true;
+ if (nextMode === 'inherit') return false;
+
+ const nextByPrincipal = new Map(nextBindings.map((binding) => [projectBindingKey(binding), binding]));
+ return currentBindings.some((binding) => {
+ const nextBinding = nextByPrincipal.get(projectBindingKey(binding));
+ return (
+ !nextBinding
+ || (binding.access_role === 'editor' && nextBinding.access_role === 'viewer')
+ );
+ });
+}
+
+export function requiresResourceAccessNarrowingConfirmation(
+ currentLevel: ResourceAccessLevel,
+ currentGroupIds: string[],
+ nextLevel: ResourceAccessLevel,
+ nextGroupIds: string[],
+): boolean {
+ const audienceBreadth: Record<ResourceAccessLevel, number> = {
+ private: 0,
+ scope: 1,
+ public: 2,
+ };
+ if (audienceBreadth[nextLevel] < audienceBreadth[currentLevel]) return true;
+ if (currentLevel !== 'scope' || nextLevel !== 'scope') return false;
+
+ const nextGroups = new Set(nextGroupIds);
+ return currentGroupIds.some((groupId) => !nextGroups.has(groupId));
+}
+
export function aggregateSyncStatus(counts: SyncCounts): AggregateSyncStatus {
if (counts.error > 0) return 'error';
if (counts.offline > 0) return 'offline';
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index e2075c6d7..665659a6d 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -3613,6 +3613,8 @@
"bindingCount": "{{count}} binding(s)",
"dialogTitle": "Manage {{name}} access",
"dialogBody": "Organization management authority lets you change this policy; it does not grant you permission to use the Project.",
+ "narrowTitle": "Narrow this Project's access?",
+ "narrowBody": "This change removes an existing audience, downgrades Editor access, or switches to a more restrictive rule.",
"modes": {
"inherit": "Inherit",
"restricted": "Restricted",
@@ -3638,6 +3640,8 @@
"groupRequired": "Select at least one group.",
"dialogTitle": "Manage {{name}} audience",
"dialogBody": "Choose Private, the whole Organization, or selected Organization groups.",
+ "narrowTitle": "Narrow this resource audience?",
+ "narrowBody": "Some people who can use this resource now will lose access after this change.",
"emptyTitle": "No resources found",
"emptyBody": "No active {{kind}} descriptors are available.",
"everyActiveMember": "Every active member",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 4369252b4..629c607ec 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -3613,6 +3613,8 @@
"bindingCount": "{{count}} 个绑定",
"dialogTitle": "管理 {{name}} 的访问权限",
"dialogBody": "组织管理权限只允许你修改此策略,不会因此获得 Project 使用权限。",
+ "narrowTitle": "收窄此 Project 的访问权限?",
+ "narrowBody": "此更改会移除现有受众、将编辑者降为查看者,或切换到更严格的规则。",
"modes": {
"inherit": "继承",
"restricted": "受限",
@@ -3638,6 +3640,8 @@
"groupRequired": "请至少选择一个群组。",
"dialogTitle": "管理 {{name}} 的受众",
"dialogBody": "选择私有、整个组织或指定组织群组。",
+ "narrowTitle": "收窄此资源的受众?",
+ "narrowBody": "部分当前可以使用此资源的成员将在更改后失去访问权限。",
"emptyTitle": "没有找到资源",
"emptyBody": "没有可用的活跃{{kind}}描述信息。",
"everyActiveMember": "每个活跃成员",
diff --git a/vibe/ui_compat.py b/vibe/ui_compat.py
index 0aff85e5b..3d26e9c20 100644
--- a/vibe/ui_compat.py
+++ b/vibe/ui_compat.py
@@ -421,6 +421,8 @@ class CompatApp(FastAPI):
self,
starlette_request: FastAPIRequest,
func: Callable[..., Any],
+ *,
+ parse_json: bool = True,
) -> Response:
"""Run a native FastAPI endpoint through the shared UI request hooks.
@@ -443,7 +445,8 @@ class CompatApp(FastAPI):
response = normalize_response(result)
break
if response is None:
- compat_request._json_payload = await _read_json_payload(starlette_request)
+ if parse_json:
+ compat_request._json_payload = await _read_json_payload(starlette_request)
response = normalize_response(await run_maybe_async(func))
except Exception as exc:
response = await self._handle_compat_exception(exc)
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 06f56ddc6..b7fe11451 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -5432,7 +5432,31 @@ def cloud_management_session_delete():
return response
-def _cloud_management_proxy(upstream_path: str) -> Response:
+async def _read_cloud_management_json_body(starlette_request: FastAPIRequest) -> Any:
+ from vibe import cloud_management
+
+ body = bytearray()
+ async for chunk in starlette_request.stream():
+ if len(body) + len(chunk) > cloud_management.MAX_REQUEST_BYTES:
+ raise cloud_management.CloudManagementError(
+ "cloud_management_request_too_large",
+ status=413,
+ retryable=False,
+ )
+ body.extend(chunk)
+ if not body:
+ return {}
+ try:
+ payload = json.loads(body)
+ except json.JSONDecodeError as exc:
+ raise StarletteHTTPException(status_code=400, detail="Malformed JSON") from exc
+ return {} if payload is None else payload
+
+
+async def _cloud_management_proxy(
+ starlette_request: FastAPIRequest,
+ upstream_path: str,
+) -> Response:
from vibe import cloud_management
config = _load_remote_access_config()
@@ -5478,11 +5502,17 @@ def _cloud_management_proxy(upstream_path: str) -> Response:
{"error": "cloud_management_request_too_large", "retryable": False},
413,
)
- body = request.json if request.method in MUTATING_METHODS else None
- if request.method in MUTATING_METHODS and body is None:
- body = {}
try:
- status, payload = cloud_management.proxy_request(
+ body = (
+ await _read_cloud_management_json_body(starlette_request)
+ if request.method in MUTATING_METHODS
+ else None
+ )
+ except cloud_management.CloudManagementError as exc:
+ return _cloud_management_error_response(exc)
+ try:
+ status, payload = await asyncio.to_thread(
+ cloud_management.proxy_request,
config,
grant=grant,
method=request.method,
@@ -5500,25 +5530,49 @@ def _cloud_management_proxy(upstream_path: str) -> Response:
return response
- "/api/cloud-management/organizations/<path:management_path>",
- methods=["GET", "POST", "PUT", "PATCH", "DELETE"],
-)
-def cloud_management_organizations_proxy(management_path: str):
- return _cloud_management_proxy(f"/api/organizations/{management_path}")
+async def _dispatch_cloud_management_proxy(
+ starlette_request: FastAPIRequest,
+ upstream_path: str,
+) -> Response:
+ async def handler() -> Response:
+ return await _cloud_management_proxy(starlette_request, upstream_path)
+ return await app.dispatch_native_request(starlette_request, handler, parse_json=False)
[email protected]("/api/cloud-management/organizations", methods=["GET"])
-def cloud_management_organizations_root_proxy():
- return _cloud_management_proxy("/api/organizations")
[email protected]("/api/cloud-management/organizations", include_in_schema=False)
+async def cloud_management_organizations_root_proxy(starlette_request: FastAPIRequest):
+ return await _dispatch_cloud_management_proxy(starlette_request, "/api/organizations")
- "/api/cloud-management/instances/<path:management_path>",
+
+ "/api/cloud-management/organizations/{management_path:path}",
methods=["GET", "POST", "PUT", "PATCH", "DELETE"],
+ include_in_schema=False,
)
-def cloud_management_instances_proxy(management_path: str):
- return _cloud_management_proxy(f"/api/instances/{management_path}")
+async def cloud_management_organizations_proxy(
+ starlette_request: FastAPIRequest,
+ management_path: str,
+):
+ return await _dispatch_cloud_management_proxy(
+ starlette_request,
+ f"/api/organizations/{management_path}",
+ )
+
+
+ "/api/cloud-management/instances/{management_path:path}",
+ methods=["GET", "POST", "PUT", "PATCH", "DELETE"],
+ include_in_schema=False,
+)
+async def cloud_management_instances_proxy(
+ starlette_request: FastAPIRequest,
+ management_path: str,
+):
+ return await _dispatch_cloud_management_proxy(
+ starlette_request,
+ f"/api/instances/{management_path}",
+ )
@app.route("/auth/callback", methods=["GET"])