Skip to content

Conversation

@XanderVertegaal
Copy link
Contributor

Addresses part of #12

Adds a role field to the User model. I opted to add a field canEditOrAddProblem to the serializer so we don't have to implement a method that checks whether a user with role X can do Y in two places.

@XanderVertegaal XanderVertegaal changed the base branch from develop to feature/user-problems November 4, 2025 15:53
Copy link
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#12 has a table of permissions that each role should or should not have. Why not just define those as custom permissions (where needed) and then implement the roles as regular user groups? That way you don't have to hardcode the roles and Django will assist more in enforcing the permissions.

Comment on lines +17 to +21
class Role(models.TextChoices):
ANNOTATOR = "annotator", "Annotator"
MASTER_ANNOTATOR = "master_annotator", "Master Annotator"
VISITOR = "visitor", "Visitor"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't you basically reinventing and hardcoding user groups here?

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.

3 participants