Bug 47073 - [4.2] The user role should be configurable in the CSV file
[4.2] The user role should be configurable in the CSV file
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.1 R2
Other Linux
: P5 normal (vote)
: UCS@school 4.2 v10
Assigned To: Daniel Tröder
Ole Schwiegert
:
Depends on: 42416
Blocks:
  Show dependency treegraph
 
Reported: 2018-05-24 20:03 CEST by Daniel Tröder
Modified: 2018-07-04 18:07 CEST (History)
6 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 2: Improvement: Would be a product improvement
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.046
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Cleanup
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 2018-05-24 20:03:18 CEST
Merge to UCS@school 4.2.


+++ This bug was initially created as a clone of Bug #42416 +++

Currently the user role can only be defined in the CSV file if using the:
ucsschool.importer.reader.test_csv_reader.TestCsvReader

With a mapping of to a private property:
"Benutzertyp": "__type",

This should be easier!
Comment 1 Daniel Tröder univentionstaff 2018-05-24 20:13:59 CEST
New user role assignment can now be handled by the regular CSV reader class CsvReader. This allows the use of the special mapping value "__role".
Allowed values in the CSV column are student, staff, teacher and teacher_and_staff.
The use of the TestCsvReader class is no longer required. For backwards compatibility the class still exists and allows to use "__type".

[4.2] 58e4b029 Bug #47073: move handling of special mapping value for user role to regular CsvReader
[4.2] aca07bc5 Bug #47073: adapt tests to use the new special mapping value in the regular CsvReader
[4.2] 12c08953 Bug #47073: changelog
[4.2] 6d10cc82 Bug #47073: advisory

ucs-school-import (15.0.3-39)
ucs-test-ucsschool (4.0.4-89)
Comment 3 Ole Schwiegert univentionstaff 2018-06-26 10:18:33 CEST
changelog OK
Advisory OK
Documentation OK
Import with __role mapping OK
Import wit __role and --user_role REOP

When you import a csv with a __role mapping but also use the --user_role option the import crashes with a noObject exception if there is at least one row in the CSV that does not have the role specified in the command line parameter.

This is because the created object got the role specified in the CSV but was expected to have the role specified in --user_role. The documentation states that the command line parameter should not be used if a __role attribute is present but the import should not just crash.

In my opinion there should also be a clear rule for what option gets priority.

I added the csv and the resulting log as attachements to the bug. The command used was:

/usr/share/ucs-school-import/scripts/ucs-school-user-import --conffile /var/lib/ucs-school-import/configs/user_import.json --infile test.csv --school AE

For the files please check Bug #42416
Comment 4 Ole Schwiegert univentionstaff 2018-06-26 10:32:43 CEST
I forgot to add a remark about the documentation: In line 984 of ucsschool-import-handbuch-4.2.xml:

Der Inhalt dieser Spalte wird ignoriert. Die kann z.B. verwendet werden, wenn die CSV-Datei leerer Spalten, oder solche mit nicht zu importierenden Daten, enthält.

What does 'Die' refer to. The Sonderwerte from the beginning of the chapter?
I guess it should be 'leere Spalten'

This sentence is a bit hard to grasp in my opinion because of the "Die" and since it was already edited here it might be fixed here as well.
Comment 5 Daniel Tröder univentionstaff 2018-06-28 10:31:44 CEST
Reasoning see Bug #42416 comment11.

[4.2] b5068016a Bug #47073: prevent running forbidden configuration combination
[4.2] 56d17f156 Bug #47073: changelog
[4.2] 379e52beb Bug #47073: advisory update

ucs-school-import (15.0.3-60)
Comment 6 Ole Schwiegert univentionstaff 2018-06-28 12:59:27 CEST
changelog OK
Advisory OK
Documentation OK
Import with __role mapping OK
Import wit __role and --user_role OK
Comment 7 Sönke Schwardt-Krummrich univentionstaff 2018-07-04 18:07:55 CEST
UCS@school 4.2 v10 has been released.

https://docs.software-univention.de/changelog-ucsschool-4.2v10-de.html

If this error occurs again, please clone this bug.