Skip to content

Custom attributes in extension-config not being applied? #362

Closed
@christopher-b

Description

@christopher-b

I'm using some logic in extension-config.yml to override user's email and domain in certain cases, but it appears that users are still being created with keys using the default domain.

Many of our users have multiple email addresses, but we want to default to student email addresses when they exist. These are stored in a custom AD attribute OCADstudentEmail. I have the following after_mapping_hook in my config:

  student_email = source_attributes.get('OCADstudentEmail')
  if student_email is not None:
    target_attributes['email'] = student_email
    target_attributes['domain'] = student_email.split("@")[1]
  print(source_attributes)
  print(target_attributes)

Which gives the following output (filtered to a single user):

> ./user-sync -c config/user-sync-config.yml -t --user-filter user123
...
2018-06-13 12:26:03 351 INFO processor - ---------- Start Load from Directory -----------------------
{'email': 'user123@faculty.ocadu.ca', 'identity_type': None, 'username': 'user123', 'domain': None, 'givenName': 'User', 'sn': '123', 'c': 'CA', 'OCADstudentEmail': 'user123@student.ocadu.ca'}
{'email': 'user123@student.ocadu.ca', 'username': 'user123', 'domain': 'student.ocadu.ca', 'firstname': 'User', 'lastname': '123', 'country': 'CA'}
2018-06-13 12:26:05 351 INFO processor - ---------- End Load from Directory (Total time: 0:00:01) ---
2018-06-13 12:26:05 351 INFO processor - ---------- Start Sync with UMAPI ---------------------------
2018-06-13 12:26:07 351 INFO processor - Creating user with user key: federatedID,user123,faculty.ocadu.ca
...

Notice that the user key still references the faculty domain. Am I doing something wrong? Is overriding the domain this way not supported? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions