Problem: ASM Upload Fails When a User Has More Than 14 Schools

Problem

Our ASM Connector fails when generating the CSV file for a staff member assigned to multiple schools. Specifically, if a staff member is configured as a substitute and assigned to around 20 schools, the script aborts with the following error:

AssertionError: No more than 14 additional locations are allowed.
ASM upload failed, see /var/log/univention/asm.log

The script currently enforces a limit of 14 additional school locations per staff member, which prevents the CSV generation for staff members assigned to more than 14 locations.


Root Cause

The issue arises from a hard-coded limitation in the ASM Python module. In the file /usr/lib/python3/dist-packages/univention/asm/models/staff.py, the code currently asserts:

assert len(additional_location_ids) < 15, "No more than 14 additional locations are allowed."

This restriction does not align with Apple’s documentation. While Apple has not officially documented a change to this limit, an undated support article suggests a much higher limit:

Apple Support: Assign multiple locations

According to this resource, staff members can be assigned up to 999 locations, making the current limit in the ASM Connector outdated.

A bug report has been created to align the ASM Connector with the updated Apple limit:
UCS Bugzilla Report #58988


Solution

To resolve this issue, you need to update the Python assertion in the staff.py file to allow more locations. Edit line 109 in /usr/lib/python3/dist-packages/univention/asm/models/staff.py as follows:

if additional_location_ids:
    assert len(additional_location_ids) < 999, "No more than 999 additional locations are allowed."
else:

This topic was automatically closed after 24 hours. New replies are no longer allowed.