def user_to_dict(self, user: us.User): dict_formatted = {} if user: dict_formatted['user_id'] = user.get_userID() dict_formatted['first_name'] = user.get_first_name() dict_formatted['last_name'] = user.get_last_name() dict_formatted['admin'] = str(user.get_admin()) dict_formatted['business_unit'] = user.get_business_unit() dict_formatted['email'] = user.get_email() dict_formatted['password'] = "******" dict_formatted['access_rights_pillars'] = json.dumps( user.get_access_rights_pillars()) dict_formatted['role_manager'] = user.get_role_manager() return dict_formatted
def insert_user_db(self, user: us.User): local = False access_rights_pillars = json.dumps(user.get_access_rights_pillars()) access_rights_pillars = access_rights_pillars.replace('"', "'") # Creates Table db_utils.DataBaseUtils.execute_sql( db_utils.DataBaseUtils, sql_statement=sql_stmt.DataBaseSQL. create_User_table_sql(sql_stmt.DataBaseSQL), local=local) # Inserts data db_utils.DataBaseUtils.execute_sql(db_utils.DataBaseUtils, sql_statement=sql_stmt.DataBaseSQL. insert_user_values( sql_stmt.DataBaseSQL, userID=user.get_userID(), first_name=user.get_first_name(), last_name=user.get_last_name(), email=user.get_email(), password=user.get_password(), business_unit=user.get_business_unit(), access_rights_pillars=access_rights_pillars, admin=user.get_admin(), role_manager=user.get_role_manager()), local=local)