Compare commits
7 Commits
cd4447cdc4
...
840220e42d
| Author | SHA1 | Date |
|---|---|---|
|
|
840220e42d | |
|
|
599250a8f3 | |
|
|
3f0e8e0a24 | |
|
|
b71ae26a44 | |
|
|
58a5172ff9 | |
|
|
5fa727d25b | |
|
|
e3e84c35e7 |
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
.cat.pkl
|
||||||
|
.DS_Store
|
||||||
|
Data/mailbox-13a.csv
|
||||||
|
Data/mailbox-14.csv
|
||||||
|
Data/users-13a.csv
|
||||||
|
Data/users-14.csv
|
||||||
|
namen.txt
|
||||||
|
|
@ -0,0 +1,178 @@
|
||||||
|
Abend
|
||||||
|
Abendrot
|
||||||
|
Aldebaran
|
||||||
|
Allianz
|
||||||
|
Analyse
|
||||||
|
Angebot
|
||||||
|
Antwort
|
||||||
|
Aufgabe
|
||||||
|
Auftakt
|
||||||
|
Augenstern
|
||||||
|
Augenweide
|
||||||
|
Ausgleich
|
||||||
|
Bahnhof
|
||||||
|
Basis
|
||||||
|
Bedeutung
|
||||||
|
Begegnung
|
||||||
|
Beispiel
|
||||||
|
Beitrag
|
||||||
|
Beratung
|
||||||
|
Berufung
|
||||||
|
Bewegung
|
||||||
|
Blickfang
|
||||||
|
Butterblume
|
||||||
|
Borgelicht
|
||||||
|
Chance
|
||||||
|
Charakter
|
||||||
|
Chiffon
|
||||||
|
Denken
|
||||||
|
Dialog
|
||||||
|
Dutzend
|
||||||
|
Ebene
|
||||||
|
Einheit
|
||||||
|
Einigung
|
||||||
|
Energie
|
||||||
|
Farbe
|
||||||
|
Farbenfroh
|
||||||
|
Fernweh
|
||||||
|
Feuervogel
|
||||||
|
Firlefanz
|
||||||
|
Firmament
|
||||||
|
Forschung
|
||||||
|
Freiheit
|
||||||
|
Freude
|
||||||
|
Frieden
|
||||||
|
Fusion
|
||||||
|
Galerie
|
||||||
|
Garten
|
||||||
|
Gedanke
|
||||||
|
Gedanken
|
||||||
|
Gegenwart
|
||||||
|
Geist
|
||||||
|
Gestalt
|
||||||
|
Haltung
|
||||||
|
Heimat
|
||||||
|
Heimelig
|
||||||
|
Herbst
|
||||||
|
Herzlich
|
||||||
|
Himmel
|
||||||
|
Himmelsblau
|
||||||
|
Hoffnung
|
||||||
|
Insel
|
||||||
|
Interesse
|
||||||
|
Jahrzehnt
|
||||||
|
Jenseits
|
||||||
|
Joghurt
|
||||||
|
Jubel
|
||||||
|
Kamera
|
||||||
|
Karte
|
||||||
|
Kenntnis
|
||||||
|
Kleinod
|
||||||
|
Konzert
|
||||||
|
Kraft
|
||||||
|
Kultur
|
||||||
|
Kunst
|
||||||
|
Labsal
|
||||||
|
Lebenslust
|
||||||
|
Lehre
|
||||||
|
Libelle
|
||||||
|
Licht
|
||||||
|
Lichtblick
|
||||||
|
Lichtspiel
|
||||||
|
Liebe
|
||||||
|
Literatur
|
||||||
|
Lobhudeln
|
||||||
|
Luftikus
|
||||||
|
Luftschlange
|
||||||
|
Luftschloss
|
||||||
|
Medium
|
||||||
|
Meister
|
||||||
|
Mondschein
|
||||||
|
Morgenstern
|
||||||
|
Morgentau
|
||||||
|
Mummenschanz
|
||||||
|
Museum
|
||||||
|
Nachbar
|
||||||
|
Nacht
|
||||||
|
Naschkatze
|
||||||
|
Naseweis
|
||||||
|
Natur
|
||||||
|
Nordstern
|
||||||
|
Ofenwarm
|
||||||
|
Ohrenschmaus
|
||||||
|
Ohrwurm
|
||||||
|
Ordnung
|
||||||
|
Ostwind
|
||||||
|
Pflege
|
||||||
|
Plauderei
|
||||||
|
Prinzip
|
||||||
|
Purzelbaum
|
||||||
|
Pusteblume
|
||||||
|
Pustekuchen
|
||||||
|
Quasar
|
||||||
|
Quelle
|
||||||
|
Quitte
|
||||||
|
Rebell
|
||||||
|
Reform
|
||||||
|
Regenbogen
|
||||||
|
Richtung
|
||||||
|
Runde
|
||||||
|
Sammlung
|
||||||
|
Samtpfote
|
||||||
|
Sandkasten
|
||||||
|
Sandstein
|
||||||
|
Saumselig
|
||||||
|
Schatten
|
||||||
|
Schlummern
|
||||||
|
Schmollmund
|
||||||
|
Schutz
|
||||||
|
Seele
|
||||||
|
Sektlaune
|
||||||
|
Sommer
|
||||||
|
Sommerfrische
|
||||||
|
Sonne
|
||||||
|
Sperenzchen
|
||||||
|
Spiegel
|
||||||
|
Spielen
|
||||||
|
Sprache
|
||||||
|
Steckenpferd
|
||||||
|
Sternenzelt
|
||||||
|
Sternschnuppe
|
||||||
|
Sternstunde
|
||||||
|
Stimmung
|
||||||
|
Stubentiger
|
||||||
|
Szene
|
||||||
|
Tagtraum
|
||||||
|
Teilhabe
|
||||||
|
Tendenz
|
||||||
|
Theater
|
||||||
|
Tollpatsch
|
||||||
|
Tradition
|
||||||
|
Traum
|
||||||
|
Ukulele
|
||||||
|
Umwelt
|
||||||
|
Unsinn
|
||||||
|
Variante
|
||||||
|
Vertrauen
|
||||||
|
Vollmond
|
||||||
|
Vorfreude
|
||||||
|
Vorschlag
|
||||||
|
Waffel
|
||||||
|
Wahrheit
|
||||||
|
Wanderlust
|
||||||
|
Wildwasser
|
||||||
|
Wintertag
|
||||||
|
Wissen
|
||||||
|
Wundervoll
|
||||||
|
Wunschtraum
|
||||||
|
Xenon
|
||||||
|
Xenophil
|
||||||
|
Xylophon
|
||||||
|
Yacht
|
||||||
|
Yttrium
|
||||||
|
Yucca
|
||||||
|
Zeichen
|
||||||
|
Zeitlos
|
||||||
|
Zeitpunkt
|
||||||
|
Zeitraum
|
||||||
|
Zwielicht
|
||||||
|
|
@ -1,38 +1,62 @@
|
||||||
# Generate import file
|
# Generate Userlist
|
||||||
|
#
|
||||||
|
# Rev 1.1, 10/22/22
|
||||||
|
# - changed the -y (year of enrolement) parameter to a more general -s (suffix)
|
||||||
|
# - updated the usage message to include that change
|
||||||
|
# - added a lot of comments, especially regarding the default values
|
||||||
|
# - removed the unused fileinput import
|
||||||
|
# - changed the defaults to fit more common scenarios
|
||||||
|
# Rev 1.0, 10/20/22
|
||||||
|
# - a simple script to generate CSV-files suitable as input
|
||||||
|
# for the importUsers script.
|
||||||
|
# - this script is rather specifically designed to accomodate
|
||||||
|
# the needs of our school's user naming scheme. Different
|
||||||
|
# naming schemes should be easy to implement though.
|
||||||
|
# - the script generates default passwords by picking three
|
||||||
|
# words from a file called WordList.txt living in the same
|
||||||
|
# directory as the script file.
|
||||||
|
# Options
|
||||||
|
# -d,--domain: domain name for the email address, this is required
|
||||||
|
# -g,--groups: comma-separated list of groups added to every user
|
||||||
|
# -s,--suffix: added to every username and the resulting filename
|
||||||
|
# in this release, the suffix is added to the last group name as well
|
||||||
|
# -f,--file: file of usernames, first and last name separated by comma
|
||||||
|
|
||||||
import sys, getopt
|
import sys, getopt
|
||||||
import csv
|
import csv
|
||||||
import os,io
|
import os,io
|
||||||
import fileinput
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
wordList = open("WordList.txt").read().splitlines()
|
wordList = open("WordList.txt").read().splitlines()
|
||||||
groups = "Schueler"
|
# add some default values for the options
|
||||||
yoe = "00"
|
groups = "Users" # add default groups for all imports here
|
||||||
domainname="hd.waldorf.one"
|
suffix = ""
|
||||||
|
domainname="example.com"
|
||||||
filename = "names.csv"
|
filename = "names.csv"
|
||||||
|
# next is a list of characters common in users actual names but unsuitable for login names
|
||||||
|
# for this script, those are specific to german names. Spaces get replaced with dashes.
|
||||||
|
char_map = {ord("ä"):"ae", ord("ü"):"ue", ord("ö"):"oe", ord("ß"):"ss", ord(" "):"-"}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv,"hg:d:y:f:",["help","groups=","domain=","year=","file="])
|
opts, args = getopt.getopt(argv,"hg:d:s:f:",["help","groups=","domain=","suffix=","file="])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
print("Usage: importUsers.py -d <domainname> [-g <groups>] [-y <year of enrollment]> -f <datafile>")
|
print("Usage: importUsers.py -d <domainname> [-g <groups>] [-s <common suffix for this import]> -f <datafile>")
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
for opt, arg in opts:
|
for opt, arg in opts:
|
||||||
if opt == '-h':
|
if opt == '-h':
|
||||||
print("Usage: importUsers.py -d <domainname> [-g <groups>] -y <year of enrollment> -f <datafile> ")
|
print("Usage: importUsers.py -d <domainname> [-g <groups>] -s <common suffix for this import> -f <datafile> ")
|
||||||
elif opt in ('-d', '--domain'):
|
elif opt in ('-d', '--domain'):
|
||||||
domainname = arg
|
domainname = arg
|
||||||
elif opt in ('-g', '--groups'):
|
elif opt in ('-g', '--groups'):
|
||||||
groups = groups + "," + arg
|
groups = groups + "," + arg # as per importUsers specs, the groups are comma-separated
|
||||||
elif opt in ('-f', '--file'):
|
elif opt in ('-f', '--file'):
|
||||||
filename = arg
|
filename = arg
|
||||||
elif opt in ('-y', '--year'):
|
elif opt in ('-s', '--suffix'):
|
||||||
yoe = arg
|
suffix = arg
|
||||||
groups = groups + ",schueler-hd-" + yoe
|
groups = groups + suffix
|
||||||
|
|
||||||
outputFileName = "users_" + yoe + ".csv"
|
outputFileName = "users" + suffix + ".csv"
|
||||||
char_map = {ord("ä"):"ae", ord("ü"):"ue", ord("ö"):"oe", ord("ß"):"ss", ord(" "):"-"}
|
|
||||||
with open(outputFileName,"w+",newline='') as outputFile:
|
with open(outputFileName,"w+",newline='') as outputFile:
|
||||||
header = ["first_name","last_name","email_address","sis_username","user_groups","password"]
|
header = ["first_name","last_name","email_address","sis_username","user_groups","password"]
|
||||||
writer = csv.DictWriter(outputFile,fieldnames=header,delimiter=";", quoting=csv.QUOTE_MINIMAL)
|
writer = csv.DictWriter(outputFile,fieldnames=header,delimiter=";", quoting=csv.QUOTE_MINIMAL)
|
||||||
|
|
@ -40,9 +64,9 @@ def main(argv):
|
||||||
users = open(filename,"r").read().splitlines()
|
users = open(filename,"r").read().splitlines()
|
||||||
for user in users:
|
for user in users:
|
||||||
first_name,last_name = tuple(user.split(","))
|
first_name,last_name = tuple(user.split(","))
|
||||||
username = first_name.casefold().translate(char_map) + "." + last_name.casefold().translate(char_map) + "-" + yoe
|
username = first_name.casefold().translate(char_map) + "." + last_name.casefold().translate(char_map) + suffix
|
||||||
address = username + "@" + domainname
|
address = username + "@" + domainname
|
||||||
password = "-".join(random.sample(wordList,3))
|
password = "-".join(random.sample(wordList,3)) # pick three words at ramdom, join them with a dash
|
||||||
writer.writerow({"first_name":first_name,"last_name":last_name,"email_address":address,"sis_username":username,"user_groups":groups,"password":password})
|
writer.writerow({"first_name":first_name,"last_name":last_name,"email_address":address,"sis_username":username,"user_groups":groups,"password":password})
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue