Skip to content

Commit

Permalink
Recover normal profile edition in case of Drupal SSO - refs BT#9062
Browse files Browse the repository at this point in the history
  • Loading branch information
ywarnier committed Feb 20, 2015
1 parent 365967d commit 2352430
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions main/auth/sso/sso.Drupal.class.php
Expand Up @@ -243,18 +243,19 @@ public function generateProfileEditingURL($userId = 0, $asAdmin = false)
$userExtraFieldValue = new ExtraFieldValue('user');
$drupalUserIdData = $userExtraFieldValue->get_values_by_handler_and_field_variable($userId, 'drupal_user_id');

// If this is an administrator, allow him to make some changes in
// the Chamilo profile
if ($asAdmin && api_is_platform_admin(true)) {
return api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=$userId";
}
// If the user doesn't match a Drupal user, give the normal profile
// link
if ($drupalUserIdData === false) {
if ($asAdmin && api_is_platform_admin(true)) {
return api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=$userId";
}

return api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
}

// In all other cases, generate a link to the Drupal profile edition
$drupalUserId = $drupalUserIdData['field_value'];

$url = "{$this->protocol}{$this->domain}/user/{$drupalUserId}/edit";

return $url;
}

Expand Down

0 comments on commit 2352430

Please sign in to comment.