Skip to content

Commit 9080d6f

Browse files
committed
Merge remote-tracking branch 'origin/master' into edge
2 parents ca85884 + 052994f commit 9080d6f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

mig/shared/gdp/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,10 +3204,12 @@ def create_project_user(
32043204
mig_user_dict['comment'] = "GDP autocreated user for project: %r" \
32053205
% project_name
32063206
mig_user_dict['openid_names'] = aliases
3207+
# Blank out the remaining fields not to copy from main user
32073208
mig_user_dict['auth'] = ['']
32083209
mig_user_dict['short_id'] = ''
32093210
mig_user_dict['old_password'] = ''
32103211
mig_user_dict['password'] = ''
3212+
mig_user_dict['unique_id'] = ''
32113213
mig_user_db_path = default_db_path(configuration)
32123214
try:
32133215
create_user(mig_user_dict, configuration.config_file,

mig/shared/useradm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,8 @@ def create_user_in_db(configuration, db_path, client_id, user, now, authorized,
667667
openid_names.append(short_id)
668668
add_names = []
669669

670+
# TODO: should GDP project users actually get their OWN unique_id, too?
671+
# They inadvertently copied the main user unique_id for a while.
670672
# NOTE: careful to skip GDP project users in openid and unique_id setup
671673
if not configuration.site_enable_gdp or \
672674
not is_gdp_user(configuration, client_id):
@@ -675,9 +677,11 @@ def create_user_in_db(configuration, db_path, client_id, user, now, authorized,
675677
add_names.append(user[configuration.user_openid_alias])
676678

677679
# Make sure unique_id is really unique in user DB
680+
# Explicitly skip GDP users to avoid stale leftovers (see TODO above)
678681
all_unique = [i['unique_id'] for (_, i) in user_db.items() if
679682
i.get('unique_id', None) and
680-
i['distinguished_name'] != client_id]
683+
i['distinguished_name'] != client_id and
684+
not is_gdp_user(configuration, i['distinguished_name'])]
681685
found_unique = False
682686
for _ in range(4):
683687
user['unique_id'] = user.get('unique_id', False)

0 commit comments

Comments
 (0)