Commit 00378f8c authored by Donal McMullan's avatar Donal McMullan
Browse files

New auth_get_auth_instance function, to get user's auth method

parent b441986d
......@@ -399,6 +399,22 @@ function auth_get_auth_instances_for_institution($institution) {
return $cache[$institution];
}
/**
* Given a user, returns the authentication instance used.
*
* @param object $user User object with an authinstance member
* @return array Array of auth instance records
*/
function auth_get_auth_instance($user) {
static $cache = array();
if (!isset($cache[$user->id])) {
$cache[$user->id] = get_record('auth_instance', 'id', $user->authinstance, null, null, null, null, 'id, instancename, priority, authname');
}
return $cache[$user->id];
}
/**
* Checks whether the current user needs to change their password, and handles
* the password changing if it's required.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment