Browse Source

added configuration option so we could specify guest or not gutest access to ebsco

2.x-ebsco
Paul Pound 10 years ago
parent
commit
d54d94a186
  1. 5
      targets/eds/includes/rest/EBSCOAPI.php
  2. 8
      targets/eds/roblib_search_eds.module

5
targets/eds/includes/rest/EBSCOAPI.php

@ -233,6 +233,7 @@ class EBSCOAPI {
* @access public * @access public
*/ */
public function getSessionToken($authenToken, $invalid = 'n') { public function getSessionToken($authenToken, $invalid = 'n') {
$guest = variable_get('roblib_search_eds_guest','n');
$token = ''; $token = '';
// Check user's login status // Check user's login status
@ -251,7 +252,7 @@ class EBSCOAPI {
if (empty($profile)) { if (empty($profile)) {
$profile = $_COOKIE['Guest']; $profile = $_COOKIE['Guest'];
} }
$sessionToken = $this->apiSessionToken($authenToken, $profile, 'y'); $sessionToken = $this->apiSessionToken($authenToken, $profile, $guest);
$_SESSION['sessionToken'] = $sessionToken; $_SESSION['sessionToken'] = $sessionToken;
} }
$token = $_SESSION['sessionToken']['sessionToken']; $token = $_SESSION['sessionToken']['sessionToken'];
@ -260,7 +261,7 @@ class EBSCOAPI {
$profileId = $this->config['profile']; $profileId = $this->config['profile'];
$sessionToken = $this->apiSessionToken($authenToken, $profileId, 'y'); $sessionToken = $this->apiSessionToken($authenToken, $profileId, $guest);
$_SESSION['profile'] = $profileId; $_SESSION['profile'] = $profileId;
$_SESSION['sessionToken'] = $sessionToken; $_SESSION['sessionToken'] = $sessionToken;
setcookie("Guest", $profileId, 0); setcookie("Guest", $profileId, 0);

8
targets/eds/roblib_search_eds.module

@ -90,6 +90,14 @@ function roblib_search_eds_config_form($form, &$form_state) {
'#required' => TRUE, '#required' => TRUE,
); );
$form['roblib_search_eds_guest'] = array(
'#type' => 'textfield',
'#title' => t('EDS Guest access'),
'#default_value' => variable_get('roblib_search_eds_guest', 'y'),
'#description' => t('EDS Guest access, y = guest access, n = not a guest'),
'#required' => TRUE,
);
$form['roblib_search_eds_profile'] = array( $form['roblib_search_eds_profile'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('EDS profile'), '#title' => t('EDS profile'),

Loading…
Cancel
Save