Skip to content

Feat/add roles foundation#17

Merged
AAdewunmi merged 4 commits into
mainfrom
feat/add-roles-foundation
May 5, 2026
Merged

Feat/add roles foundation#17
AAdewunmi merged 4 commits into
mainfrom
feat/add-roles-foundation

Conversation

@AAdewunmi

Copy link
Copy Markdown
Owner

Summary

Adds the StudyBuddy roles foundation for consistent role-aware access control.

Changes

  • Introduced an explicit Role model for product access roles.
  • Added stable role slugs and human-readable display names.
  • Added optional role descriptions.
  • Added created_at and updated_at timestamps.
  • Linked roles to the custom user model through Role.users.
  • Preserved reverse access through user.studybuddy_roles.
  • Added admin support for managing roles.
  • Updated tests to use the new role display name field.

Behavior

Roles can now be created, assigned to users, and queried consistently for dashboard and future feature access decisions.

Why

StudyBuddy needs a durable role foundation before expanding user-facing workflows. Modeling roles explicitly avoids hard-coded access assumptions and gives future features a consistent way to check user capabilities.

Validation

  • docker compose exec web python manage.py migrate --noinput
  • docker compose exec web python -m black . --check
  • docker compose exec web python -m ruff check .
  • docker compose exec web pytest -q

Result

All validation passes. The test suite reports 17 passed.

Notes

Role assignment remains owned by the roles app via Role.users, with users accessing assigned roles through user.studybuddy_roles.

@codecov

codecov Bot commented May 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AAdewunmi AAdewunmi merged commit 3d9cb4d into main May 5, 2026
2 checks passed
@AAdewunmi AAdewunmi deleted the feat/add-roles-foundation branch May 5, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

Add roles foundation

1 participant