Q&A: Do you have an example configuration for ucs@school csv import

Question:

Do you have an example configuration for ucs@school csv import.

If you have already read the specific documentation for the import you may want an example of a user_import.json.

Answer:

Now here is one:

  • Example-csv :
Schulen,Passwort,Vorname,Nachname,Klassen,Mailadresse,phone,id,src
SchuleLena,univentionunivention,fruchtendeLe,fruchtendeLe,SchuleLena-1H,f.fruchtle@schulen.ucs,"",0303,1
  • With the fitting configuration-file (/var/lib/ucs-school-import/configs/user_import.json):
{  "csv": {
                "allowed_missing_columns": [],
                "header_lines": 1,
                "incell-delimiter": {
                        "default": ","
                },
                "mapping": {
                        "Schulen": "schools",
                        "Passwort": "password",
                        "Vorname": "firstname",
                        "Nachname": "lastname",
                        "Klassen": "school_classes",
                        "phone": "phone",
                        "id": "record_uid",
                        "src": "source_uid"
                }
        },
        "maildomain": "schulen.ucs",
        "scheme": {
                "username": {
                        "default": "<:umlauts><firstname>[0].<lastname><:lower>[COUNTER2]"
                },
                "email": "<:umlauts><firstname>[0].<lastname><:lower>[COUNTER2]@<maildomain>"
        },
        "password_length": 8
}

As often asked: Currently, there is no way to influence the password characters used when the importer creates them. Only the length is adjustable

If you want to strip the usernames like 5 character from the firstname and 5 character from the lastname you can adjust that like this:
"students": "<firstname:umlauts>[:5].<lastname:umlauts>[:5]<:lower>[CONUTER2]"

Explanation:

[0] → is exactly the first character
[:5] →5 characters counted from the beginning
[3:] → starts with the 3 character

You can check the configuration with this command:

python -c "from ucsschool.importer.utils.shell import *"