-
Functional Test
-
Minor
-
Moodle 4.4
Pre-requisite: PDO-compatible DB server; PHP compiled with a PDO DB extension
- Go to Authentication / Manage authentication and enable External Database authentication
- Set the following value for the following fields:
- Host : pgsql:host=localhost;port=5432;dbname=externaldb
- Database: pdo
- User/Password: to your user / password for postgres connexion
- Table: authtable
- Username field: username
- Password field: password
- Data mapping (First name) : firstname
- Data mapping (Surname) : lastname
- Go to the Manage enrol plugins page and enable External database enrolment:
- Set the following value for the following fields:
- Database driver: pdo
- Database host: pgsql:host=localhost;port=5432;dbname=externaldb
- User/Password: to your user / password for postgres connexion
- Local course field: idnumber
- Local user field: username
- Local role field: shortname
- Local category field: id
- Remote user enrolment table: enroltable
- Remote course field: courseid
- Remote user field: userid
- Remote role field: role
- Remote new courses table: coursetable
- New course full name field: fullname
- New course short name field: shortname
- New course ID number field: idnumber
- Setup a course with:
- MDLQA-XXXX as Course ID number
- Ensure you can log in with "myuser" as username and "pw" as password.
External database example attached to this (you will need to change the MDLQA-XXX reference in the data).
Test steps:
- Run the cron or
php admin/cli/scheduled_task.php --execute='\enrol_database\task\sync_enrolments'
- Check the logs of the cron to see if the user has been enroled and new course created
Check that:
- A new user called "myuser" has been created
- A new course called
MDLQA-17174-autocreate has been created - That the user myuser is enrolled into the
MDLQA-17174course