maj apikaz

This commit is contained in:
HPL 2024-10-08 10:02:34 +02:00
parent 0e539b4cac
commit dc43d31b21

View File

@ -19,7 +19,7 @@ class Ldap_user(Resource):
@classmethod
def is_valid_field(cls, field):
allowed_fields = ['mailDeSecours', 'mailEnabled', 'nextcloudEnabled', 'mobilizonEnabled', 'agoraEnabled', 'userPassword', 'identifiantKaz', 'mailAlias', 'quota']
allowed_fields = ['numeroMembre','mailDeSecours', 'mailEnabled', 'nextcloudEnabled', 'mobilizonEnabled', 'agoraEnabled', 'userPassword', 'identifiantKaz', 'mailAlias', 'quota']
return field in allowed_fields
@jwt_required()
@ -154,7 +154,7 @@ class Ldap_user(Resource):
properties:
field:
type: string
enum: ['mailDeSecours', 'mailEnabled', 'nextcloudEnabled', 'mobilizonEnabled', 'agoraEnabled', 'userPassword', 'identifiantKaz', 'mailAlias', 'quota', 'numeroMembre']
enum: ['numeroMembre', 'mailDeSecours', 'mailEnabled', 'nextcloudEnabled', 'mobilizonEnabled', 'agoraEnabled', 'userPassword', 'identifiantKaz', 'mailAlias', 'quota' ]
description: Le champ à ajouter, supprimer ou modifier (par exemple, mailDeSecours, mailAlias, etc.)
value:
type: string
@ -180,7 +180,7 @@ class Ldap_user(Resource):
return "Action, champ ou valeur manquant", 400
if not self.is_valid_field(field):
return "Champ non autorisé", 400
return "Champ non autorisé !", 400
ldap_connection = self._connect_ldap()
result = ldap_connection.search_s("ou=users,{}".format(self.ldap_root), ldap.SCOPE_SUBTREE, "(cn={})".format(email))