Skip to content

Commit 8cdf894

Browse files
committed
fix: [#59851] replace or NONE with or ''
This was probably forgotten in a146db5.
1 parent 2777be8 commit 8cdf894

16 files changed

+62
-62
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ More advanced template strings may be constructed, such as:
173173
"objectClass": "user",
174174
"_import_to_mo_": "true",
175175
"given_name": "{{ldap.givenName or ldap.name|splitlast|first}}",
176-
"uuid": "{{ employee_uuid or NONE }}"
176+
"uuid": "{{ employee_uuid or '' }}"
177177
}
178178
}
179179
[...]
@@ -226,7 +226,7 @@ Converting the other way around can be done as follows:
226226
"type": "address",
227227
"validity": "{{ dict(from_date = ldap.mail_validity_from or now()|mo_datestring) }}",
228228
"address_type": "{{ dict(uuid=get_employee_address_type_uuid('EmailEmployee')) }}",
229-
"person": "{{ dict(uuid=employee_uuid or NONE) }}"
229+
"person": "{{ dict(uuid=employee_uuid or '') }}"
230230
},
231231
}
232232
[...]
@@ -278,7 +278,7 @@ And the other way around:
278278
"LocationUnit": {
279279
"objectClass": "ramodels.mo.details.address.Address",
280280
"_import_to_mo_": "true",
281-
"value": "{{ ldap.postalAddress or NONE }}",
281+
"value": "{{ ldap.postalAddress or '' }}",
282282
"type": "address",
283283
"validity": "{{ dict(from_date=now()|mo_datestring) }}",
284284
"address_type": "{{ dict(uuid=get_org_unit_address_type_uuid('LocationUnit')) }}",
@@ -324,7 +324,7 @@ And the other way around:
324324
"user_key": "{{ ldap.msSFU30Name or None }}",
325325
"itsystem": "{{ get_it_system_uuid('Active Directory') }}",
326326
"validity": "{{ dict(from_date=now()|mo_datestring) }}",
327-
"person": "{{ employee_uuid or NONE }}"
327+
"person": "{{ employee_uuid or '' }}"
328328
}
329329
}
330330
[...]
@@ -376,7 +376,7 @@ Converting the other way around can be done like this:
376376
"engagement_type": "{{ dict(uuid=get_engagement_type_uuid(ldap.employeeType)) }}",
377377
"user_key": "{{ ldap.departmentNumber or uuid4() }}",
378378
"validity": "{{ dict(from_date=now()|mo_datestring) }}",
379-
"person": "{{ dict(uuid=employee_uuid or NONE) }}",
379+
"person": "{{ dict(uuid=employee_uuid or '') }}",
380380
"primary": "{{ dict(uuid=get_primary_type_uuid('primary')) }}"
381381
}
382382
}
@@ -493,7 +493,7 @@ And the other way around:
493493
"user_key": "{{ ldap.distinguishedName }}",
494494
"itsystem": "{{ get_it_system_uuid('Active Directory') }}",
495495
"validity": "{{ dict(from_date=now()|mo_datestring) }}",
496-
"person": "{{ employee_uuid or NONE }}"
496+
"person": "{{ employee_uuid or '' }}"
497497
}
498498
}
499499
[...]
@@ -535,7 +535,7 @@ And the other way around:
535535
"objectClass": "ramodels.mo.employee.Employee",
536536
"_import_to_mo_": "true",
537537
"cpr_number": "{{ldap.employeeID|strip_non_digits}}",
538-
"uuid": "{{ employee_uuid or NONE }}"
538+
"uuid": "{{ employee_uuid or '' }}"
539539
[...]
540540
},
541541
}

