Skip to content

fix: migrate auth to persistent IDs#3841

Merged
nijel merged 1 commit into
mainfrom
user-sync
May 25, 2026
Merged

fix: migrate auth to persistent IDs#3841
nijel merged 1 commit into
mainfrom
user-sync

Conversation

@nijel

@nijel nijel commented May 25, 2026

Copy link
Copy Markdown
Member

This also tries to consolidate the data.

Companion to WeblateOrg/hosted#1560

@nijel nijel requested a review from Copilot May 25, 2026 13:35
@nijel nijel self-assigned this May 25, 2026
@argos-ci

argos-ci Bot commented May 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - May 25, 2026, 3:17 PM

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24cdfeffb2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread weblate_web/saml.py Outdated
@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.79%. Comparing base (744a4a1) to head (68e5c23).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3841      +/-   ##
==========================================
+ Coverage   88.63%   88.79%   +0.16%     
==========================================
  Files          68       71       +3     
  Lines       10019    10485     +466     
  Branches      858      907      +49     
==========================================
+ Hits         8880     9310     +430     
- Misses        846      873      +27     
- Partials      293      302       +9     
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 414fa5381c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread weblate_web/saml.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates hosted user authentication/synchronization from email-based SAML identifiers to persistent external IDs, introducing local storage for SAML identities and adding tooling to sync/audit hosted users.

Changes:

  • Replace /api/user/ synchronization logic to use external_id-based SAML identity syncing.
  • Add SamlIdentity (and ExternalSyncState) models + migration, and register SAML identities in Django admin.
  • Switch SAML backend/config to persistent NameID and add management commands to sync/audit hosted users.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
weblate_web/views.py Routes API user sync through new SAML identity sync helper and updates error handling paths.
weblate_web/tests.py Adds coverage for external-id user sync, legacy linking, duplicate email ambiguity, and backend nameid extraction.
weblate_web/settings.py Switches to custom SAML backend and configures persistent NameID + hosted sync endpoints.
weblate_web/saml.py Implements SAML identity model syncing, legacy linking, and a custom djangosaml2 backend.
weblate_web/models.py Adds SamlIdentity and ExternalSyncState models for persistent identity mapping and sync cursor storage.
weblate_web/migrations/0051_samlidentity_externalsyncstate.py Creates DB tables/constraint for the new models.
weblate_web/management/commands/sync_hosted_users.py Adds hosted→local user sync command using signed payloads and cursor persistence.
weblate_web/management/commands/audit_saml_users.py Adds audit command to report duplicate-email risk prior to migration.
weblate_web/admin.py Exposes SamlIdentity in Django admin for operational visibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread weblate_web/saml.py
Comment thread weblate_web/saml.py
Comment thread weblate_web/saml.py
Comment thread weblate_web/views.py
Comment thread weblate_web/management/commands/sync_hosted_users.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a93ff3188b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread weblate_web/saml.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comment thread weblate_web/saml.py
Comment thread weblate_web/saml.py
Comment thread weblate_web/models.py Outdated
Comment thread weblate_web/management/commands/sync_hosted_users.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread weblate_web/management/commands/sync_hosted_users.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread weblate_web/views.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8eba77e55

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread weblate_web/management/commands/sync_hosted_users.py Outdated
@nijel nijel force-pushed the user-sync branch 2 times, most recently from 4118061 to b17a156 Compare May 25, 2026 14:58
@nijel nijel requested a review from Copilot May 25, 2026 14:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread weblate_web/management/commands/sync_hosted_users.py
Comment thread weblate_web/views.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b17a15688d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread weblate_web/management/commands/sync_hosted_users.py Outdated
This also tries to consolidate the data.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@nijel nijel merged commit 00efc8d into main May 25, 2026
38 of 39 checks passed
@nijel nijel deleted the user-sync branch May 25, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants