Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
# Conflicts:
#	module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php
#	module/Swissbib/src/Swissbib/View/Helper/NationalLicences.php
  • Loading branch information
edelm committed Dec 22, 2016
2 parents 79da6f8 + f4c8e17 commit 3a6c201
Show file tree
Hide file tree
Showing 18 changed files with 227 additions and 199 deletions.
62 changes: 62 additions & 0 deletions local/config/vufind/NationalLicences.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[SwitchApi]
national_licence_programme_group_id = 1d3baa7b-da70-440d-b777-5bb2d11f8718
base_endpoint_url = https://eduid.ch/sg/index.php
back_channel_param_entityID = https://eduid.ch/idp/shibboleth
back_channel_endpoint_path = /Shibboleth.sso/AttributeResolver
schema_patch = urn:ietf:params:scim:api:messages:2.0:PatchOp
operation_add = add
operation_remove = remove
path_member = members

[NationalLicenceService]
allowed_mobile_prefixes[] = +41 79
allowed_mobile_prefixes[] = +41 78
allowed_mobile_prefixes[] = +41 77
allowed_mobile_prefixes[] = +41 76
user_export_path = /local/export/nationalLicence
user_export_filename = user_export.csv
user_export_default_email_address_to = [email protected]
national_licence_user_fields_to_export[] = home_postal_address
national_licence_user_fields_to_export[] = swiss_library_person_residence
national_licence_user_fields_to_export[] = condition_accepted
national_licence_user_fields_to_export[] = request_temporary_access
national_licence_user_fields_to_export[] = request_permanent_access
national_licence_user_fields_to_export[] = date_expiration
national_licence_user_fields_to_export[] = blocked
national_licence_user_fields_to_export[] = active_last_12_month
national_licence_user_fields_to_export[] = persistent_id
vufind_user_fields_to_export[] = firstname
vufind_user_fields_to_export[] = lastname
vufind_user_fields_to_export[] = email
request_account_extension_expiration_days = 30
temporary_access_expiration_days = 14

[EmailService]
#Change with the production address
default_email_address_from = [email protected]
SmtpOptions.name = host
#Change with production SMTP server host
SmtpOptions.host = smtp.gmail.com
SmtpOptions.port= 587
SmtpOptions.connection_class = login
SmtpOptions.connection_config[ssl] = tls

#Unit test configuration
[Test]
switchApi.external_id_test = [email protected]
emailService[email_service] =
emailService[default_email_address_to] =
emailService[default_email_address_from] = [email protected]

[PublisherUrls]
nl-gruyter-unauthorized="https://www.degruyter.com/applib/openathens?entityID=https%3A%2F%2Feduid.ch%2Fidp%2Fshibboleth&openAthens2Redirect=https%3A%2F%2Fwww.degruyter.com%2Fdoi%2F{DOI}"
nl-cambridge-unauthorized="https://shibboleth.cambridge.org/Shibboleth.sso/discovery?entityID=https%3A%2F%2Feduid.ch%2Fidp%2Fshibboleth&target=https://shibboleth.cambridge.org/CJOShibb2/index?app=https://www.cambridge.org/core/shibboleth?ref=%2Fcore%2Fproduct%2Fidentifier%2F{PII}%2Ftype%2FJOURNAL_ARTICLE"
nl-oxford-unauthorized="https://shibboleth.highwire.org/session/init?entityID=https%3A%2F%2Feduid.ch%2Fidp%2Fshibboleth&hw-shib-return-uri=http%3A%2F%2F{JOURNAL-URL-CODE}.oxfordjournals.org%2Flookup%2Fdoi%2F{DOI}&subcode=oupjournals&env=prod"
nl-gruyter-authorized="https://www.degruyter.com/doi/{DOI}"
nl-cambridge-authorized="http://www.cambridge.org/core/product/identifier/{PII}/type/JOURNAL_ARTICLE"
nl-oxford-authorized="http://{JOURNAL-URL-CODE}.oxfordjournals.org/lookup/doi/{DOI}"
;nl-oxford-authorized="http://{JOURNAL-URL-CODE}.oxfordjournals.org/content/{VOLUME}/{ISSUE}/{SPAGE}.long"

[NationaLicensesWorkflow]
swissEduIdIDP = eduid\.ch\/idp
swissEduIdLoginLink = "https://login.eduid.ch/idp/profile/SAML2/Unsolicited/SSO?providerId=https%3A%2F%2F{SERVER_HTTP_HOST}%2Fshibboleth&target=https%3A%2F%2F{SERVER_HTTP_HOST}%2FMyResearchNationalLicenses%2FNlsignpost%3Fpublisher%3D{PUBLISHER_URL}"
4 changes: 1 addition & 3 deletions local/config/vufind/config_base.ini
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,4 @@ disable_from = true
;custom_variables = true


