Date: Wed, 17 Dec 2025 15:50:19 -0800
Subject: [PATCH 06/20] add import_from_settings to ldap signals.py
---
.../core/project/templates/project/project_remove_users.html | 4 ++--
coldfront/core/project/views.py | 3 ++-
coldfront/plugins/ldap/management/commands/add_projects.py | 2 +-
coldfront/plugins/ldap/signals.py | 1 +
coldfront/plugins/ldap/utils.py | 1 -
5 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/coldfront/core/project/templates/project/project_remove_users.html b/coldfront/core/project/templates/project/project_remove_users.html
index daebebffda..8b86a851fe 100644
--- a/coldfront/core/project/templates/project/project_remove_users.html
+++ b/coldfront/core/project/templates/project/project_remove_users.html
@@ -19,8 +19,8 @@ Remove users from project: {{project.title}}
{% if request.user.is_superuser %}
As a superuser, you can remove any user from the project. Please be aware that
- removing a user that has your lab as their primary group may cause issues with
- that user's access to other resources. If you are unsure, please
+ removing a user from their primary group will cause their account to be deactivated and
+ prevent access to computational resources. If you are unsure, please
contact FASRC support or the ColdFront system administrator.
{% else %}
To be removed from a lab, the user must not have the lab as their primary
diff --git a/coldfront/core/project/views.py b/coldfront/core/project/views.py
index 6275ef7c52..f32ca095c0 100644
--- a/coldfront/core/project/views.py
+++ b/coldfront/core/project/views.py
@@ -244,7 +244,8 @@ def get_context_data(self, **kwargs):
allocations = allocations.filter(
status__name__in=['Active', 'Paid', 'Ready for Review','Payment Requested']
).distinct().order_by('-end_date')
- storage_allocations = allocations.filter(resources__resource_type__name='Storage').order_by('resources__name')
+ storage_allocations = allocations.filter(
+ resources__resource_type__name='Storage').order_by('resources__name')
compute_allocations = allocations.filter(resources__resource_type__name='Cluster')
allocation_total = {'allocation_user_count': 0, 'size': 0, 'cost': 0, 'usage':0}
for allocation in storage_allocations:
diff --git a/coldfront/plugins/ldap/management/commands/add_projects.py b/coldfront/plugins/ldap/management/commands/add_projects.py
index c546f02c4e..5ef9b11be9 100644
--- a/coldfront/plugins/ldap/management/commands/add_projects.py
+++ b/coldfront/plugins/ldap/management/commands/add_projects.py
@@ -2,7 +2,7 @@
from datetime import datetime
import pandas as pd
-from django.core.management.base import BaseCommand, CommandError
+from django.core.management.base import BaseCommand
from coldfront.plugins.ldap.utils import import_projects_projectusers
diff --git a/coldfront/plugins/ldap/signals.py b/coldfront/plugins/ldap/signals.py
index 6c0504c7c6..28a6e5b816 100644
--- a/coldfront/plugins/ldap/signals.py
+++ b/coldfront/plugins/ldap/signals.py
@@ -1,6 +1,7 @@
import logging
from django.dispatch import receiver
from django.contrib.auth import get_user_model
+from coldfront.core.utils.common import import_from_settings
from coldfront.core.field_of_science.models import FieldOfScience
from coldfront.core.project.signals import (
project_filter_users_to_remove,
diff --git a/coldfront/plugins/ldap/utils.py b/coldfront/plugins/ldap/utils.py
index bbcf6e8878..566fb2cced 100644
--- a/coldfront/plugins/ldap/utils.py
+++ b/coldfront/plugins/ldap/utils.py
@@ -232,7 +232,6 @@ def remove_member_from_group(self, user_name, group_name):
)
result = self.deactivate_user(user['distinguishedName'])
return result
-
try:
result = ad_remove_members_from_groups(
self.conn, [member_dn], group_dn, fix=True, raise_error=True
From 2d922ffae28fb7ff0634aef958aabd3beab8f06c Mon Sep 17 00:00:00 2001
From: Claire Peters
Date: Wed, 17 Dec 2025 16:51:29 -0800
Subject: [PATCH 07/20] reconfigure user removal form creation and templating
---
coldfront/core/project/forms.py | 11 ++-
.../project/project_remove_users.html | 69 ++++++++++---------
coldfront/core/project/views.py | 13 +---
coldfront/plugins/ldap/signals.py | 6 +-
4 files changed, 48 insertions(+), 51 deletions(-)
diff --git a/coldfront/core/project/forms.py b/coldfront/core/project/forms.py
index 3c2c88edd1..fdf0c5168f 100644
--- a/coldfront/core/project/forms.py
+++ b/coldfront/core/project/forms.py
@@ -56,8 +56,14 @@ def __init__(self, request_user, project_pk, *args, **kwargs):
allocation_query_set = project_obj.allocation_set.filter(
resources__is_allocatable=True, is_locked=False, status__name__in=PENDING_ACTIVE_ALLOCATION_STATUSES).distinct()
- allocation_choices = [(allocation.id, "%s (%s) %s" % (allocation.get_parent_resource.name, allocation.get_parent_resource.resource_type.name,
- allocation.description if allocation.description else '')) for allocation in allocation_query_set]
+ allocation_choices = [(
+ allocation.id, "%s (%s) %s" % (
+ allocation.get_parent_resource.name,
+ allocation.get_parent_resource.resource_type.name,
+ allocation.description if allocation.description else ''
+ )
+ ) for allocation in allocation_query_set]
+
allocation_choices_sorted = []
allocation_choices_sorted = sorted(allocation_choices, key=lambda x: x[1][0].lower())
allocation_choices.insert(0, ('__select_all__', 'Select All'))
@@ -74,6 +80,7 @@ class ProjectRemoveUserForm(forms.Form):
last_name = forms.CharField(max_length=150, required=False, disabled=True)
email = forms.EmailField(max_length=100, required=False, disabled=True)
role = forms.CharField(max_length=30, disabled=True)
+ primary_group = forms.BooleanField(required=False, disabled=True)
selected = forms.BooleanField(initial=False, required=False)
diff --git a/coldfront/core/project/templates/project/project_remove_users.html b/coldfront/core/project/templates/project/project_remove_users.html
index 8b86a851fe..3917d87710 100644
--- a/coldfront/core/project/templates/project/project_remove_users.html
+++ b/coldfront/core/project/templates/project/project_remove_users.html
@@ -48,43 +48,44 @@ Remove users from project: {{project.title}}