dev-environment/kolding_fixture.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ ldap_to_mo:
33
objectClass: ramodels.mo.employee.Employee
44
_import_to_mo_: "false"
55
_ldap_attributes_: ["employeeNumber" , "title" , "givenName" , "sn"]
6-
uuid: '{{ employee_uuid or NONE }}'
6+
uuid: '{{ employee_uuid or '''' }}'
77
nickname_given_name: '{{ get_employee_dict(employee_uuid).nickname_given_name }}'
88
nickname_surname: '{{ get_employee_dict(employee_uuid).nickname_surname }}'
9-
cpr_number: '{{ldap.employeeNumber|strip_non_digits or NONE}}'
9+
cpr_number: '{{ldap.employeeNumber|strip_non_digits or ''''}}'
1010
user_key: '{{ ldap.title }}'
1111
given_name: '{{ ldap.givenName }}'
1212
surname: '{{ ldap.sn }}'
@@ -16,15 +16,15 @@ ldap_to_mo:
1616
_ldap_attributes_: ["title"]
1717
user_key: '{{ ldap.title }}'
1818
itsystem: '{{ get_it_system_uuid(''ADtitle'') }}'
19-
person: '{{ employee_uuid or NONE }}'
19+
person: '{{ employee_uuid or '''' }}'
2020
ADUUID:
2121
objectClass: ramodels.mo.details.it_system.ITUser
2222
_import_to_mo_: "true"
2323
_ldap_attributes_: ["title", "entryUUID"]
2424
_terminate_: '{{ now()|mo_datestring if ldap.title == "WOW" else NONE }}'
2525
user_key: '{{ ldap.entryUUID }}'
2626
itsystem: '{{ get_it_system_uuid(''ADUUID'') }}'
27-
person: '{{ employee_uuid or NONE }}'
27+
person: '{{ employee_uuid or '''' }}'
2828
mo2ldap: |
2929
{% set mo_employee = load_mo_employee(uuid, current_objects_only=False) %}
3030
{% set mo_employee_it_user = load_mo_it_user(uuid, "ADUUID") %}

