feat: add provider profile removal delegation
This commit is contained in:
@@ -66,6 +66,7 @@ export function isCloudApiProxyRoute(method, pathname) {
|
||||
}
|
||||
if (normalizedMethod === "DELETE") {
|
||||
return isAdminAccessWriteProxyRoute(normalizedMethod, normalizedPath) ||
|
||||
isProviderProfileManagementProxyRoute(normalizedMethod, normalizedPath) ||
|
||||
isApiKeyWriteProxyRoute(normalizedMethod, normalizedPath) ||
|
||||
isAgentConversationWriteProxyRoute(normalizedMethod, normalizedPath);
|
||||
}
|
||||
@@ -86,6 +87,7 @@ function isAdminAccessWriteProxyRoute(method, pathname) {
|
||||
function isProviderProfileManagementProxyRoute(method, pathname) {
|
||||
const parts = pathname.split("/").filter(Boolean);
|
||||
if (parts.length < 4 || parts[0] !== "v1" || parts[1] !== "admin" || parts[2] !== "provider-profiles") return false;
|
||||
if (method === "DELETE" && parts.length === 4) return true;
|
||||
if (method === "PUT" && parts.length === 5 && parts[4] === "credential") return true;
|
||||
if (method === "PUT" && parts.length === 5 && parts[4] === "config") return true;
|
||||
if (method === "POST" && parts.length === 5 && parts[4] === "validate") return true;
|
||||
|
||||
@@ -136,6 +136,12 @@ test("cloud web proxies authenticated provider profile management write routes",
|
||||
publicRoute: false,
|
||||
routeKey: "POST /v1/admin/provider-profiles/deepseek/validate"
|
||||
});
|
||||
assert.deepEqual(cloudWebProxyRoutePolicy("DELETE", "/v1/admin/provider-profiles/deepseek"), {
|
||||
proxy: true,
|
||||
authRequired: true,
|
||||
publicRoute: false,
|
||||
routeKey: "DELETE /v1/admin/provider-profiles/deepseek"
|
||||
});
|
||||
assert.deepEqual(cloudWebProxyRoutePolicy("DELETE", "/v1/admin/provider-profiles/deepseek/credential"), {
|
||||
proxy: false,
|
||||
authRequired: false,
|
||||
|
||||
Reference in New Issue
Block a user