Skip to content

feat(user): added role in userout - #76

Open
panckeyk wants to merge 1 commit into
mainfrom
feat/user-role-enum
Open

panckeyk wants to merge 1 commit into
mainfrom
feat/user-role-enum

Conversation

@panckeyk

Copy link
Copy Markdown
Contributor

Ticket

Description

Adds role field to UserOut schema to expose user roles from django-rolepermissions in the API response.

Implementation

  • models.py: Add @property method to User model that retrieves role from groups via get_user_roles()
  • schemas.py: Add role: RoleEnum | None field to UserOut schema to include role in API responses

Technical Details

  • Role is computed from Django groups using rolepermissions library
  • Returns system_admin, admin, or operator based on group membership
  • Returns None if user has no role assigned

Dependencies

  • Depends on rolepermissions.roles.get_user_roles() for role resolution
  • Uses existing RoleEnum from schemas

Breaking Changes

None - this is an additive change that extends the existing UserOut schema.

Related Issue

Closes #

Type of Change

  • Bug fix
  • New feature
  • Chore
  • Refactor
  • Documentation

Image Change

Copilot AI balanced review requested due to automatic review settings November 27, 2026 21:20

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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