Desactivate profile editing with SSO - refs BT#9021

1.9.x
Angel Fernando Quiroz Campos 10 years ago
parent 71172358aa
commit a615444f03
  1. 26
      main/auth/sso/sso.Drupal.class.php
  2. 12
      main/auth/sso/sso.class.php
  3. 21
      main/social/home.php

@ -225,4 +225,30 @@ class ssoDrupal {
private function decode_cookie($cookie) {
return unserialize(base64_decode($cookie));
}
/**
* Generate the URL for profile editing
* @global array $_user
* @return string If the URL is obtained return the drupal_user_id. Otherwise return false
*/
public function generateProfileEditingURL()
{
global $_user;
$userId = $_user['user_id'];
$userExtraFieldValue = new ExtraFieldValue('user');
$drupalUserIdData = $userExtraFieldValue->get_values_by_handler_and_field_variable($userId, 'drupal_user_id');
if ($drupalUserIdData === false) {
return false;
}
$drupalUserId = $drupalUserIdData['field_value'];
$url = "{$this->protocol}{$this->domain}/user/{$drupalUserId}/edit";
return $url;
}
}

@ -254,4 +254,16 @@ class sso {
{
return unserialize(base64_decode($cookie));
}
/**
* Generate the URL for profile editing
* @return string The SSO URL
*/
public function generateProfileEditingURL()
{
$url = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
return $url;
}
}

@ -103,9 +103,28 @@ $list = array(
);
// information current user
$socialRightContent .= '<div>' . Display::description($list) . '</div>';
$editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
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();
}
$socialRightContent .= '
<div class="form-actions">
<a class="btn" href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php">
<a class="btn" href="' . $editProfileUrl . '">
' . get_lang('EditProfile') . '
</a>
</div></div></div>';

Loading…
Cancel
Save