parent
7caee47abf
commit
1cf583de78
|
|
@ -4,15 +4,16 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="27/06/26 - 18hs">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="30/06/26 - 20h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -456,7 +457,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="603" />
|
||||
<option name="localTasksCounter" value="604" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -498,7 +499,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="11/05/2026 -22h" />
|
||||
<MESSAGE value="qsd" />
|
||||
<MESSAGE value="13/05/26 - 17h" />
|
||||
<MESSAGE value="15/05/2026 - 17h30" />
|
||||
|
|
@ -523,6 +523,7 @@
|
|||
<MESSAGE value="26/06/26 - 18h" />
|
||||
<MESSAGE value="27/06/26 - 18h" />
|
||||
<MESSAGE value="27/06/26 - 18hs" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="27/06/26 - 18hs" />
|
||||
<MESSAGE value="30/06/26 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="30/06/26 - 20h" />
|
||||
</component>
|
||||
</project>
|
||||
4476
Log/log_file.log
4476
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -2568,7 +2568,9 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
|
||||
field_list = ['token','class_title', 'code_session', 'class_external_code',
|
||||
'session_start_date', 'session_end_date',
|
||||
'class_internal_url', 'archive', 'type_session', 'class_id', 'session_etape', 'client_name']
|
||||
'class_internal_url', 'archive', 'type_session', 'class_id', 'session_etape', 'client_name',
|
||||
'inscrit_name']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
|
@ -2684,6 +2686,35 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
if ("session_etape" in diction.keys() and diction['session_etape']):
|
||||
filt_session_etape = {'session_etape': str(diction['session_etape']).strip()}
|
||||
|
||||
"""
|
||||
Filter sur le client donner d'ordre
|
||||
"""
|
||||
filt_session_inscription_session_id = {}
|
||||
if ("inscrit_name" in diction.keys() and diction['inscrit_name']):
|
||||
tab_session_inscription_session_id = []
|
||||
|
||||
qry_gle = {"$or": [
|
||||
{'prenom': {'$regex': mycommon.regex_replace_cartere(str(diction['inscrit_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
{'nom': {'$regex': mycommon.regex_replace_cartere(str(diction['inscrit_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
{'email': {'$regex': mycommon.regex_replace_cartere(str(diction['inscrit_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
{'telephone': {'$regex': mycommon.regex_replace_cartere(str(diction['inscrit_name']))},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'},
|
||||
]}
|
||||
|
||||
tab_inscription_session_id_ObjectId = []
|
||||
for tmp in MYSY_GV.dbname['inscription'].find(qry_gle, {'session_id': 1}):
|
||||
tab_inscription_session_id_ObjectId.append(ObjectId(str(tmp['session_id'])))
|
||||
|
||||
if( len(tab_inscription_session_id_ObjectId) > 0 ):
|
||||
filt_session_inscription_session_id = {"_id":{'$in':tab_inscription_session_id_ObjectId}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Filter sur le client donner d'ordre
|
||||
|
|
@ -2704,7 +2735,7 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
tab_client_id.append(str(tmp['_id']))
|
||||
|
||||
|
||||
print(" ### tab_client_id = ", tab_client_id)
|
||||
#print(" ### tab_client_id = ", tab_client_id)
|
||||
|
||||
for tmp in MYSY_GV.dbname['inscription'].find({'client_rattachement_id':{'$in':tab_client_id}, 'partner_owner_recid':str(my_partner['recid']), 'valide':'1', },
|
||||
{'_id':1, 'session_id':1}):
|
||||
|
|
@ -2735,7 +2766,8 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
|
||||
|
||||
query2 = [{'$match':{ '$and' : [ filt_code_session,{'partner_owner_recid':str(my_partner['recid'])}, filt_scope_class_id, filt_scope_session_id,
|
||||
filt_archive, filt_type_session, filt_class_title_v2, filt_session_etape, filt_session_inscription_client_rattachement_id] }},
|
||||
filt_archive, filt_type_session, filt_class_title_v2, filt_session_etape, filt_session_inscription_client_rattachement_id,
|
||||
filt_session_inscription_session_id] }},
|
||||
{'$sort': {'_id': -1}},
|
||||
{'$lookup':
|
||||
{
|
||||
|
|
@ -18278,6 +18310,7 @@ def Add_Update_UE_To_Session(diction):
|
|||
local_domaine_competence_id = ""
|
||||
local_semestre = ""
|
||||
|
||||
|
||||
for is_ue_in_class_data in MYSY_GV.dbname['myclass'].find(
|
||||
{'list_unite_enseignement._id': str(diction['ue_id']),
|
||||
'list_unite_enseignement.diplome_id': str(local_diplome_id),
|
||||
|
|
@ -18288,9 +18321,11 @@ def Add_Update_UE_To_Session(diction):
|
|||
'locked': '0',
|
||||
}, {'list_unite_enseignement':1}):
|
||||
|
||||
|
||||
if( "list_unite_enseignement" in is_ue_in_class_data.keys() ):
|
||||
for local_data in is_ue_in_class_data['list_unite_enseignement']:
|
||||
if( local_data['diplome_id'] == str(local_diplome_id) and local_data['_id'] == str(diction['ue_id']) ):
|
||||
|
||||
if( "diplome_id" in local_data.keys() and local_data['diplome_id'] == str(local_diplome_id) and local_data['_id'] == str(diction['ue_id']) ):
|
||||
|
||||
if( "domaine_competence_id" in local_data.keys() and local_data['domaine_competence_id']):
|
||||
domaine_competence_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one({'_id':ObjectId(str(local_data['domaine_competence_id'])),
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
|
|||
"""
|
||||
field_list = ['token', 'file_business_object', 'file_name', 'status','object_owner_collection', 'object_owner_id',
|
||||
'file_name_to_store', 'type_document', 'metadata_field', 'tab_key_word', 'related_collection_ue',
|
||||
'related_collection_session', 'related_collection_class', 'is_secure_file',]
|
||||
'related_collection_session', 'related_collection_class', 'is_secure_file', 'publish_ent']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
|
|
@ -394,6 +394,10 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
|
|||
if ("is_secure_file" in diction.keys() and diction['is_secure_file'] in ['0', '1', '']):
|
||||
is_secure_file = diction['is_secure_file']
|
||||
|
||||
publish_ent = "0"
|
||||
if ("publish_ent" in diction.keys() and diction['publish_ent'] in ['0', '1']):
|
||||
publish_ent = diction['publish_ent']
|
||||
|
||||
|
||||
"""
|
||||
La table des mots clés contient au max 5 mots, chanque mot ne doit pas faire plus 50 caracactères
|
||||
|
|
@ -477,6 +481,7 @@ def Internal_Usage_Store_User_Downloaded_File(Folder=None, diction=None, tab_rel
|
|||
mydata['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
mydata['is_secure_file'] = str(is_secure_file)
|
||||
mydata['publish_ent'] = str(publish_ent)
|
||||
|
||||
ret_val = MYSY_GV.dbname['download_files'].find_one_and_update({'file_business_object': str(file_business_object),
|
||||
'object_owner_collection':str(object_owner_collection),
|
||||
|
|
@ -1014,6 +1019,12 @@ def Get_List_object_owner_collection_Stored_Files(diction):
|
|||
ret_file['tab_key_word'] = []
|
||||
|
||||
|
||||
if ("publish_ent" in retval.keys()):
|
||||
ret_file['publish_ent'] = retval['publish_ent']
|
||||
else:
|
||||
ret_file['tab_key_word'] = "0"
|
||||
|
||||
|
||||
"""
|
||||
Recuperation du nom du client
|
||||
"""
|
||||
|
|
@ -1868,6 +1879,11 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter(diction):
|
|||
else:
|
||||
ret_file['tab_key_word'] = []
|
||||
|
||||
if ("publish_ent" in retval.keys()):
|
||||
ret_file['publish_ent'] = retval['publish_ent']
|
||||
else:
|
||||
ret_file['tab_key_word'] = "0"
|
||||
|
||||
"""
|
||||
Recuperation du nom du client
|
||||
"""
|
||||
|
|
@ -2166,6 +2182,11 @@ def Get_List_object_owner_collection_Stored_Files_With_Filter_No_Token(diction):
|
|||
else:
|
||||
ret_file['tab_key_word'] = []
|
||||
|
||||
if ("publish_ent" in retval.keys()):
|
||||
ret_file['publish_ent'] = retval['publish_ent']
|
||||
else:
|
||||
ret_file['tab_key_word'] = "0"
|
||||
|
||||
|
||||
"""
|
||||
Recuperation du nom du client
|
||||
|
|
@ -2366,3 +2387,143 @@ def Acceptance_Stored_Downloaded_File_From_Id(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible le statut du document"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour des meta data d'un document.
|
||||
Par exemple : plublication / depublication ENT,
|
||||
tab_key_word ['mot1', 'mot2', etc'],
|
||||
file_date_expiration,
|
||||
is_secure_file,
|
||||
publish_ent
|
||||
"""
|
||||
def Update_List_Stored_Downloaded_File_From_Id(diction):
|
||||
try:
|
||||
full_file_path = ""
|
||||
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
|
||||
|
||||
field_list = ['token', 'tab_document_ids', 'tab_key_word', 'file_date_expiration', 'is_secure_file', 'publish_ent' ]
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'tab_document_ids',]
|
||||
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 la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
new_data = {}
|
||||
new_data['update_date'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
tab_document_ids = []
|
||||
tab_document_ids_ObjectId = []
|
||||
|
||||
tab_document_ids_work = str(diction['tab_document_ids']).split(",")
|
||||
for tmp in tab_document_ids_work :
|
||||
if( tmp ):
|
||||
is_valide_doc_count = MYSY_GV.dbname['download_files'].count_documents({"_id":ObjectId(str(tmp)),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
if( is_valide_doc_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le document " + tmp + "' est invalide ")
|
||||
return False, " Le document " + tmp + "' est invalide "
|
||||
|
||||
tab_document_ids.append(str(tmp))
|
||||
tab_document_ids_ObjectId.append(ObjectId(str(tmp)))
|
||||
|
||||
if( 'tab_key_word' in diction.keys()):
|
||||
tab_key_word = []
|
||||
tab_key_word_work = str(diction['tab_key_word']).split(',')
|
||||
for tmp in tab_key_word_work:
|
||||
if( tmp ):
|
||||
tab_key_word.append(str(tmp))
|
||||
|
||||
new_data['tab_key_word'] = tab_key_word
|
||||
|
||||
|
||||
|
||||
if( "file_date_expiration" in diction.keys() and diction['file_date_expiration'] ):
|
||||
file_date_expiration = str(diction['file_date_expiration']).strip()
|
||||
local_status = mycommon.CheckisDate(file_date_expiration)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date d'expiration n'est pas au format 'jj/mm/aaaa' ")
|
||||
return False, " La date d'expiration n'est pas au format 'jj/mm/aaaa' "
|
||||
|
||||
new_data['file_date_expiration'] = file_date_expiration
|
||||
|
||||
if( "is_secure_file" in diction.keys() ):
|
||||
is_secure_file = diction['is_secure_file']
|
||||
if( diction['is_secure_file'] not in ['0', '1'] ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le champ 'is_secure_file' est invalide. Les valeurs autorisées sont : 0 ou 1")
|
||||
return False, " Le champ 'is_secure_file' est invalide. Les valeurs autorisées sont : 0 ou 1"
|
||||
|
||||
new_data['is_secure_file'] = is_secure_file
|
||||
|
||||
if ("publish_ent" in diction.keys() ):
|
||||
publish_ent = diction['publish_ent']
|
||||
if( diction['publish_ent'] not in ['0', '1'] ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le champ 'publish_ent' est invalide. Les valeurs autorisées sont : 0 ou 1")
|
||||
return False, " Le champ 'publish_ent' est invalide. Les valeurs autorisées sont : 0 ou 1"
|
||||
|
||||
new_data['publish_ent'] = publish_ent
|
||||
|
||||
|
||||
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['_id'] = {'$in':tab_document_ids_ObjectId}
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
print('## new_data = ', new_data)
|
||||
|
||||
update = MYSY_GV.dbname['download_files'].update_many(data_cle, {'$set': new_data})
|
||||
|
||||
|
||||
|
||||
return True, " La mise à jour a été correctement faite"
|
||||
|
||||
|
||||
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 faire la mise à jour"
|
||||
|
|
|
|||
|
|
@ -3164,7 +3164,7 @@ def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'tab_inscrit_ids', 'tab_semestre', 'diplome_id']
|
||||
field_list = ['token', 'tab_inscrit_ids', 'tab_semestre', 'diplome_id', 'impression_test']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -3174,7 +3174,7 @@ def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(diction):
|
|||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
|
||||
field_list_obligatoire = ['token', 'tab_inscrit_ids', 'diplome_id']
|
||||
field_list_obligatoire = ['token', 'tab_inscrit_ids', 'diplome_id', 'impression_test']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
|
@ -3257,6 +3257,8 @@ def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(diction):
|
|||
|
||||
local_node['diplome_id'] = str(diction['diplome_id'])
|
||||
|
||||
local_node['impression_test'] = str(diction['impression_test'])
|
||||
|
||||
|
||||
"""
|
||||
New version
|
||||
|
|
@ -3584,7 +3586,7 @@ def Create_Bulletin_By_Inscrit_PDF_V2_Work_Collection(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'courrier_template_id', 'inscription_id', 'class_id', 'session_id',
|
||||
'tab_semestre', 'diplome_id']
|
||||
'tab_semestre', 'diplome_id', 'impression_test']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
|
@ -3595,7 +3597,7 @@ def Create_Bulletin_By_Inscrit_PDF_V2_Work_Collection(diction):
|
|||
|
||||
|
||||
field_list_obligatoire = ['token', 'courrier_template_id', 'inscription_id', 'class_id', 'session_id',
|
||||
'diplome_id']
|
||||
'diplome_id', 'impression_test']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
|
@ -3926,6 +3928,8 @@ def Create_Bulletin_By_Inscrit_PDF_V2_Work_Collection(diction):
|
|||
new_file['object_owner_collection'] = "inscription"
|
||||
new_file['object_owner_id'] = str(diction['inscription_id'])
|
||||
|
||||
new_file['publish_ent'] = "1"
|
||||
|
||||
|
||||
new_file['file_name_to_store'] = outputFilename
|
||||
tab_related_collection = []
|
||||
|
|
@ -3948,12 +3952,13 @@ def Create_Bulletin_By_Inscrit_PDF_V2_Work_Collection(diction):
|
|||
local_node['related_collection_id'] = str(diction['diplome_id'])
|
||||
tab_related_collection.append(local_node)
|
||||
|
||||
local_retval = outputFilename
|
||||
if( "impression_test" in diction.keys() and diction['impression_test'] == "0"):
|
||||
local_status, local_retval = attached_file_mgt.Internal_Usage_Store_User_Downloaded_File(
|
||||
MYSY_GV.upload_folder, new_file, tab_related_collection)
|
||||
|
||||
local_status, local_retval = attached_file_mgt.Internal_Usage_Store_User_Downloaded_File(
|
||||
MYSY_GV.upload_folder, new_file, tab_related_collection)
|
||||
|
||||
if (local_status is False):
|
||||
print(" ## WARNINGGG Impossible de stocker le fichier d'attestation")
|
||||
if (local_status is False):
|
||||
print(" ## WARNINGGG Impossible de stocker le fichier d'attestation")
|
||||
|
||||
|
||||
return True, local_retval
|
||||
|
|
|
|||
|
|
@ -860,6 +860,21 @@ def get_user_account(diction):
|
|||
local_apprenant_data = apprenant_data
|
||||
|
||||
user['apprenant_data'] = local_apprenant_data
|
||||
|
||||
|
||||
age = "?"
|
||||
if ("birthday" in user.keys()):
|
||||
local_status = mycommon.CheckisDate(str(user['birthday']))
|
||||
if (local_status):
|
||||
today = datetime.today()
|
||||
dob = datetime.strptime(str(user['birthday']), '%d/%m/%Y')
|
||||
age = today.year - dob.year - ((today.month, today.day) < (dob.month, dob.day))
|
||||
|
||||
user['age'] = str(age)
|
||||
|
||||
if ("birthday" not in user.keys() or str(user['birthday']) == ""):
|
||||
user['date_naissance'] = "01/01/1900"
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
|
@ -1059,20 +1074,19 @@ def Reset_user_pwd_by_token(diction):
|
|||
return False, "Le token est invalide"
|
||||
|
||||
|
||||
# Recuperation du recid du user
|
||||
user_recid = mycommon.get_user_recid_from_token(token_value)
|
||||
if user_recid is False :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de récupérer le recid du user. Le token envoyé est :"+str(token_value))
|
||||
# Recuperation du id du user
|
||||
user_id = mycommon.get_user_id_from_token(token_value)
|
||||
if user_id is False :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de récupérer le _id du user. Le token envoyé est :"+str(token_value))
|
||||
return False, " Impossible de mettre à jour le mot de passe"
|
||||
|
||||
|
||||
|
||||
mydata['update_date'] = str(datetime.now())
|
||||
|
||||
coll_name = MYSY_GV.dbname['user_account']
|
||||
|
||||
#print(" le recid = "+user_recid+" mydata = "+str(mydata))
|
||||
ret_val = coll_name.find_one_and_update({'recid': user_recid, 'locked': '0', 'active':'1'},
|
||||
print(" le user_id = "+user_id+" mydata = "+str(mydata))
|
||||
ret_val = MYSY_GV.dbname['user_account'].find_one_and_update({'_id': ObjectId(str(user_id)), 'locked': '0', 'active':'1'},
|
||||
{"$set": mydata},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
|
|
@ -1080,20 +1094,18 @@ def Reset_user_pwd_by_token(diction):
|
|||
|
||||
if (ret_val and ret_val['_id']):
|
||||
# Apres avoir changer le mot passe, desactivation tu token
|
||||
|
||||
coll_name = MYSY_GV.dbname['partner_token']
|
||||
ret_val = coll_name.update_many({'recid': user_recid, 'valide': '1'},
|
||||
ret_val = MYSY_GV.dbname['partner_token'].update_many({'user_account_id': user_id, 'valide': '1'},
|
||||
{"$set": {'valide': '0', 'date_update': str(datetime.now())}},
|
||||
)
|
||||
|
||||
if( ret_val.matched_count <= 0 ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " WARNING : Attention à la mise à jour du mot de passe de"
|
||||
" du user avec le recid = "+user_recid)
|
||||
" du user avec le _id = "+user_id)
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le mot de passe de l'utilisateur (recid) =" + str(user_recid)+" a été modifié")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le mot de passe de l'utilisateur (_id) =" + str(user_id)+" a été modifié")
|
||||
return True, "Le mot de passe a bien été mise à jour "
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de mettre à jour le password du user : recid = "+str(user_recid))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de mettre à jour le password du user : _id = "+str(user_id))
|
||||
return False, "Impossible de mettre à jour le password"
|
||||
|
||||
elif( accounttype == "2"):
|
||||
|
|
@ -1800,15 +1812,15 @@ def InitUserPasswd(diction):
|
|||
|
||||
print(" myquery ="+str(myquery))
|
||||
|
||||
tmp = coll_name.count_documents(myquery)
|
||||
tmp = MYSY_GV.dbname['user_account'].count_documents(myquery)
|
||||
if (tmp <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Aucun resultat trouvé pour " + str(myquery))
|
||||
return True, "La demande de reinitiation à été prise en compte"
|
||||
|
||||
|
||||
retVal = coll_name.find(myquery, {"_id": 0, "valide": 0, "user_recid": 0})
|
||||
retVal = MYSY_GV.dbname['user_account'].find(myquery, { "valide": 0, "user_recid": 0})
|
||||
|
||||
#print(" le recid = "+str(retVal[0]['recid']))
|
||||
print(" le recid = "+str(retVal[0]))
|
||||
|
||||
'''
|
||||
Desactivation des tocken actifs
|
||||
|
|
@ -1818,13 +1830,13 @@ def InitUserPasswd(diction):
|
|||
|
||||
coll_name_token = MYSY_GV.dbname['partner_token']
|
||||
ret_val_user_rech = coll_name_token.update_many(
|
||||
{'recid': retVal[0]['recid']},
|
||||
{'partner_account_id': str(retVal[0]['_id'])},
|
||||
{"$set": update_field}
|
||||
)
|
||||
|
||||
if (ret_val_user_rech.matched_count <= 0):
|
||||
"""if (ret_val_user_rech.matched_count <= 0):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de desactivier les token actifs dans table 'partner_token' ")
|
||||
return True, "La demande de reinitiation à été prise en compte"
|
||||
return True, "La demande de reinitiation à été prise en compte"""
|
||||
|
||||
|
||||
'''
|
||||
|
|
@ -1832,7 +1844,8 @@ def InitUserPasswd(diction):
|
|||
'''
|
||||
new_token = {}
|
||||
new_token['email'] = retVal[0]['email']
|
||||
new_token['recid'] = retVal[0]['recid']
|
||||
new_token['recid'] = str(retVal[0]['_id'])
|
||||
new_token['user_account_id'] = str(retVal[0]['_id'])
|
||||
new_token['update_date'] = str(datetime.now())
|
||||
new_token['valide'] = '1'
|
||||
# Creation du token
|
||||
|
|
@ -1840,7 +1853,7 @@ def InitUserPasswd(diction):
|
|||
new_token['token'] = mynewtoken
|
||||
|
||||
|
||||
#print(" new token to insert = "+str(new_token))
|
||||
print(" new token to insert = "+str(new_token))
|
||||
ret_val_tmp = coll_name_token.insert_one(new_token)
|
||||
if (ret_val_tmp is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de créer le nouveau token")
|
||||
|
|
|
|||
|
|
@ -1778,6 +1778,10 @@ def Get_Ent_Student_List_Class_Evaluation(diction):
|
|||
Recuperation de la liste des fichiers stocké par :
|
||||
- object_owner_collection
|
||||
- object_owner_id
|
||||
|
||||
Important :
|
||||
- Les documents sécurisés ne sont pas affichés dans l'ENT
|
||||
- Seuls les documents avec 'publish_ent' = 1, sont visible sur l'ENT
|
||||
"""
|
||||
|
||||
|
||||
|
|
@ -1877,6 +1881,9 @@ def Get_Ent_Student_List_object_owner_collection_Stored_Files(diction):
|
|||
my_query['valide'] = "1"
|
||||
my_query['partner_owner_recid'] = str(apprenant_data['partner_owner_recid'])
|
||||
|
||||
my_query['publish_ent'] = "1"
|
||||
my_query['is_secure_file'] = {'$ne':"1"}
|
||||
|
||||
|
||||
query = my_query
|
||||
|
||||
|
|
@ -2037,6 +2044,9 @@ def Get_Ent_Student_List_object_owner_collection_Stored_Files(diction):
|
|||
|
||||
"""
|
||||
Fonction de recuperation des pièces jointes d'objet en utilisant le 'file_name'
|
||||
Important :
|
||||
- Les documents sécurisés ne sont pas affichés dans l'ENT
|
||||
- Seuls les documents avec 'publish_ent' = 1, sont visible sur l'ENT
|
||||
"""
|
||||
def Get_Ent_Student_Stored_Downloaded_File(diction):
|
||||
try:
|
||||
|
|
@ -2126,7 +2136,8 @@ def Get_Ent_Student_Stored_Downloaded_File(diction):
|
|||
Recuperation de la list des fichier dans la collection
|
||||
"""
|
||||
tmp_count = MYSY_GV.dbname['download_files'].count_documents({'full_path': str(full_path), 'valide': '1',
|
||||
'partner_owner_recid':apprenant_data['partner_owner_recid']})
|
||||
'partner_owner_recid':apprenant_data['partner_owner_recid'],
|
||||
'publish_ent':'1', 'is_secure_file':{'$ne':1}})
|
||||
if (tmp_count <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
|
|
@ -2680,6 +2691,9 @@ def Get_Ent_Student_change_user_pwd(diction):
|
|||
|
||||
"""
|
||||
Fonction de recuperation des pièces jointes d'objet en utilisant le 'file_name'
|
||||
Important :
|
||||
- Les documents sécurisés ne sont pas affichés dans l'ENT
|
||||
- Seuls les documents avec 'publish_ent' = 1, sont visible sur l'ENT
|
||||
"""
|
||||
def Get_Ent_Student_Stored_Downloaded_File(diction):
|
||||
try:
|
||||
|
|
@ -2769,7 +2783,8 @@ def Get_Ent_Student_Stored_Downloaded_File(diction):
|
|||
Recuperation de la list des fichier dans la collection
|
||||
"""
|
||||
tmp_count = MYSY_GV.dbname['download_files'].count_documents({'full_path': str(full_path), 'valide': '1',
|
||||
'partner_owner_recid':apprenant_data['partner_owner_recid']})
|
||||
'partner_owner_recid':apprenant_data['partner_owner_recid'],
|
||||
'publish_ent':'1', 'is_secure_file':{'$ne':'1'}})
|
||||
if (tmp_count <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
|
|
|
|||
25
main.py
25
main.py
|
|
@ -7934,6 +7934,23 @@ def Acceptance_Stored_Downloaded_File_From_Id():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour CERTAINES metadata d'un document
|
||||
Par exemple : plublication / depublication ENT,
|
||||
tab_key_word ['mot1', 'mot2', etc'],
|
||||
file_date_expiration,
|
||||
is_secure_file,
|
||||
publish_ent
|
||||
"""
|
||||
@app.route('/myclass/api/Update_List_Stored_Downloaded_File_From_Id/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_List_Stored_Downloaded_File_From_Id():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_List_Stored_Downloaded_File_From_Id : payload = ", payload)
|
||||
status, retval = attached_file_mgt.Update_List_Stored_Downloaded_File_From_Id(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -14536,9 +14553,9 @@ def Get_List_Evaluation_Inscriptio_Note_Classement_With_Filter():
|
|||
"""
|
||||
API pour imprimer le bulletin de note d'un inscrit
|
||||
"""
|
||||
@app.route('/myclass/api/Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF/<token>/<tab_inscrit_ids>/<diplome_id>/<tab_semestre>', methods=['POST','GET'])
|
||||
@app.route('/myclass/api/Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF/<token>/<tab_inscrit_ids>/<diplome_id>/<tab_semestre>/<impression_test>', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(token, tab_inscrit_ids, diplome_id, tab_semestre):
|
||||
def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(token, tab_inscrit_ids, diplome_id, tab_semestre, impression_test):
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
payload = {}
|
||||
|
|
@ -14548,6 +14565,10 @@ def Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(token, tab_inscrit_ids, diplom
|
|||
if( str(diplome_id) != '-'):
|
||||
payload['tab_semestre'] = str(tab_semestre)
|
||||
|
||||
payload['impression_test'] = str(impression_test)
|
||||
if (str(impression_test) != '0'):
|
||||
payload['impression_test'] = "1"
|
||||
|
||||
print(" ### Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF : payload = ",str(payload))
|
||||
|
||||
localStatus, response= base_class_calcul_note.Prepare_and_Send_Inscrit_Bulletin_Note_By_PDF(payload)
|
||||
|
|
|
|||
|
|
@ -485,6 +485,24 @@ def get_user_recid_from_token(token = ""):
|
|||
return False
|
||||
|
||||
|
||||
|
||||
def get_user_id_from_token(token = ""):
|
||||
try :
|
||||
if len(str(token)) <= 0 :
|
||||
myprint(" Le token est vide")
|
||||
return False
|
||||
|
||||
coll_token = MYSY_GV.dbname['partner_token']
|
||||
tmp_val = coll_token.find({'token': str(token), 'valide': '1'})
|
||||
user_recid = tmp_val[0]['user_account_id']
|
||||
return user_recid
|
||||
|
||||
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
|
||||
|
||||
|
||||
def get_user_partnaire_id_from_token(token = ""):
|
||||
try :
|
||||
if len(str(token)) <= 0 :
|
||||
|
|
|
|||
Loading…
Reference in New Issue