Skip to content

Source permissions & identity mappings

A collection’s group binding decides which groups can retrieve from it. For content synced by a connector there is a second gate: each document carries the ACL of its source item (Slack channel members, Drive sharing, Confluence restrictions, …), and a signed-in user only receives a connector chunk when one of their mapped source principals is on that ACL. Uploaded files have no ACL; the group binding alone governs them.

For a chat call made by a signed-in end user (portal JWT), retrieval keeps a chunk when:

collection_id ∈ the group's collections
AND (
source = "upload"
OR (source = "connector" AND acl ∩ (user's mapped principals ∪ {"public"}) ≠ ∅)
)

The user’s principals are read from kb_connector_identity_mappings on every grounded call, so a new or deleted mapping applies to the next question. A user with no mappings still sees uploads and connector items stamped public (Notion pages, crawled web pages, public repos and public-link Drive files). If the mapping lookup fails, retrieval fails closed to that same public-only set.

Mappings must match what the connector stamps, exactly:

Connector Principal format Example
Google Drive gdrive:user:<email> (lowercase), gdrive:group:<email>, gdrive:domain:<domain> gdrive:user:ana.berg@acme.com
Slack slack:user:<user id>, slack:channel:<channel id> slack:user:U04ABCD1234
Confluence confluence:user:<accountId>, confluence:group:<id>, confluence:space:<KEY> confluence:space:ENG
GitHub github:user:<login>, github:team:<slug> github:team:platform
Jira jira:project:<KEY>:role:<name>, jira:project:<KEY>:group:<id>, jira:security:<KEY>:<level> jira:project:OPS:role:Developers
SharePoint sp:user:<object id>, sp:group:<object id>, sp:tenant:<tenant id> sp:group:3f2b9c1e-…
Notion, web crawler public only public

Base http://localhost:5050/v1/admin/kb-connector-identities, admin JWT.

Method Path Purpose
GET (base path) List mappings (?end_user_id=42&connector_type=slack)
POST (base path) Create one mapping (201); an existing identical triple is refreshed instead
POST /bulk Upsert many mappings; idempotent
DELETE /{mapping_id} Delete one mapping (204)
Terminal window
curl -s -X POST http://localhost:5050/v1/admin/kb-connector-identities \
-H "Authorization: Bearer $ADMIN_JWT" -H "Content-Type: application/json" \
-d '{"end_user_id": 42, "connector_type": "slack",
"source_principal": "slack:user:U04ABCD1234", "mapping_source": "manual"}'

Response 201:

{
"id": "kbidn-01K8ZT2C4E6G8J0L2N4Q6S8U0W",
"tenant_id": "default",
"end_user_id": 42,
"connector_type": "slack",
"source_principal": "slack:user:U04ABCD1234",
"mapping_source": "manual",
"verified_at": null,
"created_at": "2026-10-28T09:40:12.004811+00:00",
"updated_at": "2026-10-28T09:40:12.004811+00:00",
"created_by": "admin"
}
Field Values Example
end_user_id the portal user’s numeric ID, ≥1 42
connector_type one of the eight connector types "google_drive"
source_principal 1–512 chars, exact principal string "gdrive:user:ana.berg@acme.com"
mapping_source manual (default), scim, oidc_claim, self_link "scim"

404 when end_user_id is not a user of this tenant. A user may hold several principals per connector (for example a slack:user: and several slack:channel: entries); the filter ORs across all of them.

For SCIM jobs or a scripted import, post the whole set; rows for users not in the tenant are skipped rather than failing the batch:

Terminal window
curl -s -X POST http://localhost:5050/v1/admin/kb-connector-identities/bulk \
-H "Authorization: Bearer $ADMIN_JWT" -H "Content-Type: application/json" \
-d '{"mappings": [
{"end_user_id": 42, "connector_type": "github", "source_principal": "github:user:anaberg", "mapping_source": "scim"},
{"end_user_id": 43, "connector_type": "github", "source_principal": "github:team:platform", "mapping_source": "scim"}
]}'
{"created": 1, "updated": 1, "skipped": 0}

For connectors whose principals are the user’s email, Brutor can create the mapping at sign-in instead of you maintaining it. Today that is Google Drive only (gdrive:user:<email>).

  1. Leave the tenant switch kb_oidc_auto_derive_enabled on (it defaults to true; PATCH /v1/admin/tenants/{tenant_id} with false turns it off).

  2. On the Google Drive connector, set "auto_derive_from_oidc": true (create or PATCH), or tick the option in the connector form.

  3. When a user signs in through SAML SSO with a verified email, an oidc_claim mapping gdrive:user:<lowercased email> is upserted. Unverified emails are skipped, and existing manual mappings are left alone.

A signed-in user can see and remove their own mappings through the Core Proxy, but cannot create them: a self-asserted principal would let anyone claim another person’s documents.

Method Path (Core Proxy :8100, portal JWT) Result
GET /v1/portal/kb-identities The caller’s mappings
GET /v1/portal/kb-identities/connectors Static list of linkable connector types (self_link_available is false for all)
POST /v1/portal/kb-identities Always 501 self_link_oauth_not_wired; mappings come from an admin, SCIM or SSO derivation
DELETE /v1/portal/kb-identities/{mapping_id} 204, or 404 for any mapping that is not the caller’s
Terminal window
curl -s http://localhost:8100/v1/portal/kb-identities \
-H "Authorization: Bearer $PORTAL_JWT" -H "X-Tenant-ID: default"
{
"mappings": [
{
"id": "kbidn-01K8ZT2C4E6G8J0L2N4Q6S8U0W",
"connector_type": "slack",
"source_principal": "slack:user:U04ABCD1234",
"mapping_source": "manual",
"verified_at": null,
"created_at": "2026-10-28T09:40:12.004811+00:00",
"updated_at": "2026-10-28T09:40:12.004811+00:00",
"created_by": "admin"
}
],
"total": 1
}

Errors on this surface use {"error": "<code>", "message": "<text>"}.