Skip to content

Commit 7d4c952

Browse files
committed
Merge pull request #20 from albertslundbib/user_fixes
User fixes
2 parents 37f37c0 + 84fd0c7 commit 7d4c952

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ding_library_user/ding_library_user.module

+8
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,14 @@ function ding_library_user_user_login_validate($form, &$form_state) {
294294
// This sets the proper global $user.
295295
user_external_login_register($auth_name, 'ding_library_user');
296296

297+
// But it doesn't check if the user is active.
298+
if (!$user->status) {
299+
watchdog('ding_library_user', 'Provider accepted user, but local user is blocked.', NULL, WATCHDOG_WARNING, l('user edit', 'user/' . $user->uid . '/edit'));
300+
// Reset user to anonymous.
301+
$user = drupal_anonymous_user();
302+
return;
303+
}
304+
297305
// Let authenticate module provide some properties for the $user
298306
// object. Thus they can set properties that gets used in
299307
// hook_user('login').

ding_library_user/plugins/content_types/personal_info.inc

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ function ding_library_user_personal_info_content_type_render($subtype, $conf, $p
2828

2929
if ($creds != DING_PROVIDER_AUTH_REQUIRED) {
3030
$block->title = t('Personal information');
31-
$library_user_data = alma_client_invoke('get_patron_info', $creds['user_id'], $creds['password'], TRUE);
31+
$library_user_data = array();
32+
if (ding_provider_supports('user', 'personal_info')) {
33+
$library_user_data = ding_provider_invoke('user', 'personal_info', $account);
34+
}
3235

3336
if (!isset($library_user_data['blocks']) || empty($library_user_data['blocks'])) {
3437
$block->content = theme('ding_library_user_personal_info', $account, $library_user_data);
@@ -51,7 +54,7 @@ function ding_library_user_personal_info_content_type_admin_title($subtype, $con
5154
/**
5255
* Returns an edit form for the content type.
5356
*
54-
* We're not actually doing anything here, but we need to have this hook
57+
* We're not actually doing anything here, but we need to have this hook
5558
* for this content type to work.
5659
*/
5760
function ding_library_user_personal_info_content_type_edit_form(&$form, &$form_state) {

0 commit comments

Comments
 (0)