Bug 48803 - http-api school-import should validate school from input with configuration / UI-chosen
http-api school-import should validate school from input with configuration /...
Status: RESOLVED WONTFIX
Product: UCS@school
Classification: Unclassified
Component: HTTP-API (Kelvin)
UCS@school 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on: 45715
Blocks:
  Show dependency treegraph
 
Reported: 2019-02-27 12:33 CET by Daniel Tröder
Modified: 2023-06-23 13:15 CEST (History)
0 users

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2019-02-27 12:33:18 CET
The UCS@school should forbid trying to import a user, when in the CSV a column "school" exists and its contents are not identical to config[school] (which is set from what was chose in the UMC).

Currently the import fails with a misleading error message:

----------------------------------------------------------------------------
2019-02-27 12:03:12 INFO  user_import.create_and_modify_users:189  Adding ImportStudent(name='kaan.gerkens', school='v6fslgbck'
, dn='uid=kaan.gerkens,cn=schueler,cn=users,ou=v6fslgbck,dc=uni,dc=dtr', old_dn=None) (source_uid:qkowf76es9gu-student record_u
id:Kaan.Gerkens) attributes: {'$dn$': 'uid=kaan.gerkens,cn=schueler,cn=users,ou=v6fslgbck,dc=uni,dc=dtr', 'action': 'A', 'birth
day': None, 'disabled': '0', 'display_name': u'Kaan Gerkens', 'email': u'', 'entry_count': 2L, 'firstname': u'Kaan', 'in_hook':
 False, 'input_data': ['v6fslgbck', 'Gerkens', '+81-970-174586', 'A student.', 'Kaan', 'v6fslgbck-1a', ''], 'lastname': u'Gerke
ns', 'name': 'kaan.gerkens', 'objectType': 'users/user', 'old_user': None, 'password': 'xxGRNy79FX:TJ6n', 'record_uid': u'Kaan.
Gerkens', 'roles': ['pupil'], 'school': 'v6fslgbck', 'school_classes': {u'qkowf76es9gu': ['qkowf76es9gu-v6fslgbck-1a']}, 'schoo
ls': ['v6fslgbck'], 'source_uid': u'qkowf76es9gu-student', 'type': 'importStudent', 'type_name': 'Student', 'ucsschool_roles': 
['student:school:v6fslgbck'], 'udm_properties': {u'phone': [u'+81-970-174586'], 'overridePWHistory': '1', u'description': u'A s
tudent.', 'overridePWLength': '1'}}...
----------------------------------------------------------------------------
ValidationError when adding ImportStudent(name='kaan.gerkens', school='v6fslgbck', dn='uid=kaan.gerkens,cn=schueler,cn=users,ou=v6fslgbck,dc=uni,dc=dtr', old_dn=None) (source_uid:qkowf76es9gu-student record_uid: Kaan.Gerkens): {'school_classes': ["School u'qkowf76es9gu' in 'school_classes' is missing in the users 'school(s)' attributes."]} 
----------------------------------------------------------------------------

The school is prepended to the school_class → 'qkowf76es9gu-v6fslgbck-1a' and then it complains about the school missing in the users 'schools' attribute.
It is good that at fails, but it should fail for the right reason, and earlier.
This should already be detected in a dry-run.
Not sure if the fix should be in HttpApiCsvReader or at a later stage.
Comment 1 Jan-Luca Kiok univentionstaff 2023-06-23 13:15:26 CEST
This issue has been filed against UCS 4.4.

UCS 4.4 is out of maintenance and UCS components may have vastly changed in later releases. Thus, this issue is now being closed.

If this issue still occurs in newer UCS versions, please use "Clone this bug" or reopen this issue. In this case please provide detailed information on how this issue is affecting you.