#NEWLINE# def _get_user_tenants_roles_by_db( self , tenant_list , user_list ) : #NEWLINE# #INDENT# user_tenants_roles = { u . name . lower ( ) : { t . name . lower ( ) : [ ] for t in tenant_list } for u in user_list } #NEWLINE# tenant_ids = { tenant . id : tenant . name . lower ( ) for tenant in tenant_list } #NEWLINE# user_ids = { user . id : user . name . lower ( ) for user in user_list } #NEWLINE# roles = { r . id : r for r in self . get_roles_list ( ) } #NEWLINE# for ( user_id , tenant_id , roles_field ) in self . _get_roles_sql_request ( ) : #NEWLINE# #INDENT# if ( ( user_id not in user_ids ) or ( tenant_id not in tenant_ids ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# roles_ids = ast . literal_eval ( roles_field ) [ 'roles' ] #NEWLINE# db_version = self . get_db_version ( ) #NEWLINE# if ( 29 <= db_version <= 38 ) : #NEWLINE# #INDENT# _roles_ids = [ role_id . get ( 'id' ) for role_id in roles_ids ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _roles_ids = roles_ids #NEWLINE# #UNINDENT# user_tenants_roles [ user_ids [ user_id ] ] [ tenant_ids [ tenant_id ] ] = [ { #NEWLINE# #INDENT# 'role' : { #NEWLINE# #INDENT# 'name' : roles [ r ] . name , #NEWLINE# 'id' : r , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } for r in _roles_ids ] #NEWLINE# #UNINDENT# return user_tenants_roles