Skip to content

Commit

Permalink
update project_filter_users_to_remove signal processing
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Sep 13, 2024
1 parent e87ffa6 commit 8103e2b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions coldfront/core/project/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,14 @@ def get(self, request, *args, **kwargs):
pk = self.kwargs.get('pk')
project_obj = get_object_or_404(Project, pk=pk)
users_to_remove = self.get_users_to_remove(project_obj)
users_no_removal = None

# if ldap is activated, prevent selection of users with project corresponding to primary group
users_no_removal, users_to_remove = project_filter_users_to_remove.send(
signal_response = project_filter_users_to_remove.send(
sender=self.__class__, users_to_remove=users_to_remove, project=project_obj
)
user_categories = signal_response[0][1]
users_no_removal = user_categories[0]
users_to_remove = user_categories[1]

context = {}

Expand All @@ -776,9 +778,12 @@ def post(self, request, *args, **kwargs):

users_to_remove = self.get_users_to_remove(project_obj)
# if ldap is activated, prevent selection of users with project corresponding to primary group
users_no_removal, users_to_remove = project_filter_users_to_remove.send(
sender=self.__class__, users=users_to_remove, project=project_obj
signal_response = project_filter_users_to_remove.send(
sender=self.__class__, users_to_remove=users_to_remove, project=project_obj
)
user_categories = signal_response[0][1]
users_no_removal = user_categories[0]
users_to_remove = user_categories[1]

formset = formset_factory(ProjectRemoveUserForm, max_num=len(users_to_remove))
formset = formset(request.POST, initial=users_to_remove, prefix='userform')
Expand Down

0 comments on commit 8103e2b

Please sign in to comment.