Skip to content

Refactor/user and tests - #3

Merged
tmetzl merged 4 commits into
mainfrom
refactor/user-and-tests
Jul 31, 2026
Merged

Refactor/user and tests#3
tmetzl merged 4 commits into
mainfrom
refactor/user-and-tests

Conversation

@tmetzl

@tmetzl tmetzl commented Jul 31, 2026

Copy link
Copy Markdown
Member

This pull request refactors the user type used throughout the RBAC (Role-Based Access Control) system to use a new UserLike protocol instead of the concrete User class. This improves flexibility by allowing any object with the required attributes (username and groups) to be used as a user, and removes the dependency on the User class. The change is applied across the API, decorators, and documentation.

User type refactoring:

  • Introduced the UserLike protocol in e2x_hub_rbac/auth/rbac.py, requiring username and groups attributes, and refactored all RBAC-related APIs and decorators to use UserLike instead of the User class. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]

  • Removed the User class definition from e2x_hub_rbac/auth/user.py, eliminating the dependency on Pydantic for user modeling.

Documentation updates:

  • Updated all code examples and usage in README.md to use UserLike or a simple dataclass for users, instead of the old User class. [1] [2] [3] [4]

Bug fix:

  • Fixed a bug in permission checking where term-scoped permissions now require both course_id and term_id in the context, ensuring correct validation.

@tmetzl
tmetzl merged commit 038af1e into main Jul 31, 2026
5 checks passed
@tmetzl
tmetzl deleted the refactor/user-and-tests branch July 31, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant