#NEWLINE# def _deploy_users( self , users , tenants ) : #NEWLINE# #INDENT# dst_users = { user . name . lower ( ) : user . id for user in self . get_users_list ( ) } #NEWLINE# tenant_mapped_ids = { tenant [ 'tenant' ] [ 'id' ] : tenant [ 'meta' ] [ 'new_id' ] for tenant in tenants } #NEWLINE# keep_passwd = self . config [ 'migrate' ] [ 'keep_user_passwords' ] #NEWLINE# overwrite_passwd = self . config [ 'migrate' ] [ 'overwrite_user_passwords' ] #NEWLINE# for _user in users : #NEWLINE# #INDENT# user = _user [ 'user' ] #NEWLINE# password = self . _generate_password ( ) #NEWLINE# if ( user [ 'name' ] . lower ( ) in dst_users ) : #NEWLINE# #INDENT# _user [ 'meta' ] [ 'new_id' ] = dst_users [ user [ 'name' ] . lower ( ) ] #NEWLINE# if ( overwrite_passwd and ( not keep_passwd ) ) : #NEWLINE# #INDENT# self . update_user ( _user [ 'meta' ] [ 'new_id' ] , password = password ) #NEWLINE# self . _passwd_notification ( user [ 'email' ] , user [ 'name' ] , password ) #NEWLINE# #UNINDENT# continue #NEWLINE# #UNINDENT# if ( not self . config . migrate . migrate_users ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# tenant_id = tenant_mapped_ids [ user [ 'tenantId' ] ] #NEWLINE# _user [ 'meta' ] [ 'new_id' ] = self . create_user ( user [ 'name' ] , password , user [ 'email' ] , tenant_id ) . id #NEWLINE# if self . config [ 'migrate' ] [ 'keep_user_passwords' ] : #NEWLINE# #INDENT# _user [ 'meta' ] [ 'overwrite_password' ] = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _passwd_notification ( user [ 'email' ] , user [ 'name' ] , password )