Skip to content

Commit 32f5816

Browse files
authored
waiting users table also needs to support email w/ burnettk (sartography#2382)
Co-authored-by: jasquat <jasquat@users.noreply.github.com>
1 parent 11c4dff commit 32f5816

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

spiffworkflow-backend/src/spiffworkflow_backend/services/user_service.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,11 @@ def add_waiting_group_assignment(
157157
@classmethod
158158
def apply_waiting_group_assignments(cls, user: UserModel) -> None:
159159
"""Only called from create_user which is normally called at sign-in time"""
160-
waiting = UserGroupAssignmentWaitingModel().query.filter(UserGroupAssignmentWaitingModel.username == user.username).all()
160+
waiting = (
161+
UserGroupAssignmentWaitingModel()
162+
.query.filter(UserGroupAssignmentWaitingModel.username.in_([user.username, user.email])) # type: ignore
163+
.all()
164+
)
161165
for assignment in waiting:
162166
cls.add_user_to_group(user, assignment.group)
163167
db.session.delete(assignment)
@@ -167,7 +171,9 @@ def apply_waiting_group_assignments(cls, user: UserModel) -> None:
167171
.all()
168172
)
169173
for wildcard in wildcards:
170-
if re.match(wildcard.pattern_from_wildcard_username(), user.username):
174+
if re.match(wildcard.pattern_from_wildcard_username(), user.username) or (
175+
user.email and re.match(wildcard.pattern_from_wildcard_username(), user.email)
176+
):
171177
cls.add_user_to_group(user, wildcard.group)
172178
db.session.commit()
173179

0 commit comments

Comments
 (0)