Skip to content

Mapper permissions & roles: capability layer with dual Keycloak/Django support #2780

Description

@paynejd

Replace the hardcoded Mapper group checks with a permission/capability layer that behaves identically in standalone (Django-only) and Keycloak-integrated deployments. OCL supports both permanently — this is not a migration.

Today the Mapper is gated by group names in code: mapper-approved/mapper-waitlist (oclapi2/core/concepts/views.py:1041,1064), isInWaitlist() (oclmap/src/common/utils.js:1125), mapper_ai_assistant (ocl-ai-assistant/core/match/views.py:101,194). Roles and tiers must be data, so new roles need no code change.

ACs

  • Permissions defined: mapper.use, mapper.ai_assistant, mapper.custom_algorithms, mapper.org_projects. Roles bundle permissions; roles assign to groups and users.
  • Code checks permissions only — no role or group names in oclapi2, oclmap or ocl-ai-assistant
  • Standalone: administered in Django admin. Keycloak-integrated: defined in Keycloak and replicated into Django.
  • Replication must not silently drop assignments. core/common/backends.py:69,80 calls user.set_groups(claims.get('groups', [])) on every OIDC login, replacing the whole Django group set — verify and document the real behaviour before anything relies on it.
  • Every account receives the default preview role: Keycloak default + Django on user creation + a re-runnable backfill for existing accounts
  • GET /user/ exposes the capability set (consumed by the Mapper UI and the usage page)
  • is_mapper_approved / is_mapper_waitlisted group checks retired

To decide during implementation

  • Replication mechanism and conflict rule: login claims vs sync job vs admin events; whether role→permission mappings and cap values replicate, or only membership. Proposed: Keycloak authoritative when integrated, Django authoritative standalone.
  • Default-access mechanism in both modes

Out of scope: TBv3 permissions, tier roles, per-repo/per-project permissions (#2763).

Approach doc: ocl-workspace/mapper/2026-09-15-mapper-public-preview-approach.md (WP1). Caps and ledger: #2762 · epic OpenConceptLab/ocl_online#133

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

component/apiCore terminology service APIcomponent/mapperMapping toolssignal/has-dependenciesRelies on other work or external inputssignal/high-riskSignificant potential impact if incorrectsignal/large-scopeAffects multiple areas or systemssignal/well-specifiedClear requirements and acceptance criteriastage/triagedAI triage complete — scored and classifiedtype/featureNew or improved functionality

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions