idnumber column is not getting inserted

idnumber column is not getting inserted

by Sushma R -
Number of replies: 12

Dear Team,

i am using oAuth2 (microsoft) method of login, i have mapped student id from the microsoft response into the idnumber column for user table. i see after user login idnumber column is not getting inserted. Can anyone help me on this? have i missed anything here?

Thanks in advance,


Average of ratings: -
In reply to Sushma R

Re: idnumber column is not getting inserted

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Hi,

Are all the characters valid for the field?
In reply to Benjamin Ellis

Re: idnumber column is not getting inserted

by Sushma R -
Yes, its an numeric.
In reply to Sushma R

Re: idnumber column is not getting inserted

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Maybe the field name (student id) you are getting from M$ is not quite what you expect e.g. you map id but the response has the field name as userid etc - just a thought.
In reply to Benjamin Ellis

Re: idnumber column is not getting inserted

by Sushma R -
Hi Ellis,

Thank you for the reply. I reverified that is not the case here.
In reply to Sushma R

Re: idnumber column is not getting inserted

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Assuming that you have the auth_oauth2 | field_lock_idnumber setting on the default 'unlocked' or even the 'unlocked if empty' - my next move would be to examine the OAuth2 code (not easy).

In reply to Benjamin Ellis

Re: idnumber column is not getting inserted

by Sushma R -
Hi Ellis,

currently idnumber is in unlocked state.
In reply to Sushma R

Re: idnumber column is not getting inserted

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Looks like you will have to dig into the source code.
In reply to Benjamin Ellis

Re: idnumber column is not getting inserted

by Sushma R -
HI Ellis,

currently we have not done any changes to the code, using as it from the moodle website.,
In reply to Sushma R

Re: idnumber column is not getting inserted

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Hi,

What I meant is you will need to look at the OAuth code to try and work out why your id numbers are not being mapped correctly. I would start in the /lib/classes/oauth2/ folder, particularly /lib/classes/oauth2/api.php - http://xref-diff.mukudu-dev.net/moodle311/lib/classes/oauth2/api.php.source.html.
In reply to Benjamin Ellis

Re: idnumber column is not getting inserted

by Sushma R -
Hi Ellis,
Should I be checking any specific function? Currently, I am unable to figure out which function is actually giving user field mapping data. It would be of great help ,pin point the function name.
In reply to Sushma R

Re: idnumber column is not getting inserted

by Benjamin Ellis -
Picture of Particularly helpful Moodlers

The mapping is done in the map_userinfo_to_fields() function in lib/classes/oauth2/client.php.  It is called by get_userinfo() function which in turn is called by the complete_login() function in auth/oauth2/classes/auth.php.  Hope that helps.

In reply to Benjamin Ellis

Re: idnumber column is not getting inserted

by Sushma R -
Yes, thank you Ellis. seems like data is not coming from the graph api.