23/04/23 - 19h

master
cherif 2023-04-23 18:33:11 +02:00
parent 2c597c005b
commit 61bd60390e
6 changed files with 1289 additions and 32 deletions

View File

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="20/04/23 - 20h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="22/04/23 - 19h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.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$/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$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -126,7 +127,14 @@
<option name="project" value="LOCAL" />
<updated>1682013957129</updated>
</task>
<option name="localTasksCounter" value="10" />
<task id="LOCAL-00010" summary="22/04/23 - 19h">
<created>1682183786097</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1682183786097</updated>
</task>
<option name="localTasksCounter" value="11" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -149,6 +157,7 @@
<MESSAGE value="15/04/23 - 22h" />
<MESSAGE value="20/04/23 - 16h" />
<MESSAGE value="20/04/23 - 20h" />
<option name="LAST_COMMIT_MESSAGE" value="20/04/23 - 20h" />
<MESSAGE value="22/04/23 - 19h" />
<option name="LAST_COMMIT_MESSAGE" value="22/04/23 - 19h" />
</component>
</project>

View File

@ -310,16 +310,33 @@ if (MYSY_ENV == "PROD"):
MYSY_MARIADB_PORT = 3306
MYSY_LMS_BDD = "mysy_db_chamilo_prod"
MYSY_LMS_URL = ""
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy_prod/"
LMS_BAS_URL = "mysy-training.fr/"
elif (MYSY_ENV == "DEV"):
MYSY_MARIADB_USER = "mysy_mariadb_user"
MYSY_MARIADB_USER_PASS = "fB5z%M)GG&g!n2c"
MYSY_MARIADB_HOST = "192.168.1.21"
MYSY_MARIADB_PORT = 3306
MYSY_LMS_BDD = "chamilo_dev2"
MYSY_LMS_URL = "https://lms.mysy-training.com/"
MYSY_MARIADB_USER = "mysy_mariadb_user"
MYSY_MARIADB_USER_PASS = "fB5z%M)GG&g!n2c"
#MYSY_MARIADB_HOST = "192.168.1.21"
MYSY_MARIADB_HOST = "88.170.110.220"
MYSY_MARIADB_PORT = 3306
MYSY_LMS_BDD = "chamilo_dev2"
MYSY_LMS_URL = "https://lms.mysy-training.com/"
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy/"
LMS_BAS_URL = "mysy-training.fr/"
""" DEV OUTSIDE network
elif (MYSY_ENV == "DEV"):
MYSY_MARIADB_USER = "mysy_mariadb_user"
MYSY_MARIADB_USER_PASS = "fB5z%M)GG&g!n2c"
MYSY_MARIADB_HOST = "88.170.110.220"
MYSY_MARIADB_PORT = 3306
MYSY_LMS_BDD = "mysy_db_chamilo_rec"
MYSY_LMS_URL = "https://reclms.mysy-training.com/"
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy_rec/"
LMS_BAS_URL = "rec.mysy-training.fr/"
"""
elif (MYSY_ENV == "REC"):
@ -329,6 +346,8 @@ elif (MYSY_ENV == "REC"):
MYSY_MARIADB_PORT = 3306
MYSY_LMS_BDD = "mysy_db_chamilo_rec"
MYSY_LMS_URL = "https://reclms.mysy-training.com/"
MYSY_LMS_BASE_DIRECTORY = "/var/www/html/chamilo_mysy_rec/"
LMS_BAS_URL = "rec.mysy-training.fr/"
@ -338,13 +357,6 @@ Variable pour definir les unité de durée acceptées pour une formation
CLASS_DURATION_UNIT = ['heure', 'jour', 'mois', 'annee']
"""
Cette variable est le l'url de base pour le lms.
cette valeur est utilisée pour la creation des url du lms
"""
LMS_BAS_URL = "mysy-training.fr/"
"""
Varibale definit la taille maximiale des repertoire à créer par mysy
"""

File diff suppressed because one or more lines are too long

View File

