Skip to content

Teams permissions - #836

Open
AdrianDAlessandro wants to merge 5 commits into
profile-modelfrom
teams-permissions
Open

AdrianDAlessandro wants to merge 5 commits into
profile-modelfrom
teams-permissions

Conversation

@AdrianDAlessandro

@AdrianDAlessandro AdrianDAlessandro commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR adds Django Guardian as a requirement, along with some signals and custom permissions to assign permissions to people within Teams, with special permissions going to the team managers.

These are the features implemented

  • Every member, including managers, can view their team; managers additionally receive team edit/delete, member-profile visibility, and member-management permissions.
  • Saving or deleting a membership, including changing its manager role through the admin, immediately recomputes that user's permissions for the team.
  • Permission rows are assigned to individual users and are removed with the team or user; deleting a team cannot leave permissions that affect a later team.
  • A reversible data migration backfills existing memberships and is safe to run on an empty database.
  • Tests verify permission outcomes through Django's permission API and guardian object queries, without inspecting permission tables or calling signal handlers directly.
  • The membership model documents that membership changes must not use queryset updates or bulk operations that bypass permission synchronization.

Note: Most of this was AI-generated from a spec that included the above checklist. I have tested the behaviour, and it works as expected, but haven't yet thoroughly checked the implementation (mainly, I haven't looked closely at the tests).

Fixes #810

Type of change

  • Documentation (non-breaking change that adds or improves the documentation)
  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Technical work (non-breaking, change which is work as part of a new feature)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass (eg. python -m pytest)
  • The documentation builds and looks OK (eg. mkdocs serve)
  • Pre-commit hooks run successfully (eg. pre-commit run --all-files)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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