Add support for user correction

When user_id changes, the obsoleted association between old user_id
and emails needs to be corrected. This is done by extending user profile
update method to apply user corrections from `corrections.json`

Related-Bug: #1634020
Change-Id: I580826afbdc2322555a22b12f80b15a0ef3167fb
This commit is contained in:
Yujun Zhang
2017-01-28 21:04:15 +08:00
parent 96ec7c6c63
commit bac722a749
6 changed files with 97 additions and 5 deletions

View File

@@ -262,6 +262,14 @@ def apply_corrections(uri, runtime_storage_inst):
LOG.warning('Correction misses primary key: %s', c)
runtime_storage_inst.apply_corrections(valid_corrections)
valid_user_corrections = []
for u in corrections['user_corrections']:
if 'user_id' in u:
valid_user_corrections.append(c)
else:
LOG.warning('User correction misses user_id: %s', u)
runtime_storage_inst.apply_user_corrections(valid_user_corrections)
def process_project_list(runtime_storage_inst):
module_groups = runtime_storage_inst.get_by_key('module_groups') or {}