17/07/2024 - 11h30sdf
parent
51559012c6
commit
a0ac2664b3
|
@ -3,10 +3,9 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="17/07/2024 - 11h30">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/factures_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/factures_tbd_qries.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$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_access_right.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_access_right.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
1084
Log/log_file.log
1084
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -1233,6 +1233,17 @@ def Get_List_Ressource_Humaine(diction):
|
|||
|
||||
"""
|
||||
Recuperation de la liste des profils de ressources humaines
|
||||
|
||||
|
||||
20/07/2024 :
|
||||
Pour permettre d'avoir des profils par default et des profils par partenaire,
|
||||
on a va ajouter la notion de "partner_owner_recid".
|
||||
|
||||
algo :
|
||||
On regarder d'avoir s'il y a des lignes avec le 'partner_owner_recid' du partenaire
|
||||
si,il y au moins une ligne, cela veut dire qu'on a activité les profils par client,
|
||||
si non on prend les profils par defaut
|
||||
|
||||
"""
|
||||
def Get_List_Profil_Ressource_Humaine(diction):
|
||||
try:
|
||||
|
@ -1281,17 +1292,23 @@ def Get_List_Profil_Ressource_Humaine(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. "
|
||||
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['valide'] = "1"
|
||||
Verifier si on a des profils pour ce partenaire
|
||||
"""
|
||||
is_partnaire_profil = MYSY_GV.dbname['ressource_humaine_profil'].count_documents({'valide':'1', 'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
qry_search = ""
|
||||
if( is_partnaire_profil > 0 ):
|
||||
qry_search = {'valide':'1', 'locked':'0','partner_owner_recid':str(my_partner['recid'])}
|
||||
else:
|
||||
qry_search = {'valide': '1', 'locked': '0', 'partner_owner_recid': 'default'}
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['ressource_humaine_profil'].find(data_cle):
|
||||
for retval in MYSY_GV.dbname['ressource_humaine_profil'].find(qry_search):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
|
|
@ -261,8 +261,101 @@ def Get_Matrix_Acces_Right(diction):
|
|||
Recuperation de la matrice des acces associé à un profil utilisateur (ex : enseignant, directeur, etc
|
||||
"""
|
||||
|
||||
|
||||
def Get_Matrix_Acces_Right_By_Profil(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'ressource_humaine_profil_id']
|
||||
|
||||
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', 'ressource_humaine_profil_id']
|
||||
|
||||
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",
|
||||
|
||||
"""
|
||||
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
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['application_modules'].find({'valide': '1', 'locked': '0'}):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
user['read'] = False
|
||||
user['write'] = False
|
||||
|
||||
"""
|
||||
Pour le module en question, on va aller recuperer les droits paramettrés sur le profil (collection : 'ressource_humaine_profil')
|
||||
"""
|
||||
user_acces_right_qry = {'valide': '1', 'locked': '0',
|
||||
'_id':ObjectId(str(diction['ressource_humaine_profil_id']))}
|
||||
|
||||
|
||||
|
||||
user_acces_right = MYSY_GV.dbname['ressource_humaine_profil'].find_one(user_acces_right_qry)
|
||||
|
||||
if (user_acces_right and "profil_access_right" in user_acces_right.keys() and
|
||||
len(user_acces_right['profil_access_right']) > 0 ) :
|
||||
|
||||
for tmp_access in user_acces_right['profil_access_right']:
|
||||
print(" tmp_access = ", tmp_access)
|
||||
print(" retval = ", retval)
|
||||
|
||||
if( tmp_access['module_name'] == retval['module_name'] ):
|
||||
|
||||
if ('read' in tmp_access.keys()):
|
||||
user['read'] = tmp_access['read']
|
||||
else:
|
||||
user['read'] = False
|
||||
|
||||
if ('write' in tmp_access.keys()):
|
||||
user['write'] = tmp_access['write']
|
||||
else:
|
||||
user['write'] = False
|
||||
|
||||
# print(" ### user_acces_right - user = ", user)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" Get_Matrix_Acces_Right_By_Profil RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
|
||||
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 récupérer la matrice des droits "
|
||||
|
||||
|
||||
def Get_Matrix_Acces_Right_By_Profil_SAVE(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
|
Loading…
Reference in New Issue