-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.php
43 lines (34 loc) · 1.3 KB
/
event.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* Implement event hooks for the OpenID authentication plugin.
*
* NOTE: this file needs linked to via a symbolic link, eg.
*
* cd ../moodle-auth-openid && ln -s ../moodle-auth-ouopenid/event.php
*
* @package auth_ouopenid
* @author Nick Freear, 07-March-2017.
* @copyright (c) 2017 The Open University.
*
* @link https://github.com/remotelearner/moodle-auth_openid/blob/MOODLE_30_STABLE/example-event.php#L21-L34
*/
require_once __DIR__ . '/auth.php';
function on_openid_login(&$resp, &$user, $mainid = true) {
auth_plugin_ouopenid::debug([ __FUNCTION__, $resp->identity_url, $resp->message->args->values, $user ]);
auth_plugin_ouopenid::set_user($resp, $user, __FUNCTION__);
\auth_ouopenid\event\user_loggedin::create([
'userid' => $user->id,
'objectid'=> $user->id,
'other' => [ 'username' => $user->username ],
])->trigger();
}
function on_openid_create_account(&$resp, &$user) {
auth_plugin_ouopenid::debug([ __FUNCTION__, $resp->identity_url, $resp->message->args->values, $user ]);
auth_plugin_ouopenid::set_user($resp, $user, __FUNCTION__);
\auth_ouopenid\event\user_created::create([
'userid' => $user->id,
'objectid'=> $user->id,
'other' => [ 'username' => $user->username ],
])->trigger();
}
//End.