linotp.lib.tools.import_user.SQLImportHandler module

import user into an SQL Resolver

  • define the table

  • import the users

  • define the resolver

class linotp.lib.tools.import_user.SQLImportHandler.DatabaseContext

Bases: object

with the database context ist is possible to drive the “user import” from the shell and from within LinOTP

exception linotp.lib.tools.import_user.SQLImportHandler.DuplicateUserError

Bases: Exception

class linotp.lib.tools.import_user.SQLImportHandler.LinOTP_DatabaseContext(SqlSession, SqlEngine)

Bases: DatabaseContext

the linotp database context - - recieve the current session and engine

define_resolver(params)

native define the resolver - in the LinOTP context, we can use the internal function to define

the resolver

Parameters

params – dict with the resolver parameter

get_session()

encapsulate the access to the session, which is different for the different context

Returns

database session

class linotp.lib.tools.import_user.SQLImportHandler.SQLImportHandler(groupid, resolver_name, database_context)

Bases: ImportHandler

the SQLResolverContext will be used to import the users into an sql table and creates an SQL Resolver for the access to the imported users

add(user)

add user to the database session

Parameters

user – the user with the new values

close()

external steps called from the UserImport during the finalization

commit()

external steps called from the UserImport - within this step the resolver is created

delete_by_id(user_id)

delete the user from the database

Parameters

user_id – the uniqe identifiert of the user

get_resolver_spec()
Returns

return resolver spec for insert in a realm

lookup(user)

the lookup is called during the user import, to look for an already existing user

Parameters

user – the user with the new values

prepare()

external steps called from the UserImport

for the sqlresolverc import context the following steps are made: - create the table for the users - prepare the list of allready available users for this groupid - create the database session context

rollback()

external steps called from the UserImport in case of an error

update(former_user, user)

update a user and add it to the databases session

Parameters
  • former_user – the user identified by the database

  • user – the user with the new values

class linotp.lib.tools.import_user.SQLImportHandler.Shell_DatabaseContext(sql_url)

Bases: DatabaseContext

the shell database context - - use the sql url to process the import of the users

define_resolver(params)

native define the resolver - in the Shell context, this could be done by an http request to linotp

  • currently not implemented

Parameters

params – dict with the resolver parameter

get_session()

encapsulate the access to the session, which is different for the different context