linotp.lib.tools.import_user package

import user tool -

import a csv file of users

if called from within LinOTP

import linotp.model.meta Session = linotp.model.meta.Session Engine = meta.engine

class linotp.lib.tools.import_user.DefaultFormatReader

Bases: FormatReader

delimiter = ','
classmethod prepare_row(row)
quotechar = '"'
class linotp.lib.tools.import_user.FormatReader

Bases: object

support for special csv formats

class linotp.lib.tools.import_user.PasswdFormatReader

Bases: FormatReader

delimiter = ':'
classmethod prepare_row(row)
quotechar = '"'
class linotp.lib.tools.import_user.UserImport(ImportHandler)

Bases: object

get_users_from_data(csv_data, format_reader, passwords_in_plaintext=False, hash_passwords=False)

for each row - iterate over all available database columns and - check if there is a column for this in the csv data

and add the group identifier

Params hash_passwords

if true the plaintext passwords will be hashed upon reading

import_csv_users(csv_data, dryrun=False, format_reader=<class 'linotp.lib.tools.import_user.DefaultFormatReader'>, passwords_in_plaintext=False)

insert and update users

update of users is done in 2 steps

  1. get a list of all former stored userid

  2. insert all csv data, either update or create

  3. all former entries, which have not been update, will be removed

set_mapping(mapping)
linotp.lib.tools.import_user.main()