@ -2117,7 +2117,7 @@ def LMS_Create_VirtualHost(diction):
"""
lms_prefixe_url = ''.join(filter(str.isalnum, part_nom))
lms_prefixe_url = str(lms_prefixe_url)[0:10]
lms_prefixe_url = str(str(lms_prefixe_url)[0:10]).lower()
if(len(lms_prefixe_url) < 3 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - le lms_prefixe_url est trop court. Le nom du client comporte moins de 3 caractères alphanumerique")
@ -2136,7 +2136,8 @@ def LMS_Create_VirtualHost(diction):
cur = conn.cursor()
# Verification d'abord si l'url existe.
query_compte_exist = " Select count(*), url From access_url WHERE url LIKE '%" + lms_prefixe_url + ".%' "
local_full_url = str(lms_prefixe_url)+"."+str(MYSY_GV.LMS_BAS_URL)
query_compte_exist = " Select count(*), url From access_url WHERE url = '" + local_full_url + "' "
print(" ### query_compte_exist = ", query_compte_exist)
query_compte_exist_exec = cur.execute(query_compte_exist)
@ -2383,10 +2384,10 @@ def Lms_Config_Theme_and_Logo(diction):
if (int(mycommon.tryInt(lms_count_courses_val)) <= 0):
print(" ### le partenaire "+str(my_partner['nom'])+" n'as pas de config dans la 'settings_current' il faut en créer ")
qry_add_update_setting = " INSERT INTO settings_current " \
"SET variable = 'stylesheets', subkey = 'textfield', " \
"SET variable = 'stylesheets', subkey = 'textfield', title = 'vchamilo', " \
"category = 'stylesheets', selected_value = '"+str(new_theme_name)+"'," \
" access_url = '"+str(lms_virtualhost_id)+"', access_url_changeable = '1', " \
"access_url_locked = 'access_url_locked'; "
"access_url_locked = '0'; "
print(" ### qry_add_setting = ", qry_add_update_setting)
else:
print(" ### le partenaire " + str(
@ -2490,10 +2491,10 @@ def Duplicate_LMS_Theme_Design(diction):
return False, " Impossible de dupliquer le theme "
commands = [
"rm -rf /var/www/html/chamilo_mysy/web/css/themes/"+str(new_theme_name),
"rm -rf /var/www/html/chamilo_mysy/app/Resources/public/css/themes/"+str(new_theme_name),
"cp -rf /var/www/html/chamilo_mysy/web/css/themes/"+str(original_theme_name)+" /var/www/html/chamilo_mysy/web/css/themes/"+str(new_theme_name),
"cp -rf /var/www/html/chamilo_mysy/app/Resources/public/css/themes/"+str(original_theme_name)+" /var/www/html/chamilo_mysy/app/Resources/public/css/themes/"+str(new_theme_name),
"rm -rf "+str(MYSY_GV.MYSY_LMS_BASE_DIRECTORY)+"web/css/themes/"+str(new_theme_name),
"rm -rf "+str(MYSY_GV.MYSY_LMS_BASE_DIRECTORY)+"app/Resources/public/css/themes/"+str(new_theme_name),
"cp -rf "+str(MYSY_GV.MYSY_LMS_BASE_DIRECTORY)+"web/css/themes/"+str(original_theme_name)+" "+str(MYSY_GV.MYSY_LMS_BASE_DIRECTORY)+"web/css/themes/"+str(new_theme_name),
"cp -rf "+str(MYSY_GV.MYSY_LMS_BASE_DIRECTORY)+"app/Resources/public/css/themes/"+str(original_theme_name)+" "+str(MYSY_GV.MYSY_LMS_BASE_DIRECTORY)+"app/Resources/public/css/themes/"+str(new_theme_name),
]
print(" ### Les commandes à executé pr dupliquer ", commands)

View File

@ -2886,6 +2886,7 @@ if __name__ == '__main__':
mycommon.myprint("++ DATABASE "+MYSY_GV.CONNECTION_STRING+" ++")
mycommon.myprint("++ DBNAME " + str(MYSY_GV.dbname) + " ++")
mycommon.myprint("++ FLASK PORT " + str(MYSY_GV.MYSY_PORT_PROD) + " ++")
mycommon.myprint("++ LMS_BAS_URL " + str(MYSY_GV.LMS_BAS_URL) + " ++")
app.run(host='localhost', port=MYSY_GV.MYSY_PORT_PROD, debug=True, threaded=True)
elif (MYSY_GV.MYSY_ENV == "DEV"):
@ -2893,6 +2894,7 @@ if __name__ == '__main__':
mycommon.myprint("++ DATABASE " + MYSY_GV.CONNECTION_STRING + " ++")
mycommon.myprint("++ DBNAME " + str(MYSY_GV.dbname) + " ++")
mycommon.myprint("++ FLASK PORT " + str(MYSY_GV.MYSY_PORT_DEV) + " ++")
mycommon.myprint("++ LMS_BAS_URL " + str(MYSY_GV.LMS_BAS_URL) + " ++")
app.run(host='localhost', port=MYSY_GV.MYSY_PORT_DEV, debug=True, threaded=True)
elif (MYSY_GV.MYSY_ENV == "REC"):
@ -2900,6 +2902,7 @@ if __name__ == '__main__':
mycommon.myprint("++ DATABASE " + MYSY_GV.CONNECTION_STRING + " ++")
mycommon.myprint("++ DBNAME " + str(MYSY_GV.dbname) + " ++")
mycommon.myprint("++ FLASK PORT " + str(MYSY_GV.MYSY_PORT_REC) + " ++")
mycommon.myprint("++ LMS_BAS_URL " + str(MYSY_GV.LMS_BAS_URL) + " ++")
app.run(host='localhost', port=MYSY_GV.MYSY_PORT_REC, debug=True, threaded=True)

View File

@ -980,7 +980,7 @@ def partner_login(diction):
for val in incom_keys:
if str(val).lower() not in str(field_list).lower():
mycommon.myprint(str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas accepté dans cette API")
return False, " Impossible de se connecter"
return False, str(inspect.stack()[0][3]) + " Toutes les informations obligatoires ne sont pas fournies"
'''
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
@ -990,7 +990,7 @@ def partner_login(diction):
for val in field_list_obligatoire:
if str(val).lower() not in diction:
mycommon.myprint(str(inspect.stack()[0][3]) + " La valeur '" + val + "' n'est pas presente dans liste des champs")
return False, "Impossible de se connecter"
return False, str(inspect.stack()[0][3]) + " Toutes les informations obligatoires ne sont pas fournies (2) "
mydata={}
@ -1041,20 +1041,20 @@ def partner_login(diction):
if ret_val2 and ret_val2['_id']:
mycommon.myprint(str(inspect.stack()[0][3]) + " Connexion partener_token : OK , _id = " + str(ret_val2['_id']))
else:
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible d'enregistrer le token du partenare dans partener_token ")
return False, " Impossible de se connecter"
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible d'enregistrer le token du partenaire dans partener_token ")
return False, " Impossible de se connecter. Une erreur technique est survenue. Merci de contacter votre administrateur"
return True, partner_key_secrete_key
else:
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de se connecter - Partner ")
return False, " Impossible de se connecter"
mycommon.myprint(str(inspect.stack()[0][3]) + " Les identifiants fournis (login et/ou mot de passe) sont incorrects")
return False, " Les identifiants fournis (login et/ou mot de passe) sont incorrects"
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de connecter le partenaire"
return False, " Impossible de se connecter au système. Merci de contacter votre administrateur "
"""