General help

HELP!--User Authentication problem

 
Picture of Mike Finney
HELP!--User Authentication problem
 
I am wanting to use an external database to fill the user database for my Moodle site (1.8). It is running on a MySql database (as is the external database.) I ran my installation.... set up External Database for authentication. Set up the Cron job to run from auth/db/auth_db_sync_users.php. It runs fine...but none of my fields are populated for the user, nor does it allow for a login by the user. Any thoughts or suggestions? Am I running the cron job from the correct file?

Thanks


 
Average of ratings: -
Picture of Iñaki Arenaza
Re: HELP!--User Authentication problem
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers
Before running the cron job, I'd make sure the external database settings are right, and that you can login with an external user credentials.

Login as admin, set the debuging settings to allow for errors to be printed on screen and then try to login using an external user.

Having a look at the PHP error logs is a good idea too smile

Saludos. Iñaki.
 
Average of ratings: -
Nathaniel
Re: HELP!--User Authentication problem
 
When I looked into this I found that the username is being populated, but no other fields are, and even when I've tried having the password creation internal (random by Moodle), the password field is blank.

I updated one of the new user entries in the database by adding a password but when I tried logging in I got Could not connect to the specified authentication database...

I know that I entered the database information correctly, because it was able to get the usernames for my 4 new users in the first place.

Here's something else I noticed when running this via command line: One of my new users has the same email address as a user already in the system, but the username is different (new student is expected to have username same as email address). It inserts the user but then detects the email duplication and outputs an error:

Inserted user student.moodle@alivetek.com id 24
<div class="notifytiny" style="text-align:center">Duplicate entry '1-student.moodle@example.com' for key 2<br /><br />INSERT INTO mdl_user ( AUTH, CONFIRMED, MNETHOSTID, USERNAME, LANG ) VALUES ( 'db', 1, 1, 'student.moodle@example.com', 'en_utf8' )<ul style="text-align: left"><li>line 1419 of lib/dmllib.php: call to debugging()</li><li>line 375 of auth/db/auth.php: call to insert_record()</li><li>line 45 of auth/db/auth_db_sync_users.php: call to auth_plugin_db-&gt;sync_users()</li></ul></div><br />
Error inserting user student.moodle@example.com


I tried looking for something in the Moodle Tracker regarding this, but I'm not really familiar with Moodle Tracker and I haven't found anything specifically about this yet. Does anyone know from experience if this works in Moodle 1.8 yet?
 
Average of ratings: -
At work
Re: HELP!--User Authentication problem
 
I am running the script but password field is not filled with the ext.Db password just username collumn is filled from the ext. Db in moodle user table.

The sync_users function in auth/db/auth.php says in the comments :
Sync should be done by using idnumber attribute, not username.

-->>I must fill the idnumber collumn of mdl_user table. In the authenthication settings where do i mention it?

* You need to pass firstsync parameter to function to fill in idnumbers if they dont exists in moodle user table.
-->>Sorry i could not this point the! what is the firstsync parameter?
 
Average of ratings: -
Picture of John Rickard
Re: HELP!--User Authentication problem
 

Hi Everyone

I am having some trouble trying to get the external DB authentication on www.cornwallscouts.org.uk

I have the auth/db/auth_db_sync_users.php running alongside my cron job - is this right? - as it doesnt seem to pull accross the user details...

But when I log in as a user in the external db - it creates a user in the mdl_user database, but doesnt pull accross the details from the external db.

I have the field mapping correct - checked that a million times...

Any help appriciated!!

Thanks

John

 
Average of ratings: -
Picture of monchet S.
Re: HELP!--User Authentication problem
 

Hi. I am encountering a similar  problem as above.  I am able to login users successfully using external db authentication via DSN and odbc_mssql. The problem is with the data mapping as it does not pre-fill the mapped fields.  When 'update local' option is set to 'on every login' , previously filled entries become blank so I am assuming that the plugin is unable to retrieve or is getting blank values from the external database. My data mapping entries are correct  and external database records used in testing have entries.

I am using Moodle  2.8.5 + (build 20150313)

PHP 5.4.12

Apache 2.4.4

Mysql 5.6.12 as moodle core db

on Windows 8 pro 64 bit OS

External db is MSSQL 2000. I also tried on MSSQL 2012 with same results

Any help would be appreciated

Thanks in Advance,

mon

 
Average of ratings: -
Picture of monchet S.
Re: HELP!--User Authentication problem
 

After much searching I found that this is related if not the exact same bug previously reported MDL-7712" title="Fields not read from external database" class="issue-link">MDL-7712 and supposedly resolved from moodle 1.7 onwards. As suggested on the thread by Phil Driscoll, I commented $authdb->SetFetchMode(ADODB_FETCH_ASSOC) in line 150 of auth.php, and true enough, it fixed the issue.

 
Average of ratings: -