Skip to content

fix(associations): two protected documents are associated by moderators only - #2827

Merged
lbesson merged 1 commit into
masterfrom
fix/protected-associations
Dec 3, 2026
Merged

lbesson merged 1 commit into
masterfrom
fix/protected-associations

Conversation

@lbesson

@lbesson lbesson commented Dec 2, 2026

Copy link
Copy Markdown
Member

A protected document can only be edited by moderators, and the UI hides its association editor: its associations are changed from the other document (e.g. a new route linked to a protected summit). POST /associations checked nothing for two collaborative documents, so any user could link two protected documents, neither of which they may edit.

  • For non-moderators, an association between two protected documents is refused (400, association), in validate_association_permission: the same rule applies to POST /associations and to the associations of a document create/update.
  • An association with one protected document stays allowed, as in the UI.
  • Removals were already refused for collaborative pairs (check_permission_for_association_removal).

Tests

  • test_add_association_both_protected (contributor 400, moderator 200) fails on master; test_add_association_one_protected.
  • Full suite locally: the only failures were Elasticsearch timeouts under -n 4 (image, topo map, search), which pass alone.

🤖 Generated with Claude Code

…rs only

Associations are changed from a document the user may edit: one of the
two documents at least must not be protected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1ce842ec-abbd-4856-87e4-e347c19b8cd8
Commits

Reviewing files that changed from the base of the PR and between e4af00b and 1e46814.

Files selected for processing: 2

  • c2corg_api/tests/views/test_association.py
  • c2corg_api/views/validation.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@lbesson
lbesson merged commit 440845d into master Dec 3, 2026
8 checks passed
@lbesson
lbesson deleted the fix/protected-associations branch December 3, 2026 08:58
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.

1 participant