feat(supplier): the portal invites a supplier for one component (#1027)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m16s
CI / Check (pull_request) Successful in 22m0s

Phase 3 of the supplier SBOM epic: the platform API the portal calls with its
service token to invite a supplier, list the tenant's invites and withdraw one.

- An invite is kept in the tenant's own database (`supplier_invites`), so the
  tenant export and erasure cover it, the supplier's address included. The
  portal owns the secret link and the mail and keys its link by the invite id.
- Only a supplier component (a target with `supplier`) can be invited for;
  any other answers 422, an unknown target or tenant 404, and a lookup in an
  unknown tenant creates no database.
- An invite is valid for 90 days and its state is `active`, `expired` or
  `withdrawn`; a second withdrawal keeps the first.
- Deleting a target deletes its invites.
- The portal's target list names each supplier component's `supplier`.

The upload through an invite follows in its own PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-11-18 11:35:50 +01:00
1 parent 31b8cb9d37
commit 5ec891fa28
8 files changed
+705

No files matched your search

+11
View File
@@ -18,6 +18,7 @@ use compliance_core::{OrgRole, TenantContext, TenantStatus};
use crate::agent::ComplianceAgent;
use crate::api::handlers;
use crate::api::handlers::platform::{self, PlatformState};
use crate::api::handlers::supplier_invites;
use crate::api::{role_gate, routes};
use crate::error::AgentError;
@@ -365,6 +366,16 @@ pub async fn start_api_server(
.put(platform::put_git_source)
.delete(platform::delete_git_source),
)
// Supplier invites (#1027): the portal invites a supplier to upload
// one component's SBOM.
.route(
"/api/v1/platform/tenants/{id}/supplier-invites",
get(supplier_invites::list_invites).post(supplier_invites::create_invite),
)
.route(
"/api/v1/platform/tenants/{id}/supplier-invites/{invite}/withdraw",
post(supplier_invites::withdraw_invite),
)
.layer(middleware::from_fn_with_state(
platform_state.clone(),
platform::require_platform_token,