-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/user models #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/user-problems
Are you sure you want to change the base?
Conversation
jgonggrijp
left a comment
There was a problem hiding this 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.
| class Role(models.TextChoices): | ||
| ANNOTATOR = "annotator", "Annotator" | ||
| MASTER_ANNOTATOR = "master_annotator", "Master Annotator" | ||
| VISITOR = "visitor", "Visitor" | ||
|
|
There was a problem hiding this comment.
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?
Addresses part of #12
Adds a
rolefield to the User model. I opted to add a fieldcanEditOrAddProblemto 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.