11#!/usr/bin/env python3
22
33# This file is part of Open-Capture.
4+ # Copyright Edissyum Consulting since 2020 under licence GPLv3
45# Open-Capture is free software: you can redistribute it and/or modify
56# it under the terms of the GNU General Public License as published by
67# the Free Software Foundation, either version 3 of the License, or
1112# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1213# GNU General Public License for more details.
1314
14- # You should have received a copy of the GNU General Public License
15- # along with Open-Capture. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
15+ # See LICENCE file at the root folder for more details.
1616
1717# @dev: Essaid MEGHELLET <essaid.meghellet@edissyum.com>
1818
@@ -128,10 +128,9 @@ def get_ldap_users(connection, class_user, object_class, users_dn):
128128 sys .exit (0 )
129129 if not users_dn :
130130 status = connection .search (search_base = base_dn , search_filter = f'({ class_user } ={ object_class } )' ,
131- search_scope = 'SUBTREE' ,
132- attributes = ['*' ])
131+ search_scope = 'SUBTREE' , attributes = ['*' ])
133132 else :
134- status = connection .search (search_base = base_dn , search_filter = users_dn ,
133+ status = connection .search (search_base = users_dn , search_filter = f'( { class_user } = { object_class } )' ,
135134 search_scope = 'SUBTREE' , attributes = ['*' ])
136135
137136 if connection and status :
@@ -140,8 +139,8 @@ def get_ldap_users(connection, class_user, object_class, users_dn):
140139 else :
141140 print_log ("No user is found on the ldap server " )
142141 return {'status_search' : False , 'ldap_users' : "" }
143- except LDAPException :
144- print_log ('Search doesn t work' )
142+ except LDAPException as _e :
143+ print_log ('Search doesn t work' + str ( _e ) )
145144 return False
146145
147146
0 commit comments