It's work. But changed "username_attrib" instead "username_attrs" at lign 
306:

 filter = '(&(%s=%s)(%s))' % ( username_attrib, 
ldap.filter.escape_filter_chars( username ), filterstr )

Thank szimszon.





Vào 05:15:08 UTC+7 Thứ bảy, ngày 17 tháng ba năm 2012, szimszon đã viết:
>
> Can you please test it? I can test it only on monday.
>
>     or you can customize the search for user:
>     
>         auth.settings.login_methods.append(ldap_auth(
>             mode='custom', server='my.ldap.server',
>             base_dn='ou=Users,dc=domain,dc=com',
>             username_attrib='uid',
>             custom_scope='subtree'))
>             
>     the custom_scope can be: base, onelevel, subtree.
>
> 2012. március 16., péntek 3:15:10 UTC+1 időpontban IVINH a következőt írta:
>>
>> Hi all,
>>
>> This my code for LDAP:
>>
>>    from gluon.contrib.login_methods.ldap_auth import ldap_auth 
>>    
>> auth.settings.login_methods.append(ldap_auth(mode='cn',server='myserver',base_dn='ou=subdomain1,o=domain,c=com',port=389))
>>  
>>
>>
>> This works fine when I explicitely query SUBDOMAIN1 with the users that 
>> are in that domain (user1, user2, ...)
>> My problem is that at runtime, I don't know what subdomain the users are 
>> from and I don't want to query all subdomains one after the other to find 
>> user information.
>> Is these a way to query the entire directory (root) for users without 
>> knowing what subdomains they are in? If not, is there another better way to 
>> do this?
>>
>> Thank advance.
>>
>>
>>
>>

Reply via email to