Hide
Testing instructions
All of the following tests require access to an LDAP server with the Moodle LDAP authentication plugin enabled and configured to connect to this external server. These tests also require administrative access to the LDAP server with the ability to add and remove accounts.
NOTE: In all of the following queries, replace the mdl_ table name prefix with the value used in your local development environment if not using the default configuration.
Run the following queries:
INSERT INTO mdl_events_handlers (id, eventname, component, handlerfile, handlerfunction, schedule, status, internal)
|
VALUES (NULL, 'user_created', 'auth_ldap', '/auth/ldap/auth.php', 'a:2:{i:0;s:16:"auth_plugin_ldap";i:1;s:11:"init_plugin";}', 'cron', '0', '1');
|
|
INSERT INTO mdl_events_handlers (id, eventname, component, handlerfile, handlerfunction, schedule, status, internal)
|
VALUES (NULL, 'user_updated', 'auth_ldap', '/auth/ldap/auth.php', 'a:2:{i:0;s:16:"auth_plugin_ldap";i:1;s:11:"init_plugin";}', 'cron', '0', '1');
|
Queued event check query:
-
SELECT h.eventname, h.component, h.handlerfile, q.*
|
FROM mdl_events_queue q
|
INNER JOIN mdl_events_queue_handlers qh ON qh.queuedeventid = q.id
|
INNER JOIN mdl_events_handlers h ON h.id = qh.handlerid
|
WHERE h.component = 'auth_ldap'
|
AND h.handlerfile = '/auth/ldap/auth.php'
|
AND h.schedule = 'cron'
|
AND (h.eventname = 'user_updated' OR h.eventname = 'user_created');
|
Queued event purge queries:
- MySQL:
-
DELETE q
|
FROM mdl_events_queue q
|
INNER JOIN mdl_events_queue_handlers qh ON qh.queuedeventid = q.id
|
INNER JOIN mdl_events_handlers h ON h.id = qh.handlerid
|
WHERE h.component = 'auth_ldap'
|
AND h.handlerfile = '/auth/ldap/auth.php'
|
AND h.schedule = 'cron'
|
AND (h.eventname = 'user_updated' OR h.eventname = 'user_created');
|
- Other:
-
DELETE FROM mdl_events_queue
|
WHERE EXISTS (
|
SELECT q.*
|
FROM mdl_events_queue q
|
INNER JOIN mdl_events_queue_handlers qh ON qh.queuedeventid = q.id
|
INNER JOIN mdl_events_handlers h ON h.id = qh.handlerid
|
WHERE h.component = 'auth_ldap'
|
AND h.handlerfile = '/auth/ldap/auth.php'
|
AND h.schedule = 'cron'
|
AND (h.eventname = 'user_updated' OR h.eventname = 'user_created')
|
);
|
user_updated event when creating a new external user
NOTE: this test requires email sending to be active on your Moodle test site as a confirmation email is sent out during the test.
- Log into the site as a site administrator
- Navigate to Settings > Plugins > Authentication > LDAP server
- Set the Create users externally setting to Yes
- Set the Context for new users setting to a valid context on the LDAP server
- Click on Save changes
- Navigate to Settings > Plugins > Authentication > Manage authentication
- Set the Self registration setting to LDAP Server and click on Save changes
- Logout of the site
- Click on a *Login * link
- Click on the Create new account button
- Fill out the required fields (be sure to enter an email address that you can receive mail for) and click the Create my new account button
- Wait for the confirmation email to arrive and click on the confirmation link in the email
- Run the queued event check query listed above
- You should see a single user_updated record returned
- Run the appropriate database query listed above to purge queued events
user_updated event when suspending an externally deleted user
- Run the CLI script /auth/ldap/cli/sync_users.php to ensure that all of the users from the LDAP server have Moodle accounts created
- Log into the site as a site administrator
- Navigate to Settings > Plugins > Authentication > LDAP server
- Set the Removed ext user setting to the value of Suspend internal and click on Save changes
- Remove a user account from the LDAP server that can be found by Moodle (based on the current search configuration within the LDAP auth plugin)
- Run the CLI script /auth/ldap/cli/sync_users.php
- Run the queued event check query listed above
- You should see a single user_updated record returned
- Run the appropriate database query listed above to purge queued events
user_updated event when "reactivating" a previously externally deleted user account
- Complete the test above
- Recreate the LDAP user account that was removed in step 4 from the test above
- Run the CLI script /auth/ldap/cli/sync_users.php
- Run the queued event check query listed above
- You should see a single user_updated record returned
- Run the appropriate database query listed above to purge queued events
user_created event when adding a new external user account
- Create a new user account in the LDAP server that can be found by Moodle (based on the current search configuration within the LDAP auth plugin)
- Run the CLI script /auth/ldap/cli/sync_users.php
- Run the queued event check query listed above
- You should see a single user_created record returned
- Run the appropriate database query listed above to purge queued events
user_updated event when modifying an external user account
- Modify an existing user account in the LDAP server that can be found by Moodle (change the firstname and lastname values) based on the current search configuration within the LDAP auth plugin)
- Run the CLI script /auth/ldap/cli/sync_users.php
- Run the queued event check query listed above
- You should see a single user_updated record returned
- Run the appropriate database query listed above to purge queued events
Show
Testing instructions
All of the following tests require access to an LDAP server with the Moodle LDAP authentication plugin enabled and configured to connect to this external server. These tests also require administrative access to the LDAP server with the ability to add and remove accounts.
NOTE: In all of the following queries, replace the mdl_ table name prefix with the value used in your local development environment if not using the default configuration.
Run the following queries:
INSERT INTO mdl_events_handlers (id, eventname, component, handlerfile, handlerfunction, schedule, status, internal)
VALUES (NULL, 'user_created', 'auth_ldap', '/auth/ldap/auth.php', 'a:2:{i:0;s:16:"auth_plugin_ldap";i:1;s:11:"init_plugin";}', 'cron', '0', '1');
INSERT INTO mdl_events_handlers (id, eventname, component, handlerfile, handlerfunction, schedule, status, internal)
VALUES (NULL, 'user_updated', 'auth_ldap', '/auth/ldap/auth.php', 'a:2:{i:0;s:16:"auth_plugin_ldap";i:1;s:11:"init_plugin";}', 'cron', '0', '1');
Queued event check query:
SELECT h.eventname, h.component, h.handlerfile, q.*
FROM mdl_events_queue q
INNER JOIN mdl_events_queue_handlers qh ON qh.queuedeventid = q.id
INNER JOIN mdl_events_handlers h ON h.id = qh.handlerid
WHERE h.component = 'auth_ldap'
AND h.handlerfile = '/auth/ldap/auth.php'
AND h.schedule = 'cron'
AND (h.eventname = 'user_updated' OR h.eventname = 'user_created');
Queued event purge queries:
MySQL:
DELETE q
FROM mdl_events_queue q
INNER JOIN mdl_events_queue_handlers qh ON qh.queuedeventid = q.id
INNER JOIN mdl_events_handlers h ON h.id = qh.handlerid
WHERE h.component = 'auth_ldap'
AND h.handlerfile = '/auth/ldap/auth.php'
AND h.schedule = 'cron'
AND (h.eventname = 'user_updated' OR h.eventname = 'user_created');
Other:
DELETE FROM mdl_events_queue
WHERE EXISTS (
SELECT q.*
FROM mdl_events_queue q
INNER JOIN mdl_events_queue_handlers qh ON qh.queuedeventid = q.id
INNER JOIN mdl_events_handlers h ON h.id = qh.handlerid
WHERE h.component = 'auth_ldap'
AND h.handlerfile = '/auth/ldap/auth.php'
AND h.schedule = 'cron'
AND (h.eventname = 'user_updated' OR h.eventname = 'user_created')
);
user_updated event when creating a new external user
NOTE: this test requires email sending to be active on your Moodle test site as a confirmation email is sent out during the test.
Log into the site as a site administrator
Navigate to Settings > Plugins > Authentication > LDAP server
Set the Create users externally setting to Yes
Set the Context for new users setting to a valid context on the LDAP server
Click on Save changes
Navigate to Settings > Plugins > Authentication > Manage authentication
Set the Self registration setting to LDAP Server and click on Save changes
Logout of the site
Click on a *Login * link
Click on the Create new account button
Fill out the required fields (be sure to enter an email address that you can receive mail for) and click the Create my new account button
Wait for the confirmation email to arrive and click on the confirmation link in the email
Run the queued event check query listed above
You should see a single user_updated record returned
Run the appropriate database query listed above to purge queued events
user_updated event when suspending an externally deleted user
Run the CLI script /auth/ldap/cli/sync_users.php to ensure that all of the users from the LDAP server have Moodle accounts created
Log into the site as a site administrator
Navigate to Settings > Plugins > Authentication > LDAP server
Set the Removed ext user setting to the value of Suspend internal and click on Save changes
Remove a user account from the LDAP server that can be found by Moodle (based on the current search configuration within the LDAP auth plugin)
Run the CLI script /auth/ldap/cli/sync_users.php
Run the queued event check query listed above
You should see a single user_updated record returned
Run the appropriate database query listed above to purge queued events
user_updated event when "reactivating" a previously externally deleted user account
Complete the test above
Recreate the LDAP user account that was removed in step 4 from the test above
Run the CLI script /auth/ldap/cli/sync_users.php
Run the queued event check query listed above
You should see a single user_updated record returned
Run the appropriate database query listed above to purge queued events
user_created event when adding a new external user account
Create a new user account in the LDAP server that can be found by Moodle (based on the current search configuration within the LDAP auth plugin)
Run the CLI script /auth/ldap/cli/sync_users.php
Run the queued event check query listed above
You should see a single user_created record returned
Run the appropriate database query listed above to purge queued events
user_updated event when modifying an external user account
Modify an existing user account in the LDAP server that can be found by Moodle (change the firstname and lastname values) based on the current search configuration within the LDAP auth plugin)
Run the CLI script /auth/ldap/cli/sync_users.php
Run the queued event check query listed above
You should see a single user_updated record returned
Run the appropriate database query listed above to purge queued events