From: Jason Boyer <JBoyer@library.in.gov>
Date: Fri, 7 Dec 2018 15:05:43 +0000 (-0500)
Subject: LP1807398: Add workstation to marc_stream_importer
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=60492d08be9037cf2a73f08d0d0e0deb7d4c4f79;p=evergreen%2Fjoelewis.git

LP1807398: Add workstation to marc_stream_importer

In order to work properly with vandelay session
tracking in 3.2+ a workstation is required at login.
This branch adds a workstation option to the importer
and alerts the user if it's missing.

Signed-off-by: Jason Boyer <JBoyer@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
---

diff --git a/Open-ILS/src/support-scripts/marc_stream_importer.pl b/Open-ILS/src/support-scripts/marc_stream_importer.pl
index 412d46646d..19e3f4903b 100755
--- a/Open-ILS/src/support-scripts/marc_stream_importer.pl
+++ b/Open-ILS/src/support-scripts/marc_stream_importer.pl
@@ -59,6 +59,7 @@ my $help        = 0;
 my $osrf_config = '/openils/conf/opensrf_core.xml';
 my $username    = '';
 my $password    = '';
+my $workstation = '';
 my $tempdir     = '';
 my $spoolfile   = '';
 my $wait_time   = 5;
@@ -94,6 +95,7 @@ GetOptions(
     'verbose'               => \$verbose,
     'username=s'            => \$username,
     'password=s'            => \$password,
+    'workstation'           => \$workstation,
     'tempdir=s'             => \$tempdir,
     'spoolfile=s'           => \$spoolfile,
     'wait=i'                => \$wait_time,
@@ -142,6 +144,9 @@ sub usage {
     --password
         Evergreen user account password
 
+    --workstation
+        Evergreen workstation
+
     --tempdir
         MARC data received via the network is stored in a temporary
         file so Vandelay can access it.  This must be a directory
@@ -226,8 +231,8 @@ if ($deprecated_queue) {
 }
 
 
-die "--username AND --password required.  --help for more info.\n" 
-    unless $username and $password;
+die "--username, --password, AND --workstation required.  --help for more info.\n" 
+    unless $username and $password and $workstation;
 die "--bib-queue OR --auth-queue required.  --help for more info.\n" 
     unless $bib_queue or $auth_queue;
 
@@ -503,7 +508,7 @@ sub process_file {
 # the authtoken will timeout after the configured inactivity period.
 # When that happens, get a new one.
 sub new_auth_token {
-    oils_login($username, $password, 'staff') 
+    oils_login($username, $password, 'staff', $workstation)
         or die "Unable to login to Evergreen as user $username";
 }
 
diff --git a/Open-ILS/src/support-scripts/oils_header.pl b/Open-ILS/src/support-scripts/oils_header.pl
index d0a1870950..de9a84fc92 100755
--- a/Open-ILS/src/support-scripts/oils_header.pl
+++ b/Open-ILS/src/support-scripts/oils_header.pl
@@ -160,11 +160,16 @@ sub oils_login {
 		'open-ils.auth.authenticate.init', $username, $nonce);
 	err("No auth seed") unless $seed;
 
+	my $opts = {	username => $username,
+			password => md5_hex($seed . md5_hex($password)),
+			type => $type };
+
+	if(defined($workstation)) {
+		$opts->{workstation} = $workstation;
+	}
+
 	my $response = $apputils->simplereq( $AUTH, 
-		'open-ils.auth.authenticate.complete', 
-		{	username => $username, 
-			password => md5_hex($seed . md5_hex($password)), 
-			type => $type, nonce => $nonce });
+		'open-ils.auth.authenticate.complete', $opts);
 
 	err("No auth response returned on login") unless $response;
 
diff --git a/docs/admin/marc_stream_importer.adoc b/docs/admin/marc_stream_importer.adoc
new file mode 100644
index 0000000000..75a755527c
--- /dev/null
+++ b/docs/admin/marc_stream_importer.adoc
@@ -0,0 +1,8 @@
+Changes to marc_stream_importer.pl command line options
+-----------------------
+
+To work properly with Vandelay session tracking a --workstation
+option is now required for the marc_stream_importer.pl script.
+It needs to be an existing workstation name in your system and
+if it is missing from the command line the script will fail and
+you will be notified.