Skip to content
Snippets Groups Projects
Verified Commit 11721a55 authored by Thorsten Roßner's avatar Thorsten Roßner
Browse files

feat: Add organisation for list import, fix bugs.

parent 040e0ba5
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,8 @@ class ImportUser:
'Nachname': 'lastname',
'Anrede': 'title',
'Passwort': 'password',
'Gruppen': 'groups'
'LDAP-Gruppen': 'groups',
'Organisationseinheit': 'organisation'
}
persons = pd.read_excel(self.input_file, engine='odf', skiprows=self.skip_rows)
persons.rename(columns=self.columnnames_map, inplace=True)
......@@ -38,7 +39,8 @@ class ImportUser:
sys.exit("! Found errors, please fix and rerun the script")
for _, person in persons.iterrows():
person['organisation'] = person['email'].rpartition('@')[-1]
if 'organisation' not in person or not pd.isna(person['organisation']):
person['organisation'] = person['email'].rpartition('@')[-1]
person['is_admin'] = False
callback(person)
if create_admins:
......
......@@ -9,6 +9,7 @@ import time
import datetime
import urllib.parse
import logging
import pandas as pd
from pathlib import Path
from requests.auth import HTTPBasicAuth
......@@ -60,7 +61,7 @@ class Ucs:
sys.exit(response.text)
def __add_property(self, person, key, list = False):
if key in person:
if key in person and not pd.isna(person[key]):
if list == True:
self.create_user_json["properties"][key] = [person[key]]
else:
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.