docker-compose.override.addev.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ services:
3131
"objectClass": "ramodels.mo.employee.Employee",
3232
"_import_to_mo_": "true",
3333
"_ldap_attributes_": ["employeeID", "initials"],
34-
"cpr_number": "{{ ldap.employeeID|strip_non_digits or NONE }}",
35-
"uuid": "{{ employee_uuid or NONE }}",
34+
"cpr_number": "{{ ldap.employeeID|strip_non_digits or '' }}",
35+
"uuid": "{{ employee_uuid or '' }}",
3636
"given_name": "{{ get_employee_dict(employee_uuid).given_name }}",
3737
"surname": "{{ get_employee_dict(employee_uuid).surname }}",
3838
"nickname_given_name": "{{ get_employee_dict(employee_uuid).nickname_given_name }}",
@@ -43,7 +43,7 @@ services:
4343
"objectClass": "ramodels.mo.details.engagement.Engagement",
4444
"_import_to_mo_": "true",
4545
"_ldap_attributes_": ["title"],
46-
"person": "{{ employee_uuid or NONE }}",
46+
"person": "{{ employee_uuid or '' }}",
4747
"user_key": "{{ get_primary_engagement_dict(employee_uuid).user_key }}",
4848
"engagement_type": "{{ get_primary_engagement_dict(employee_uuid).engagement_type_uuid }}",
4949
"org_unit": "{{ get_primary_engagement_dict(employee_uuid).org_unit_uuid }}",
@@ -59,7 +59,7 @@ services:
5959
"uuid": "{{ ldap.objectGUID|remove_curly_brackets }}",
6060
"user_key": "{{ ldap.sAMAccountName }}",
6161
"itsystem": "{{ get_it_system_uuid('Active Directory') }}",
62-
"person": "{{ employee_uuid or NONE }}"
62+
"person": "{{ employee_uuid or '' }}"
6363
}
6464
},
6565
"mo_to_ldap": {

docker-compose.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ services:
9797
"givenName",
9898
"sn"
9999
],
100-
"uuid": "{{ employee_uuid or NONE }}",
100+
"uuid": "{{ employee_uuid or '' }}",
101101
"nickname_given_name": "{{ get_employee_dict(employee_uuid).nickname_given_name }}",
102102
"nickname_surname": "{{ get_employee_dict(employee_uuid).nickname_surname }}",
103-
"cpr_number": "{{ldap.employeeNumber|strip_non_digits or NONE}}",
103+
"cpr_number": "{{ldap.employeeNumber|strip_non_digits or ''}}",
104104
"user_key": "{{ ldap.title }}",
105105
"given_name": "{{ ldap.givenName }}",
106106
"surname": "{{ ldap.sn }}"
@@ -113,7 +113,7 @@ services:
113113
],
114114
"user_key": "{{ ldap.title }}",
115115
"itsystem": "{{ get_it_system_uuid('ADtitle') }}",
116-
"person": "{{ employee_uuid or NONE }}"
116+
"person": "{{ employee_uuid or '' }}"
117117
},
118118
"ADUUID": {
119119
"objectClass": "ramodels.mo.details.it_system.ITUser",
@@ -125,7 +125,7 @@ services:
125125
"_terminate_": "{{ now()|mo_datestring if ldap.title == \"WOW\" else NONE }}",
126126
"user_key": "{{ ldap.entryUUID }}",
127127
"itsystem": "{{ get_it_system_uuid('ADUUID') }}",
128-
"person": "{{ employee_uuid or NONE }}"
128+
"person": "{{ employee_uuid or '' }}"
129129
}
130130
},
131131
"mo2ldap": "{% set mo_employee = load_mo_employee(uuid, current_objects_only=False) %}\n{% set mo_employee_it_user = load_mo_it_user(uuid, \"ADUUID\") %}\n\n{{\n {\n \"employeeNumber\": mo_employee.cpr_number,\n \"title\": mo_employee.user_key,\n \"givenName\": mo_employee.given_name,\n \"sn\": mo_employee.surname,\n \"entryUUID\": mo_employee_it_user.user_key,\n }|tojson\n}}\n",

mo_ldap_import_export/converters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async def render_template(field_name: str, template, context) -> Any:
152152
# - {{ldap.mail or None}} renders as "None"
153153
# - {{ldap.mail}} renders as "[]" if ldap.mail is empty
154154
#
155-
# Mapping with {{ldap.mail or NONE}} solves both, but let's check
155+
# Mapping with {{ldap.mail or ''}} solves both, but let's check
156156
# for "none" or "[]" strings anyway to be more robust.
157157
if value.lower() == "none" or value == "[]":
158158
value = ""

tests/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ def integration_test_environment_variables(monkeypatch: pytest.MonkeyPatch) -> N
151151
"objectClass": "ramodels.mo.employee.Employee",
152152
"_import_to_mo_": "false",
153153
"_ldap_attributes_": ["employeeNumber", "title", "givenName", "sn"],
154-
"uuid": "{{ employee_uuid or NONE }}",
155-
"cpr_number": "{{ldap.employeeNumber|strip_non_digits or NONE}}",
154+
"uuid": "{{ employee_uuid or '' }}",
155+
"cpr_number": "{{ldap.employeeNumber|strip_non_digits or ''}}",
156156
"user_key": "{{ ldap.title }}",
157157
"given_name": "{{ ldap.givenName }}",
158158
"surname": "{{ ldap.sn }}",

