Redirect to SSO when profile editing - refs BT#9062

Conflicts:
	main/admin/user_list.php
1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent fddc3f43ac
commit 4f5b267036
  1. 22
      main/admin/user_list.php
  2. 18
      main/auth/sso/sso.Drupal.class.php
  3. 16
      main/auth/sso/sso.class.php

@ -559,9 +559,27 @@ function modify_filter($user_id, $url_params, $row) {
}
if (api_is_platform_admin(true)) {
$editProfileUrl = api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=$user_id";
if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) {
$result .= '<a href="user_edit.php?user_id='.$user_id.'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
if (api_get_setting('sso_authentication') === 'true') {
$subSSOClass = api_get_setting('sso_authentication_subclass');
$objSSO = null;
if (!empty($subSSOClass)) {
require_once api_get_path(SYS_CODE_PATH) . "auth/sso/sso.$subSSOClass.class.php";
$subSSOClass = 'sso' . $subSSOClass;
$objSSO = new $subSSOClass();
} else {
$objSSO = new sso();
}
$editProfileUrl = $objSSO->generateProfileEditingURL($user_id, true);
}
if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) {
$result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
} else {
$result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
}

@ -227,18 +227,28 @@ class ssoDrupal {
}
/**
* Generate the URL for profile editing
* Generate the URL for profile editing for a any user or the current user
* @param int $userId Optional. The user id
* @param boolean $asAdmin Optional. Whether get the URL for the platform admin
* @return string If the URL is obtained return the drupal_user_id. Otherwise return false
*/
public function generateProfileEditingURL()
public function generateProfileEditingURL($userId = 0, $asAdmin = false)
{
$userId = api_get_user_id();
$userId = intval($userId);
if (empty($userId)) {
$userId = api_get_user_id();
}
$userExtraFieldValue = new ExtraFieldValue('user');
$drupalUserIdData = $userExtraFieldValue->get_values_by_handler_and_field_variable($userId, 'drupal_user_id');
if ($drupalUserIdData === false) {
return 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';
}
$drupalUserId = $drupalUserIdData['field_value'];

@ -256,14 +256,20 @@ class sso {
}
/**
* Generate the URL for profile editing
* @return string The SSO URL
* Generate the URL for profile editing for a any user or the current user
* @param int $userId Optional. The user id
* @param boolean $asAdmin Optional. Whether get the URL for the platform admin
* @return string The SSO URL
*/
public function generateProfileEditingURL()
public function generateProfileEditingURL($userId = 0, $asAdmin = false)
{
$url = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
$userId = intval($userId);
return $url;
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';
}
}

Loading…
Cancel
Save