maj apikaz
This commit is contained in:
parent
0e539b4cac
commit
dc43d31b21
@ -19,7 +19,7 @@ class Ldap_user(Resource):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_valid_field(cls, field):
|
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
|
return field in allowed_fields
|
||||||
|
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
@ -154,7 +154,7 @@ class Ldap_user(Resource):
|
|||||||
properties:
|
properties:
|
||||||
field:
|
field:
|
||||||
type: string
|
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.)
|
description: Le champ à ajouter, supprimer ou modifier (par exemple, mailDeSecours, mailAlias, etc.)
|
||||||
value:
|
value:
|
||||||
type: string
|
type: string
|
||||||
@ -180,7 +180,7 @@ class Ldap_user(Resource):
|
|||||||
return "Action, champ ou valeur manquant", 400
|
return "Action, champ ou valeur manquant", 400
|
||||||
|
|
||||||
if not self.is_valid_field(field):
|
if not self.is_valid_field(field):
|
||||||
return "Champ non autorisé", 400
|
return "Champ non autorisé !", 400
|
||||||
|
|
||||||
ldap_connection = self._connect_ldap()
|
ldap_connection = self._connect_ldap()
|
||||||
result = ldap_connection.search_s("ou=users,{}".format(self.ldap_root), ldap.SCOPE_SUBTREE, "(cn={})".format(email))
|
result = ldap_connection.search_s("ou=users,{}".format(self.ldap_root), ldap.SCOPE_SUBTREE, "(cn={})".format(email))
|
||||||
|
Loading…
Reference in New Issue
Block a user