tests/integration/routes/test_non_existing_unique_ldap_uuids.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
"objectClass": "ramodels.mo.employee.Employee",
2323
"_import_to_mo_": "false",
2424
"_ldap_attributes_": [],
25-
"uuid": "{{ employee_uuid or NONE }}",
25+
"uuid": "{{ employee_uuid or '' }}",
2626
},
2727
"ADUUID": {
2828
"objectClass": "ramodels.mo.details.it_system.ITUser",
2929
"_import_to_mo_": "true",
3030
"_ldap_attributes_": ["entryUUID"],
3131
"user_key": "{{ ldap.entryUUID }}",
3232
"itsystem": "{{ get_it_system_uuid('ADUUID') }}",
33-
"person": "{{ employee_uuid or NONE }}",
33+
"person": "{{ employee_uuid or '' }}",
3434
},
3535
},
3636
"username_generator": {

tests/integration/test_application.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -369,15 +369,15 @@ async def test_changed_since(test_client: AsyncClient, expected: list[str]) -> N
369369
"objectClass": "ramodels.mo.employee.Employee",
370370
"_import_to_mo_": "false",
371371
"_ldap_attributes_": [],
372-
"uuid": "{{ employee_uuid or NONE }}",
372+
"uuid": "{{ employee_uuid or '' }}",
373373
},
374374
"PublicEmailAddress": {
375375
"objectClass": "ramodels.mo.details.address.Address",
376376
"_import_to_mo_": "true",
377377
"_ldap_attributes_": ["mail"],
378-
"value": "{{ ldap.mail or NONE }}",
378+
"value": "{{ ldap.mail or '' }}",
379379
"address_type": "{{ get_employee_address_type_uuid('EmailEmployee') }}",
380-
"person": "{{ employee_uuid or NONE }}",
380+
"person": "{{ employee_uuid or '' }}",
381381
"visibility": "{{ get_visibility_uuid('Public') }}",
382382
},
383383
},
@@ -456,15 +456,15 @@ async def test_mismatched_json_key_and_address_type(
456456
"objectClass": "ramodels.mo.employee.Employee",
457457
"_import_to_mo_": "false",
458458
"_ldap_attributes_": [],
459-
"uuid": "{{ employee_uuid or NONE }}",
459+
"uuid": "{{ employee_uuid or '' }}",
460460
},
461461
"EntryUUID": {
462462
"objectClass": "ramodels.mo.details.it_system.ITUser",
463463
"_import_to_mo_": "true",
464464
"_ldap_attributes_": ["entryUUID"],
465-
"user_key": "{{ ldap.entryUUID or NONE }}",
465+
"user_key": "{{ ldap.entryUUID or '' }}",
466466
"itsystem": "{{ get_it_system_uuid('ADUUID') }}",
467-
"person": "{{ employee_uuid or NONE }}",
467+
"person": "{{ employee_uuid or '' }}",
468468
},
469469
},
470470
"username_generator": {
@@ -540,15 +540,15 @@ async def test_mismatched_json_key_and_itsystem(
540540
"objectClass": "ramodels.mo.employee.Employee",
541541
"_import_to_mo_": "false",
542542
"_ldap_attributes_": [],
543-
"uuid": "{{ employee_uuid or NONE }}",
543+
"uuid": "{{ employee_uuid or '' }}",
544544
},
545545
"DefaultValidity": {
546546
"objectClass": "ramodels.mo.details.it_system.ITUser",
547547
"_import_to_mo_": "true",
548548
"_ldap_attributes_": ["entryUUID"],
549-
"user_key": "{{ ldap.entryUUID or NONE }}",
549+
"user_key": "{{ ldap.entryUUID or '' }}",
550550
"itsystem": "{{ get_it_system_uuid('ADUUID') }}",
551-
"person": "{{ employee_uuid or NONE }}",
551+
"person": "{{ employee_uuid or '' }}",
552552
},
553553
},
554554
"username_generator": {

tests/integration/test_employee.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"_import_to_mo_": "true",
3636
"_ldap_attributes_": ["employeeNumber", "givenName", "sn"],
3737
"_mapper_": "{{ obj.cpr_number }}",
38-
"uuid": "{{ employee_uuid or NONE }}", # TODO: why is this required?
38+
"uuid": "{{ employee_uuid or '' }}", # TODO: why is this required?
3939
"cpr_number": "{{ ldap.employeeNumber }}",
4040
"given_name": "{{ ldap.givenName }}",
4141
"surname": "{{ ldap.sn }}",

tests/integration/test_mapper.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@
2929
"objectClass": "ramodels.mo.employee.Employee",
3030
"_import_to_mo_": "false",
3131
"_ldap_attributes_": [],
32-
"uuid": "{{ employee_uuid or NONE }}",
32+
"uuid": "{{ employee_uuid or '' }}",
3333
},
3434
"PublicPhoneEmployee": {
3535
"objectClass": "ramodels.mo.details.address.Address",
3636
"_import_to_mo_": "true",
3737
"_ldap_attributes_": ["mobile"],
38-
"value": "{{ ldap.mobile or NONE }}",
38+
"value": "{{ ldap.mobile or '' }}",
3939
"address_type": "{{ get_employee_address_type_uuid('PhoneEmployee') }}",
40-
"person": "{{ employee_uuid or NONE }}",
40+
"person": "{{ employee_uuid or '' }}",
4141
"visibility": "{{ get_visibility_uuid('Public') }}",
4242
},
4343
"InternalPhoneEmployee": {
4444
"objectClass": "ramodels.mo.details.address.Address",
4545
"_import_to_mo_": "true",
4646
"_ldap_attributes_": ["pager"],
47-
"value": "{{ ldap.pager or NONE }}",
47+
"value": "{{ ldap.pager or '' }}",
4848
"address_type": "{{ get_employee_address_type_uuid('PhoneEmployee') }}",
49-
"person": "{{ employee_uuid or NONE }}",
49+
"person": "{{ employee_uuid or '' }}",
5050
"visibility": "{{ get_visibility_uuid('Intern') }}",
5151
},
5252
},

