|
14 | 14 |
|
15 | 15 | SPAWNER_SUBMIT_DATA = '1' |
16 | 16 | LDAP_SEARCH_ATTRIBUTE_QUERY = '2' |
17 | | -SPAWNER_USER_STATE = '3' |
| 17 | +SPAWNER_ATTR = '3' |
18 | 18 | DYNAMIC_ATTRIBUTE_METHODS = (SPAWNER_SUBMIT_DATA, |
19 | 19 | LDAP_SEARCH_ATTRIBUTE_QUERY, |
20 | | - SPAWNER_USER_STATE) |
| 20 | + SPAWNER_ATTR) |
21 | 21 |
|
22 | 22 | INCREMENT_ATTRIBUTE = '1' |
23 | 23 | SEARCH_RESULT_OPERATION_ACTIONS = (INCREMENT_ATTRIBUTE,) |
@@ -360,10 +360,10 @@ def get_interpolated_dynamic_attributes(logger, sources, dynamic_attributes): |
360 | 360 | and sources[SPAWNER_SUBMIT_DATA]: |
361 | 361 | val = get_dict_key(sources[SPAWNER_SUBMIT_DATA], |
362 | 362 | attr_key) |
363 | | - if attr_val == SPAWNER_USER_STATE: |
364 | | - if SPAWNER_USER_STATE in sources \ |
365 | | - and sources[SPAWNER_USER_STATE]: |
366 | | - val = get_dict_key(sources[SPAWNER_USER_STATE], |
| 363 | + if attr_val == SPAWNER_ATTR: |
| 364 | + if SPAWNER_ATTR in sources \ |
| 365 | + and sources[SPAWNER_ATTR]: |
| 366 | + val = rec_get_attr(sources[SPAWNER_ATTR], |
367 | 367 | attr_key) |
368 | 368 | if not val: |
369 | 369 | logger.error("LDAP - Missing {} in {} which is required for {} in" |
@@ -578,7 +578,7 @@ def setup_ldap_entry_hook(spawner): |
578 | 578 | # Extract attributes from existing object |
579 | 579 | sources = {LDAP_SEARCH_ATTRIBUTE_QUERY: attributes, |
580 | 580 | SPAWNER_SUBMIT_DATA: ldap_dict, |
581 | | - SPAWNER_USER_STATE: spawner.user} |
| 581 | + SPAWNER_ATTR: spawner} |
582 | 582 | spawner.log.debug("LDAP - dynamic_attributes " |
583 | 583 | "pre interpolated: {}".format( |
584 | 584 | instance.dynamic_attributes |
@@ -659,7 +659,7 @@ def setup_ldap_entry_hook(spawner): |
659 | 659 |
|
660 | 660 | # Prepare required dynamic attributes |
661 | 661 | sources.update({SPAWNER_SUBMIT_DATA: ldap_dict, |
662 | | - SPAWNER_USER_STATE: spawner.user}) |
| 662 | + SPAWNER_ATTR: spawner}) |
663 | 663 | spawner.log.debug("LDAP - Sources state before interpolating with " |
664 | 664 | " dynamic attributes {}".format(sources)) |
665 | 665 | prepared_dynamic_attributes = get_interpolated_dynamic_attributes( |
|
0 commit comments