Thank you! It works now!

On Tuesday, June 4, 2013 9:56:39 AM UTC-6, Massimo Di Pierro wrote:
>
> In 
>
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(ldap_auth(mode='ad',
>    server='xxx.xxxxxxxx.xxx',
>    base_dn='OU=xxxx,DC=xxxxxxxx,DC=xxxxxx',
>    bind_dn='CN=xxxxxxx,CN=xxxxx,DC=xxxxxxxxxx,DC=xxxxx',
>    bind_pw='xxxxxx',
>    manage_user=True,
>    user_firstname_attrib='cn:1',
>    user_lastname_attrib='cn:2',
>    user_mail_attrib='mail'
>    ))
>
>
> you need to pass an extra db = db
>
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(ldap_auth(mode='ad',
>    server='xxx.xxxxxxxx.xxx',
>    base_dn='OU=xxxx,DC=xxxxxxxx,DC=xxxxxx',
>    bind_dn='CN=xxxxxxx,CN=xxxxx,DC=xxxxxxxxxx,DC=xxxxx',
>    bind_pw='xxxxxx',
>    manage_user=True,
>    user_firstname_attrib='cn:1',
>    user_lastname_attrib='cn:2',
>    user_mail_attrib='mail',
>    db = db, #<<<<<<
>    ))
>
> On Monday, 3 June 2013 16:22:30 UTC-5, mrendon wrote:
>>
>> Thanks! Is this it?
>>
>> Traceback (most recent call last):
>>  File "/home/www-data/web2py/gluon/restricted.py", line 212, in restricted
>>  exec ccode in environment
>>  File 
>> "/home/www-data/web2py/applications/alcolholedu/controllers/default.py", 
>> line 14, in <module>
>>  File "/home/www-data/web2py/gluon/globals.py", line 194, in <lambda>
>>  self._caller = lambda f: f()
>>  File 
>> "/home/www-data/web2py/applications/alcolholedu/controllers/default.py", 
>> line 3, in user
>>  def user(): return dict(form=auth())
>>  File "/home/www-data/web2py/gluon/tools.py", line 1285, in __call__
>>  return getattr(self, args[0])()
>>  File "/home/www-data/web2py/gluon/tools.py", line 2143, in login
>>  request.vars[passfield]):
>>  File "/home/www-data/web2py/gluon/contrib/login_methods/ldap_auth.py", line 
>> 421, in ldap_auth_aux
>>  user_in_db = db(db.auth_user.email == username)
>> AttributeError: 'NoneType' object has no attribute 'auth_user'
>>
>>
>> On Monday, June 3, 2013 3:08:29 PM UTC-6, Derek wrote:
>>>
>>> We need to see the whole traceback.
>>>
>>> On Monday, June 3, 2013 9:21:51 AM UTC-7, mrendon wrote:
>>>>
>>>> Hi. I'm trying to get email address and name attributes imported into 
>>>> my database. I'm using Active Directory and version web2py 
>>>> 2.4.7-stable+timestamp.2013.05.24.17.48.47. 
>>>> I think I've followed the instructions in the ldap_auth.py file under 
>>>> gluon/contrib/login_methods.
>>>>
>>>>
>>>> Relevant part of db.py:
>>>>
>>>> ## create all tables needed by auth if not custom tables
>>>> auth.define_tables(username=True)
>>>> auth.settings.create_user_groups=False
>>>>
>>>> ## configure auth policy
>>>> auth.settings.registration_requires_verification = False
>>>> auth.settings.registration_requires_approval = False
>>>> auth.settings.reset_password_requires_verification = True
>>>>
>>>>
>>>> # all we need is login
>>>> auth.settings.actions_disabled=['register','change_password',
>>>> 'request_reset_password','retrieve_username','profile']
>>>>
>>>>
>>>> # you don't have to remember me
>>>> auth.settings.remember_me_form = False
>>>>
>>>>
>>>> from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>>> auth.settings.login_methods.append(ldap_auth(mode='ad',
>>>>    server='xxx.xxxxxxxx.xxx',
>>>>    base_dn='OU=xxxx,DC=xxxxxxxx,DC=xxxxxx',
>>>>    bind_dn='CN=xxxxxxx,CN=xxxxx,DC=xxxxxxxxxx,DC=xxxxx',
>>>>    bind_pw='xxxxxx',
>>>>    manage_user=True,
>>>>    user_firstname_attrib='cn:1',
>>>>    user_lastname_attrib='cn:2',
>>>>    user_mail_attrib='mail'
>>>>    ))
>>>>
>>>>
>>>> I'm able to login without manage_user=True. But when I try to use it I 
>>>> get the following error:
>>>>  
>>>> <type 'exceptions.AttributeError'>('NoneType' object has no attribute 
>>>> 'auth_user')
>>>>
>>>> Any ideas?
>>>>
>>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to