You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The history model is not a tenancy object. due to this there is no filtering by organization can be done.
Details
Adjust the history model so that it is a tenancy model. The model only requires that it contain an organization field.
This cant be done by simply importing the TenancyObject abstract class, as this class also includes the history saving feature. Thought will need to be placed into how this will be done so as not to create a recursive loop.
Migration
This change will require a migration in addition to the migration to add the field. The migration will need to conduct the following in order so as to change the model to be a Tenancy Model:
add the organization field with type int
iterate over the entire history table fetching the history entry item using item_class if parent_class does not exist
with the found history entry item, add its organization.id to the history table organization field for that row
add another migration that sets the organization field as a pk field for the organization model
If the history entry item does not exist, remove it
Model delete signal which will remove history entries on parent model delete if no parent item, then use item_class
Tasks
☑️ remove test_view_different_organizaiton_denied test case from functional test cases HistoryPermissionsAPI app/core/tests/functional/test_history/test_history_viewset.py
This test case post the changes above, will once again be required as the model will be a Tenancy object.
The text was updated successfully, but these errors were encountered:
The history model is not a tenancy object. due to this there is no filtering by organization can be done.
Details
Adjust the history model so that it is a tenancy model. The model only requires that it contain an
organization
field.This cant be done by simply importing the
TenancyObject
abstract class, as this class also includes the history saving feature. Thought will need to be placed into how this will be done so as not to create a recursive loop.Migration
This change will require a migration in addition to the migration to add the field. The migration will need to conduct the following in order so as to change the model to be a Tenancy Model:
organization
field with typeint
organization.id
to the history table organization field for that roworganization
field as a pk field for the organization modelLinks
Requirements
if no parent item, then use item_class
Tasks
test_view_different_organizaiton_denied
test case from functional test casesHistoryPermissionsAPI
app/core/tests/functional/test_history/test_history_viewset.py
This test case post the changes above, will once again be required as the model will be a Tenancy object.
The text was updated successfully, but these errors were encountered: