I only return a dict in the get_user, web2py does all the work.

web2py call the get_user method, and web2py update the auth_user table with 
the dict values.

I don't write/update the auth_user table in my custom class.

On Tuesday, January 8, 2013 11:05:04 AM UTC-6, Niphlod wrote:
>
> hypothesis 2 is off the table
>
> BTW: saying that you have a method that returns a dict and stating that 
> that method doesn't update a field lacks of the key point...... 
> *Who*writes/updates the auth_user table in your custom class ?
>
> On Tuesday, January 8, 2013 5:36:39 PM UTC+1, Ignacio Ocampo wrote:
>>
>> Hi,
>>
>> I'm working with my own authentication provider as: *
>> auth.settings.login_form=MyAuth()*, all *works correctly*.
>>
>> I need an additional field from default auth_user table definition, I 
>> used: *auth.settings.extra_fields['auth_user'] = [Field('**employee_id**', 
>> 'text')]*, works correctly (the value of this field is provided by 
>> MyAuth() to reference another system, ergo, in web2py it's would be treated 
>> as a simple text).
>>
>> The final schema is:
>>
>> CREATE TABLE auth_user(
>>     id INTEGER PRIMARY KEY AUTOINCREMENT,
>>     first_name CHAR(128),
>>     last_name CHAR(128),
>>     email CHAR(512),
>>     password CHAR(512),
>>     registration_key CHAR(512),
>>     reset_password_key CHAR(512),
>>     registration_id CHAR(512)
>> , *employee_id* TEXT);
>>
>> In MyAuth() class, I have the method get_user(self), which web2py call in 
>> the login process to get user details. At the end of this method, I return:
>>
>> user = dict(first_name=response['attributes']['cn'][0], 
>> last_name=response['attributes']['cn'][0], 
>> username=response['attributes']['uid'][0], 
>> registration_id=response['attributes']['uid'][0], *employee_id*
>> =response['attributes']['*employee_id*'][0])
>>
>> All fields are updated correctly, except the *employee_id*, that is the 
>> additional field.
>>
>> *Hypothesis 1*: I don't know if web2py is updating only default fields 
>> from the auth_user table (and because employee_id are not default field, 
>> it's no updated).
>> *Hypothesis 2*: The name of the additional field *employee_id* is 
>> malformed (because the last part "_id" is used to reference another table 
>> and commonly is INT type and web2py don't know how to handle this, since 
>> there is no the *employee* table).
>>
>> Thank you.
>>
>

-- 



Reply via email to