Refactoring

* moves updating of shared access users into Intervention
This commit is contained in:
2021-11-16 12:51:10 +01:00
parent 648bfba1bf
commit bd189c4a54
3 changed files with 60 additions and 52 deletions

View File

@@ -284,6 +284,25 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
)
return deduction
def update_sharing_user(self, form):
""" Adds a new user with shared access to the intervention
Args:
form (ShareInterventionModalForm): The form holding the data
Returns:
"""
form_data = form.cleaned_data
keep_accessing_users = form_data["users"]
new_accessing_users = list(form_data["user_select"].values_list("id", flat=True))
accessing_users = keep_accessing_users + new_accessing_users
users = User.objects.filter(
id__in=accessing_users
)
self.share_with_list(users)
class InterventionDocument(AbstractDocument):
"""