From f06c3c2110e164b01a46014972258ba41423aa7a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 4 Jun 2018 12:10:20 -0400 Subject: [PATCH] LP#1750894 Server-stored workstaion prefs admin view Adds a new "Server Workstation Prefs" tab to the stored preferences workstation admin interface. From here, users can view which preferences are stored as server-stored workstation preferences and delete select values. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- .../lib/OpenILS/Application/Actor/Settings.pm | 14 +++++++++++++- .../staff/admin/workstation/t_stored_prefs.tt2 | 7 +++++-- .../js/ui/default/staff/admin/workstation/app.js | 16 +++++++++++++--- .../web/js/ui/default/staff/services/hatch.js | 4 ++-- .../Client/workstation-server-settings.adoc | 8 ++++++++ 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Settings.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Settings.pm index 29d5e9ed49..f627a1638f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Settings.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Settings.pm @@ -248,6 +248,14 @@ __PACKAGE__->register_method ( This is a staff-only API created primarily to support the getKeys() functionality used in the browser client for server-managed settings. + + Note as of now, this API can return names for user settings + which are unrelated to the staff client. ALL user setting + names matching the selected prefix are returned! + + Use the workstation_only option to avoid returning any user + setting names. + /, params => [ {desc => 'authtoken', type => 'string'}, @@ -264,12 +272,14 @@ __PACKAGE__->register_method ( ); sub applied_settings { - my ($self, $client, $auth, $prefix) = @_; + my ($self, $client, $auth, $prefix, $options) = @_; my $e = new_editor(authtoken => $auth); return $e->event unless $e->checkauth; return $e->event unless $e->allowed('STAFF_LOGIN'); + $options ||= {}; + my $query = { select => {awss => ['name']}, from => 'awss', @@ -284,6 +294,8 @@ sub applied_settings { $client->respond($key->{name}); } + return undef if $options->{workstation_only}; + $query = { select => {aus => ['name']}, from => 'aus', diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_stored_prefs.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_stored_prefs.tt2 index dc031b44bb..641a73ffc7 100644 --- a/Open-ILS/src/templates/staff/admin/workstation/t_stored_prefs.tt2 +++ b/Open-ILS/src/templates/staff/admin/workstation/t_stored_prefs.tt2 @@ -26,10 +26,13 @@ Click on the delete (X) button to remove a preference's value.
diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js index 98dc9b77e8..9af1c00dea 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js @@ -746,7 +746,7 @@ function($scope , $q , egCore , egConfirmDialog) { // fetch the keys function refreshKeys() { - $scope.keys = {local : [], remote : []}; + $scope.keys = {local : [], remote : [], server_workstation: []}; if (egCore.hatch.hatchAvailable) { egCore.hatch.getRemoteKeys().then( @@ -755,6 +755,9 @@ function($scope , $q , egCore , egConfirmDialog) { // local calls are non-async $scope.keys.local = egCore.hatch.getLocalKeys(); + + egCore.hatch.getServerKeys(null, {workstation_only: true}).then( + function(keys) {$scope.keys.server_workstation = keys}); } refreshKeys(); @@ -764,11 +767,15 @@ function($scope , $q , egCore , egConfirmDialog) { if ($scope.context == 'local') { $scope.currentKeyContent = egCore.hatch.getLocalItem(key); - } else { + } else if ($scope.context == 'remote') { egCore.hatch.getRemoteItem(key) .then(function(content) { $scope.currentKeyContent = content }); + } else if ($scope.context == 'server_workstation') { + egCore.hatch.getServerItem(key).then(function(content) { + $scope.currentKeyContent = content; + }); } } @@ -784,11 +791,14 @@ function($scope , $q , egCore , egConfirmDialog) { if ($scope.context == 'local') { egCore.hatch.removeLocalItem(key); refreshKeys(); - } else { + } else if ($scope.context == 'remote') { // Honor requests to remove items from Hatch even // when Hatch is configured for data storage. egCore.hatch.removeRemoteItem(key) .then(function() { refreshKeys() }); + } else if ($scope.context == 'server_workstation') { + egCore.hatch.removeServerItem(key) + .then(function() { refreshKeys() }); } }, cancel : function() {} // user canceled, nothing to do diff --git a/Open-ILS/web/js/ui/default/staff/services/hatch.js b/Open-ILS/web/js/ui/default/staff/services/hatch.js index d35c3f103a..5642a93904 100644 --- a/Open-ILS/web/js/ui/default/staff/services/hatch.js +++ b/Open-ILS/web/js/ui/default/staff/services/hatch.js @@ -741,13 +741,13 @@ angular.module('egCoreMod') return $q.when(service.getLocalKeys(prefix)); } - service.getServerKeys = function(prefix) { + service.getServerKeys = function(prefix, options) { if (!service.auth) service.auth = $injector.get('egAuth'); if (!service.auth.token()) return $q.when({}); return egNet.request( 'open-ils.actor', 'open-ils.actor.settings.staff.applied.names.authoritative.atomic', - service.auth.token(), prefix + service.auth.token(), prefix, options ); } diff --git a/docs/RELEASE_NOTES_NEXT/Client/workstation-server-settings.adoc b/docs/RELEASE_NOTES_NEXT/Client/workstation-server-settings.adoc index 94855df792..b81eeda8ec 100644 --- a/docs/RELEASE_NOTES_NEXT/Client/workstation-server-settings.adoc +++ b/docs/RELEASE_NOTES_NEXT/Client/workstation-server-settings.adoc @@ -28,6 +28,14 @@ consistent for all users. A setting is read-only when an org unit setting type exists (regardless of whether a value is applied) and no user or workstation setting type exists. +Server-Stored Workstation Settings Workstation Admin View ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +There's a new "Server Workstation Prefs" tab to the stored preferences +workstation admin interface. From here, users can view which +preferences are stored as server-stored workstation preferences and +delete select values. + Upgrade Notes +++++++++++++ -- 2.43.2