25/07/23 - 21h
parent
1b3261802b
commit
be5201fea5
|
@ -1,11 +1,13 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="23/07/2023 - 21h">
|
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="24/07/23 - 17h">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -69,13 +71,6 @@
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1680804787304</updated>
|
<updated>1680804787304</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="07/04/23 - 9h">
|
|
||||||
<created>1680853322615</created>
|
|
||||||
<option name="number" value="00001" />
|
|
||||||
<option name="presentableId" value="LOCAL-00001" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1680853322615</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00002" summary="07/04/23 - 9h">
|
<task id="LOCAL-00002" summary="07/04/23 - 9h">
|
||||||
<created>1680853542130</created>
|
<created>1680853542130</created>
|
||||||
<option name="number" value="00002" />
|
<option name="number" value="00002" />
|
||||||
|
@ -412,7 +407,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1690141881201</updated>
|
<updated>1690141881201</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="50" />
|
<task id="LOCAL-00050" summary="24/07/23 - 17h">
|
||||||
|
<created>1690214062664</created>
|
||||||
|
<option name="number" value="00050" />
|
||||||
|
<option name="presentableId" value="LOCAL-00050" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1690214062664</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="51" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
@ -427,7 +429,6 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="22/05/23 - 23h" />
|
|
||||||
<MESSAGE value="23/05/23 - 23h" />
|
<MESSAGE value="23/05/23 - 23h" />
|
||||||
<MESSAGE value="25/05/23 - 17h" />
|
<MESSAGE value="25/05/23 - 17h" />
|
||||||
<MESSAGE value="28/05/23 - 15h" />
|
<MESSAGE value="28/05/23 - 15h" />
|
||||||
|
@ -452,6 +453,7 @@
|
||||||
<MESSAGE value="16/07/23 - 22h" />
|
<MESSAGE value="16/07/23 - 22h" />
|
||||||
<MESSAGE value="22/07/2023 - 17h" />
|
<MESSAGE value="22/07/2023 - 17h" />
|
||||||
<MESSAGE value="23/07/2023 - 21h" />
|
<MESSAGE value="23/07/2023 - 21h" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="23/07/2023 - 21h" />
|
<MESSAGE value="24/07/23 - 17h" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="24/07/23 - 17h" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
2360
Log/log_file.log
2360
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -2070,9 +2070,9 @@ def ManualSendInvoiceEmailRIB_PortCities(diction):
|
||||||
"montant": "14 400 €",
|
"montant": "14 400 €",
|
||||||
|
|
||||||
|
|
||||||
"invoice_id": "FACT_230700032",
|
"invoice_id": "FACT_230800033",
|
||||||
"invoice_date": "01/07/2023",
|
"invoice_date": "01/08/2023",
|
||||||
"due_date": "01/07/2023",
|
"due_date": "01/08/2023",
|
||||||
"orign_order": "Contrat N°0010G",
|
"orign_order": "Contrat N°0010G",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2106,7 +2106,7 @@ def ManualSendInvoiceEmailRIB_PortCities(diction):
|
||||||
#print(" ### body 22 = ", body)
|
#print(" ### body 22 = ", body)
|
||||||
|
|
||||||
sourceHtml = template.render(json_data=body["params"])
|
sourceHtml = template.render(json_data=body["params"])
|
||||||
orig_file_name = "invoice_FACT_230600031.pdf"
|
orig_file_name = "invoice_FACT_230700033.pdf"
|
||||||
outputFilename = str(MYSY_GV.INVOICE_DIRECTORY) + str(orig_file_name)
|
outputFilename = str(MYSY_GV.INVOICE_DIRECTORY) + str(orig_file_name)
|
||||||
|
|
||||||
# open output file for writing (truncated binary)
|
# open output file for writing (truncated binary)
|
||||||
|
|
|
@ -679,8 +679,6 @@ def Disable_MySy_LMS_User(diction):
|
||||||
# Recuperation des formation de cet utilisateur
|
# Recuperation des formation de cet utilisateur
|
||||||
cur.execute("SELECT c_id FROM course_rel_user WHERE user_id="+str(lms_user_id))
|
cur.execute("SELECT c_id FROM course_rel_user WHERE user_id="+str(lms_user_id))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for course_id in cur:
|
for course_id in cur:
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Desactivation de la formation_id = " + str(course_id)+" ")
|
mycommon.myprint(str(inspect.stack()[0][3]) + " Desactivation de la formation_id = " + str(course_id)+" ")
|
||||||
# Desactivation du compte dans chamilo
|
# Desactivation du compte dans chamilo
|
||||||
|
@ -699,8 +697,6 @@ def Disable_MySy_LMS_User(diction):
|
||||||
|
|
||||||
# Desactivation des formations créées par ce compte utilisateur
|
# Desactivation des formations créées par ce compte utilisateur
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
return True, " Le compte a été correctement desactive"
|
return True, " Le compte a été correctement desactive"
|
||||||
|
@ -3390,3 +3386,214 @@ def Unpublish_Class_From_Lms(diction):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Cette fonction permet de créer et mettre à jour une formation dans le MySy LMS
|
||||||
|
/!\ : Depuis MySy Search, on a un tag qui dit "pushed_lms", "date_pushed_lms", "date_updated_pushed_lms"
|
||||||
|
Si le champ "pushed_lms" est à "1" alors la formation, alors la formation deja ete poussé, c'est une mise à jour à faire.
|
||||||
|
|
||||||
|
Liste des controle :
|
||||||
|
1 - Verifier que le code_formation n'existe pas sur un scope global
|
||||||
|
2 - Verifier qu'une formation avec le meme titre n'existe pas, sur un scope du partenaire.
|
||||||
|
3 - Apres la creation de la formation dans MySy LMS, stocker le l'id de la formation dans MySy Search
|
||||||
|
4 - Pousser les mise à jours sur les champs : "description", "pourqui", etc..
|
||||||
|
|
||||||
|
"""
|
||||||
|
def Push_Class_To_MySy_LMS(diction):
|
||||||
|
try:
|
||||||
|
|
||||||
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', "class_internal_url",]
|
||||||
|
|
||||||
|
incom_keys = diction.keys()
|
||||||
|
for val in incom_keys:
|
||||||
|
if val not in field_list:
|
||||||
|
mycommon.myprint(str(
|
||||||
|
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||||
|
return False, " Les informations fournies sont incorrectes",
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des champs obligatoires
|
||||||
|
"""
|
||||||
|
field_list_obligatoire = ['token', "class_internal_url",]
|
||||||
|
|
||||||
|
for val in field_list_obligatoire:
|
||||||
|
if val not in diction:
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||||
|
return False, " Les informations fournies sont incorrectes",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||||
|
if( local_status is not True):
|
||||||
|
return local_status, my_partner
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Connexion à la base de données du LMS
|
||||||
|
"""
|
||||||
|
conn = mariadb.connect(
|
||||||
|
user=MYSY_GV.MYSY_MARIADB_USER,
|
||||||
|
password=MYSY_GV.MYSY_MARIADB_USER_PASS,
|
||||||
|
host=MYSY_GV.MYSY_MARIADB_HOST,
|
||||||
|
port=MYSY_GV.MYSY_MARIADB_PORT,
|
||||||
|
database=MYSY_GV.MYSY_LMS_BDD
|
||||||
|
)
|
||||||
|
cur = conn.cursor()
|
||||||
|
|
||||||
|
# Recuperation des codes de formation qui exite dans le LMS
|
||||||
|
query = "select title, code from course "
|
||||||
|
print(" ### query = ", query)
|
||||||
|
cur.execute(query)
|
||||||
|
|
||||||
|
for cours_title_and_code in cur:
|
||||||
|
print(" ### cours = ", cours_title_and_code)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verifier que le user qui poste la formation ( my_partner['mysy_lms_user_id'])
|
||||||
|
existe et qu'il a bien le droit dans le LMS
|
||||||
|
"""
|
||||||
|
|
||||||
|
mysy_lms_user_id = ""
|
||||||
|
if ("mysy_lms_user_id" in my_partner.keys()):
|
||||||
|
if( my_partner['mysy_lms_user_id']):
|
||||||
|
mysy_lms_user_id = my_partner['mysy_lms_user_id']
|
||||||
|
|
||||||
|
if( str(mysy_lms_user_id) == ""):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - Vous n'avez pas les droits nécessaires pour publier une formation dans le LMS ")
|
||||||
|
return False, " - Vous n'avez pas les droits nécessaires pour publier une formation dans le LMS ",
|
||||||
|
|
||||||
|
query = "select count(*), user_id from user where user_id = '"+str(mysy_lms_user_id)+"' and active = '1' and enabled = '1' and locked = '0' and expired = '0' "
|
||||||
|
print(" ### query user where user_id = ", query)
|
||||||
|
cur.execute(query)
|
||||||
|
|
||||||
|
lms_user_info_data = {}
|
||||||
|
for query_compte_exist_exec in cur:
|
||||||
|
query_compte_exist_exec_val = query_compte_exist_exec[0]
|
||||||
|
if (int(mycommon.tryInt(query_compte_exist_exec_val)) != 1):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][
|
||||||
|
3]) + " - Vous n'avez pas les droits nécessaires pour publier une formation dans le LMS (2)")
|
||||||
|
return False, " - Vous n'avez pas les droits nécessaires pour publier une formation dans le LMS (2) ",
|
||||||
|
|
||||||
|
lms_user_info_data['user_id'] = query_compte_exist_exec[1]
|
||||||
|
|
||||||
|
"""
|
||||||
|
Recuperation des champs de MySy Search (collection : myclass)
|
||||||
|
: title, description, objectif, prerequis, pourqui, programme, plus_produit
|
||||||
|
"""
|
||||||
|
Class_To_Push = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(diction['class_internal_url']),
|
||||||
|
'valide':'1', 'locked':'0'})
|
||||||
|
if( Class_To_Push is None ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - La formation '" + str(diction['class_internal_url']) + "' n'est pas valide ")
|
||||||
|
return False, "- La formation '" + str(diction['class_internal_url']) + "' n'est pas valide ",
|
||||||
|
|
||||||
|
|
||||||
|
# Verifier que les champs obligatoires pour la creation dans le LMS sont bien presents dans le Search
|
||||||
|
champ_oblig_pr_publication = ['description', 'objectif', 'prerequis', 'pourqui', 'programme', 'plus_produit']
|
||||||
|
for local_val in champ_oblig_pr_publication:
|
||||||
|
if( local_val not in Class_To_Push.keys() ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - Le champ "+str(local_val)+" de la formation '" + str(diction['class_internal_url']) + "' n'est pas valide ")
|
||||||
|
return False, " - Le champ "+str(local_val)+" de la formation '" + str(diction['class_internal_url']) + "' n'est pas valide ",
|
||||||
|
|
||||||
|
|
||||||
|
update_push = False
|
||||||
|
|
||||||
|
# Verifier si la formation a un code 'LMS', au quel cas, on fait des mises à jour coté LMS
|
||||||
|
lms_class_code = ""
|
||||||
|
if ("lms_class_code" in Class_To_Push.keys()):
|
||||||
|
lms_class_code = Class_To_Push['lms_class_id']
|
||||||
|
update_push = True
|
||||||
|
|
||||||
|
|
||||||
|
# Si le lms_class_code est vide, alors cette formation n'a jamais ete pushé dans le LMS, on le créé le code
|
||||||
|
if( str(lms_class_code) == ""):
|
||||||
|
lms_class_code= mycommon.create_user_recid()[0:10]
|
||||||
|
|
||||||
|
data_to_push = {}
|
||||||
|
data_to_push['lms_class_code'] = lms_class_code
|
||||||
|
data_to_push['title'] = Class_To_Push['title']
|
||||||
|
data_to_push['description'] = Class_To_Push['description']
|
||||||
|
data_to_push['objectif'] = Class_To_Push['objectif']
|
||||||
|
data_to_push['prerequis'] = Class_To_Push['prerequis']
|
||||||
|
data_to_push['pourqui'] = Class_To_Push['pourqui']
|
||||||
|
data_to_push['programme'] = Class_To_Push['programme']
|
||||||
|
data_to_push['internal_url'] = Class_To_Push['internal_url']
|
||||||
|
data_to_push['plus_produit'] = Class_To_Push['plus_produit']
|
||||||
|
data_to_push['mysy_lms_user_id'] = my_partner['mysy_lms_user_id']
|
||||||
|
data_to_push['lms_virtualhost_id'] = my_partner['lms_virtualhost_id']
|
||||||
|
|
||||||
|
query_insert_class = ""
|
||||||
|
if( update_push is False):
|
||||||
|
# C'est une insertion qu'il faut faire
|
||||||
|
print(" ### on fait un push initial")
|
||||||
|
query_insert_class = "INSERT INTO course SET code='"+str( data_to_push['lms_class_code'] )+"' , " \
|
||||||
|
"visibility='2'," \
|
||||||
|
"title = '"+str(data_to_push['title'])+"', " \
|
||||||
|
"directory = '"+str( data_to_push['lms_class_code'] )+"', " \
|
||||||
|
"course_language = 'french', " \
|
||||||
|
"disk_quota = '100000000', " \
|
||||||
|
"subscribe = '1', " \
|
||||||
|
"description='" + str( data_to_push['title']) + "', " \
|
||||||
|
"creation_date ='" + str(datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + "', " \
|
||||||
|
"internal_url = '"+str(data_to_push['internal_url'])+"'," \
|
||||||
|
" visual_code = '"+str( data_to_push['lms_class_code'] )+"';" \
|
||||||
|
|
||||||
|
print(" #### query_insert_class = ", query_insert_class)
|
||||||
|
try:
|
||||||
|
cur.execute(query_insert_class)
|
||||||
|
|
||||||
|
|
||||||
|
except mariadb.Error as e:
|
||||||
|
# print(f"Error: {e}")
|
||||||
|
mycommon.myprint(" Impossible de créer la formation dans le LMS " + str({e}))
|
||||||
|
return False, " Impossible de créer la formation dans le LMS " + str({e})
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
print(" #### Last Inserted ID = ", cur.lastrowid)
|
||||||
|
new_class_id = str(cur.lastrowid)
|
||||||
|
|
||||||
|
|
||||||
|
query_access_url_rel_course = " INSERT INTO access_url_rel_course (c_id,access_url_id) VALUES ('"+str(new_class_id)+"', '1') " #, ('"+str(new_class_id)+"', '"+ str( data_to_push['lms_virtualhost_id']) +"')) "
|
||||||
|
print(" #### query_access_url_rel_course = ", query_access_url_rel_course)
|
||||||
|
try:
|
||||||
|
cur.execute(query_access_url_rel_course)
|
||||||
|
|
||||||
|
except mariadb.Error as e:
|
||||||
|
# print(f"Error: {e}")
|
||||||
|
mycommon.myprint(" Impossible de créer la formation dans le LMS (1)" + str({e}))
|
||||||
|
return False, " Impossible de créer la formation dans le LMS (1) " + str({e})
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
|
||||||
|
query_course_rel_user = "insert into course_rel_user set user_id='"+ str( data_to_push['mysy_lms_user_id']) +"', c_id='" +str(new_class_id)+ "' , relation_type = '3', status = '3', is_tutor = '3'"
|
||||||
|
|
||||||
|
print(" #### query_course_rel_user = ", query_course_rel_user)
|
||||||
|
try:
|
||||||
|
cur.execute(query_course_rel_user)
|
||||||
|
|
||||||
|
except mariadb.Error as e:
|
||||||
|
# print(f"Error: {e}")
|
||||||
|
mycommon.myprint(" Impossible de créer la formation dans le LMS (2)" + str({e}))
|
||||||
|
return False, " Impossible de créer la formation dans le LMS (2) " + str({e})
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return True, " La formation " + str(lms_class_code) + "a été correctement Ajoutée/Mise à jour sur la plateforme de E-Learning"
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
|
return False, " Impossible de mettre à jour la formation sur la plateforme de E-Learning "
|
||||||
|
|
12
main.py
12
main.py
|
@ -3406,6 +3406,18 @@ def Get_Given_Activite():
|
||||||
return jsonify(status=localStatus, message=message)
|
return jsonify(status=localStatus, message=message)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Cette API permet de publier/mettre à jour une formation
|
||||||
|
du LMS Search vers MySy LMS
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Push_Class_To_MySy_LMS/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Push_Class_To_MySy_LMS():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Push_Class_To_MySy_LMS : payload = ",payload)
|
||||||
|
localStatus, message = mysy_lms.Push_Class_To_MySy_LMS(payload)
|
||||||
|
return jsonify(status=localStatus, message=message)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -3100,4 +3100,43 @@ def isEmailValide(email):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Cette fonction verifie la validé d'un token et retour :
|
||||||
|
- Une erreur de connexion ou
|
||||||
|
- Si tout est ok, le partner associé à ce token
|
||||||
|
"""
|
||||||
|
def Check_Connexion_And_Return_Partner_Data(diction):
|
||||||
|
try:
|
||||||
|
|
||||||
|
token = ""
|
||||||
|
if ("token" in diction.keys()):
|
||||||
|
if diction['token']:
|
||||||
|
token = diction['token']
|
||||||
|
|
||||||
|
# Verifier la validité du token
|
||||||
|
retval = check_partner_token_validity("", token)
|
||||||
|
|
||||||
|
if retval is False:
|
||||||
|
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||||
|
|
||||||
|
partner_recid = get_parnter_recid_from_token(token)
|
||||||
|
if (partner_recid is False):
|
||||||
|
myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - partner_recid est KO. Les données de connexion sont incorrectes ")
|
||||||
|
return False, " Vous n'etes pas autorisé à utiliser cette API "
|
||||||
|
|
||||||
|
# Recuperation des données du partenaire
|
||||||
|
local_status, my_partner = get_partner_data_from_recid(partner_recid)
|
||||||
|
if (local_status is False):
|
||||||
|
myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire")
|
||||||
|
return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire. "
|
||||||
|
|
||||||
|
return True, my_partner
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
|
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||||
|
return False, " Impossible de verifier la connexion"
|
Loading…
Reference in New Issue