[NationaLicensesWorkflow]
swissEduIdIDP = eduid\.ch\/idp
swissEduIdLoginLink = "https://login.eduid.ch/idp/profile/SAML2/Unsolicited/SSO?providerId=https%3A%2F%2F{SERVER_HTTP_HOST}%2Fshibboleth&target=https%3A%2F%2F{SERVER_HTTP_HOST}%2FMyResearchNationalLicenses%2FNlsignpost%3Fpublisher%3D{PUBLISHER_URL}"

87 changes: 15 additions & 72 deletions module/Swissbib/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@
],
]
],
// Swiss National Licences
'national-licenses-signpost' => [
'type' => 'segment',
'options' => [
'route' => '/MyResearchNationalLicenses[/:action]',
'defaults' => [
'controller' => 'national-licenses-signpost',
'action' => 'nlsignpost'
],
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]*'
],
]
],
'help-page' => [
'type' => 'segment',
'options' => [
Expand Down Expand Up @@ -233,6 +247,7 @@
'record' => 'Swissbib\Controller\Factory::getRecordController',
'cart' => 'VuFind\Controller\Factory::getCartController',
'national-licences' => 'Swissbib\Controller\Factory::getNationalLicenceController',
'national-licenses-signpost' => 'Swissbib\Controller\Factory::getMyResearchNationalLicenceController',
]
],
'service_manager' => [
Expand Down Expand Up @@ -441,78 +456,6 @@
'invokeables' => [
'nationallicence' => 'Swissbib\VuFind\Db\Table\NationalLicenceUser'
]
],
'switch_api' => [
'national_licence_programme_group_id' =>
"f4d40595-6d7d-41bc-9fa2-7139d2fcf892",
'base_endpoint_url' => "https://test.eduid.ch/sg/index.php",
'base_endpoint_url_back_channel' => 'https://test.swissbib.ch',
'back_channel_param_entityID' => 'https://test.eduid.ch/idp/shibboleth',
'back_channel_endpoint_path' => '/Shibboleth.sso/AttributeResolver',
'auth_user' => getenv("SWITCH_API_USER"),
'auth_password' => getenv("SWITCH_API_PASSW"),
'schema_patch' => "urn:ietf:params:scim:api:messages:2.0:PatchOp",
'operation_add' => "add",
'operation_remove' => "remove",
'path_member' => "members"
],
'national_licence_service' => [
//Change with the production host address
'base_domain_path' => 'https://test.swissbib.ch',
'allowed_mobile_prefixes' => ['+41 79', '+41 78','+41 77' ,'+41 76'],
'user_export_path' => '/export/nationalLicence',
'user_export_filename' => 'user_export.csv',
'user_export_default_email_address_to' => '[email protected] ',
'national_licence_user_fields_to_export' => [
'mobile',
'home_postal_address',
'swiss_library_person_residence',
'condition_accepted',
'request_temporary_access',
'request_permanent_access',
'date_expiration',
'blocked',
'active_last_12_month',
'created'
],
'vufind_user_fields_to_export' => [
'firstname',
'lastname',
'email',
],
'request_account_extension_expiration_days' => 30,
'temporary_access_expiration_days' => 14
],
'email_service' => [
//Change with the production address
'default_email_address_from' => '[email protected] ',
'smtp_options' => [
'name' => 'host',
//Change with production SMTP server host
'host' => 'smtp.gmail.com',
'port' => 587,
'connection_class' => 'login',
'connection_config' => [
//Change with production SMTP credentials
'username' => "",
'password' => '',
'ssl' => 'tls',
]
]
],
'tests' => [ //Unit test configuration
'switch_api' => [
'external_id_test' => '[email protected]',
'auth_user' => 'natlic',
'auth_password' => 'Amg6vZXo',
],
'national_licence_service' => [

],
'email_service' => [
'default_email_address_to' => '',
'default_email_address_from' => '[email protected]',
],
]
],
];
3 changes: 1 addition & 2 deletions module/Swissbib/src/Swissbib/Controller/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public function myresearchbulkAction()
try {
return parent::myresearchbulkAction();
} catch (\Exception $e) {
$this->flashMessenger()->setNamespace('error')
->addMessage($e->getMessage());
$this->flashMessenger()->addMessage($e->getMessage(), 'error');

$target = $this->url()->fromRoute('myresearch-home');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ public function emailAction()
$this->sendMail($feedbackForm->getData());
$this->resetForm($feedbackForm);

$this->flashMessenger()->setNamespace('success')
->addMessage('feedback.form.success');
$this->flashMessenger()
->addMessage('feedback.form.success', 'success');
} else {
$this->flashMessenger()->setNamespace('error')
->addMessage('feedback.form.error');
$this->flashMessenger()
->addMessage('feedback.form.error', 'error');
}
}

Expand Down
20 changes: 10 additions & 10 deletions module/Swissbib/src/Swissbib/Controller/MyResearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ public function settingsAction()

$user->save();

