-
Notifications
You must be signed in to change notification settings - Fork 22
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
Multiple allowed users for PermitArea (HPH-36) #276
Conversation
Add a QuerySet method named "for_user" for PermitAreas and use it instead of direct filtering by the field name. This allows changing the field name without changes to these filters. Refs HPH-36
51116b0
to
ecb07b5
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #276 +/- ##
==========================================
- Coverage 94.70% 94.48% -0.22%
==========================================
Files 187 190 +3
Lines 5797 5843 +46
Branches 389 398 +9
==========================================
+ Hits 5490 5521 +31
- Misses 240 250 +10
- Partials 67 72 +5 ☔ View full report in Codecov by Sentry. |
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.
LGTM!
Add a new many-2-many field named "allowed_users" to PermitArea and populate it with the user object from the "permitted_user" field. This allows multiple operators/enforcers to use the same PermitAreas for their permits. also make the permitted_user field nullable for now to allow migrations to be reversed. Refs HPH-36
Remove the "permitted_user" field from the PermitArea model and update all code to use the "allowed_users" instead, because the field is now redundant. Refs HPH-36
Rename all occurences of "permitted_user" to "allowed_user" so that code matches the new naming of the field. The tests are still utilizing just a single allowed user per area, but that should be fine for now. Refs HPH-36
Make the "allowed_user" parameter optional, since now it's possible to create the PermitAreas without any allowed users and it could make sense to import new areas without assigning them to any users at import time. Refs HPH-36
Add a few test cases that make sure that the creation of permits via the Operator API works correctly even when the PermitArea has more than one allowed user. Refs HPH-36
ecb07b5
to
7531956
Compare
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.
Good!
Add support for allowing sharing of the PermitAreas between operators and the enforcer.
Previously it was possible to use each PermitArea for just a single enforcer or operator.
This was especially problematic, because the PermitArea codes were unique within
enforcement domains so it was not even possible to create duplicate areas with the
same identifiers.