tests/test_config.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def address_mapping(minimal_mapping: dict) -> dict:
2929
"objectClass": "ramodels.mo.details.address.Address",
3030
"_import_to_mo_": "true",
3131
"_ldap_attributes_": ["mail"],
32-
"value": "{{ldap.mail or NONE}}",
32+
"value": "{{ldap.mail or ''}}",
3333
"address_type": "{{ get_employee_address_type_uuid('EmailEmployee') }}",
34-
"person": "{{ employee_uuid or NONE }}",
34+
"person": "{{ employee_uuid or '' }}",
3535
}
3636
}
3737
},
@@ -63,7 +63,7 @@ def test_cannot_terminate_employee(minimal_mapping: dict) -> None:
6363
"_ldap_attributes_": ["employeeID"],
6464
"_terminate_": "whatever",
6565
"cpr_number": "{{ldap.employeeID or None}}",
66-
"uuid": "{{ employee_uuid or NONE }}",
66+
"uuid": "{{ employee_uuid or '' }}",
6767
}
6868
}
6969
},
@@ -193,7 +193,7 @@ def test_mapper_settings(monkeypatch: pytest.MonkeyPatch) -> None:
193193
"_import_to_mo_": "false",
194194
"_ldap_attributes_": ["employeeID"],
195195
"cpr_number": "{{ldap.employeeID or None}}",
196-
"uuid": "{{ employee_uuid or NONE }}",
196+
"uuid": "{{ employee_uuid or '' }}",
197197
}
198198
},
199199
"username_generator": {"objectClass": "UserNameGenerator"},
@@ -233,7 +233,7 @@ def test_check_attributes(monkeypatch: pytest.MonkeyPatch) -> None:
233233
"_import_to_mo_": "false",
234234
"_ldap_attributes_": ["employeeID"],
235235
"cpr_number": "{{ldap.employeeID or None}}",
236-
"uuid": "{{ employee_uuid or NONE }}",
236+
"uuid": "{{ employee_uuid or '' }}",
237237
}
238238
},
239239
"username_generator": {"objectClass": "UserNameGenerator"},

0 commit comments

Comments
 (0)