$this->flashMessenger()->setNamespace('success')->addMessage(
'save_settings_success'
$this->flashMessenger()->addMessage(
'save_settings_success', 'success'
);

setcookie('language', $language, time() + 3600 * 24 * 100, '/');
Expand Down Expand Up @@ -502,21 +502,21 @@ public function changeAddressAction()
$address['z304-date-to'];

$this->getILS()->changeMyAddress($patron, $newAddress);
$this->flashMessenger()->setNamespace('success')
->addMessage('save_address_success');
$this->flashMessenger()
->addMessage('save_address_success', 'success');
} else {
$this->flashMessenger()->setNamespace('error')
->addMessage('save_address_error');
$this->flashMessenger()
->addMessage('save_address_error', 'error');
}
} else {
$addressForm->setData($this->getILS()->getMyAddress($patron));
}
} catch (AlephRestfulException $e) {
$this->flashMessenger()->setNamespace('error')
->addMessage('address_error');
$this->flashMessenger()
->addMessage('address_error', 'error');
} catch (ILS $e) {
$this->flashMessenger()->setNamespace('error')
->addMessage('address_error');
$this->flashMessenger()
->addMessage('address_error', 'error');

return $this->createViewModel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ protected function initializeServiceInstance()
]
);
} catch (\Exception $e) {
$this->flashMessenger()->setNamespace('error')->addMessage(
$this->translate($e->getMessage())
$this->flashMessenger()->addMessage(
$this->translate($e->getMessage(), 'error')
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public function indexAction()
]
);
} catch (\Exception $e) {
$this->flashMessenger()->setNamespace('error')->addMessage(
$this->translate($e->getMessage())
$this->flashMessenger()->addMessage(
$this->translate($e->getMessage(), 'error')
);
}

Expand Down Expand Up @@ -207,11 +207,11 @@ public function acceptTermsConditionsAction()
try {
$this->nationalLicenceService->acceptTermsConditions();
} catch (\Exception $e) {
$this->flashMessenger()->setNamespace('error')->addMessage(
$this->translate($e->getMessage())
$this->flashMessenger()->addMessage(
$this->translate($e->getMessage(), 'error')
);
}
$this->redirect()->toRoute('national-licences');
return $this->redirect()->toRoute('national-licences');
}

/**
Expand All @@ -226,23 +226,28 @@ public function activateTemporaryAccessAction()
$accessCreatedSuccessfully
= $this->nationalLicenceService->createTemporaryAccessForUser();
} catch (\Exception $e) {
$this->flashMessenger()->setNamespace('error')->addMessage(
$this->translate($e->getMessage())
$this->flashMessenger()->addMessage(
$this->translate($e->getMessage(), 'error')
);
$this->redirect()->toRoute('national-licences');

return;
}
if (!$accessCreatedSuccessfully) {
$this->flashMessenger()->setNamespace('error')->addMessage(
$this->translate('snl.wasNotPossibleToCreateTemporaryAccessError')
$this->flashMessenger()->addMessage(
$this->translate(
'snl.wasNotPossibleToCreateTemporaryAccessError', 'error'
)
);
$this->redirect()->toRoute('national-licences');

return;
}
$this->flashMessenger()->setNamespace('success')->addMessage(
$this->translate('snl.yourTemporaryAccessWasCreatedSuccessfully')
$this->flashMessenger()->addMessage(
$this->translate(
'snl.yourTemporaryAccessWasCreatedSuccessfully',
'success'
)
);
$this->redirect()->toRoute('national-licences');
}
Expand All @@ -257,12 +262,14 @@ public function activatePermanentAccessAction()
{
try {
$this->nationalLicenceService->setNationalLicenceCompliantFlag();
$this->flashMessenger()->setNamespace('success')->addMessage(
$this->translate('snl.yourRequestPermanentAccessSuccessful')
$this->flashMessenger()->addMessage(
$this->translate(
'snl.yourRequestPermanentAccessSuccessful', 'success'
)
);
} catch (\Exception $e) {
$this->flashMessenger()->setNamespace('error')->addMessage(
$this->translate($e->getMessage())
$this->flashMessenger()->addMessage(
$this->translate($e->getMessage(), 'error')
);
}
$this->redirect()->toRoute('national-licences');
Expand Down Expand Up @@ -293,13 +300,13 @@ public function extendAccountAction()
$this->nationalLicenceService->extendAccountIfCompliant();
if ($this->nationalLicenceService->isSetMessage()) {
$message = $this->nationalLicenceService->getMessage();
$this->flashMessenger()->setNamespace($message['type'])->addMessage(
$this->translate($message['text'])
$this->flashMessenger()->addMessage(
$this->translate($message['text'], $message['type'])
);
}
} catch (\Exception $e) {
$this->flashMessenger()->setNamespace('error')->addMessage(
$this->translate($e->getMessage())
$this->flashMessenger()->addMessage(
$this->translate($e->getMessage(), 'error')
);
}
//redirect to home page
Expand Down
Loading

0 comments on commit 3a6c201

Please sign in to comment.