[open-ils-commits] [GIT] Evergreen ILS branch master updated. e3592ec729f9750f0a0e9d453e9f0b859ab5a9aa
Evergreen Git
git at git.evergreen-ils.org
Mon Aug 22 17:19:03 EDT 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via e3592ec729f9750f0a0e9d453e9f0b859ab5a9aa (commit)
via 6b900e1b5da091c09d0a4f668ca8618adfb4a260 (commit)
from ef0f93b69821f0da41863c92cb30733ea2ffaf51 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e3592ec729f9750f0a0e9d453e9f0b859ab5a9aa
Author: Jason Etheridge <jason at esilibrary.com>
Date: Mon Aug 22 17:32:09 2011 -0400
stamp an upgrade version for the czs use_perm feature
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 1e14f28..f4528b6 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0605', :eg_version); -- dbwells/dbs
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0606', :eg_version); -- phasefx/berick
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.czs_use_perm_column.sql b/Open-ILS/src/sql/Pg/upgrade/0606.schema.czs_use_perm_column.sql
similarity index 83%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.czs_use_perm_column.sql
rename to Open-ILS/src/sql/Pg/upgrade/0606.schema.czs_use_perm_column.sql
index db1f077..0518f24 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.czs_use_perm_column.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0606.schema.czs_use_perm_column.sql
@@ -1,4 +1,4 @@
--- Evergreen DB patch XXXX.schema.czs_use_perm_column.sql
+-- Evergreen DB patch 0606.schema.czs_use_perm_column.sql
--
-- This adds a column to config.z3950_source called use_perm.
-- The idea is that if a permission is set for a given source,
@@ -8,7 +8,7 @@
BEGIN;
-- check whether patch can be applied
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0606', :eg_version);
ALTER TABLE config.z3950_source
ADD COLUMN use_perm INT REFERENCES permission.perm_list (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
commit 6b900e1b5da091c09d0a4f668ca8618adfb4a260
Author: Jason Etheridge <jason at esilibrary.com>
Date: Fri Jul 22 01:47:15 2011 -0400
use_perm column for config.z3950_source
The idea is that if a permission code is specified for a given source, then
staff will need that permission to use that source in the staff client z39.50
interface.
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
Signed-off-by: Bill Erickson <berick at esilibrary.com>
diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 7b621a9..3604637 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -819,9 +819,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
<field reporter:label="Transmission Format" name="transmission_format" reporter:datatype="text"/>
<field reporter:label="Auth" name="auth" reporter:datatype="bool"/>
<field reporter:label="Attrs" name="attrs" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Use Permission" name="use_perm" reporter:datatype="link"/>
</fields>
<links>
<link field="attrs" reltype="has_many" key="source" map="" class="cza"/>
+ <link field="use_perm" reltype="has_a" key="id" map="" class="ppl"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Z3950.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Z3950.pm
index a5cd5ca..6a09529 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Z3950.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Z3950.pm
@@ -73,6 +73,7 @@ __PACKAGE__->register_method(
method => "query_services",
api_name => "open-ils.search.z3950.retrieve_services",
signature => q/
+ @param auth The login session key
Returns a list of service names that we have config
data for
/
@@ -89,7 +90,7 @@ sub query_services {
return $e->event unless $e->checkauth;
return $e->event unless $e->allowed('REMOTE_Z3950_QUERY');
- return fetch_service_defs();
+ return fetch_service_defs($e);
}
# -------------------------------------------------------------------
@@ -97,10 +98,12 @@ sub query_services {
# -------------------------------------------------------------------
sub fetch_service_defs {
+ my $editor_with_authtoken = shift;
+
my $hash = $sclient->config_value('z3950', 'services');
# overlay config file values with in-db values
- my $e = new_editor();
+ my $e = $editor_with_authtoken || new_editor();
if($e->can('search_config_z3950_source')) {
my $sources = $e->search_config_z3950_source(
@@ -118,6 +121,8 @@ sub fetch_service_defs {
record_format => $s->record_format,
transmission_format => $s->transmission_format,
auth => $s->auth,
+ use_perm => ($s->use_perm) ?
+ $e->retrieve_permission_perm_list($s->use_perm)->code : ''
};
for my $a ( @{ $s->attrs } ) {
@@ -151,6 +156,19 @@ sub fetch_service_defs {
}
};
+ # then filter out any services which the requestor lacks the perm for
+ foreach my $s (keys %{ $hash }) {
+ if ($$hash{$s}{use_perm}) {
+ if ($U->check_perms(
+ $e->requestor->id,
+ $e->requestor->ws_ou,
+ $$hash{$s}{use_perm}
+ )) {
+ delete $$hash{$s};
+ }
+ };
+ }
+
%services = %$hash; # cache these internally so we can actually use the db-configured sources
return $hash;
}
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index a08f61b..1e14f28 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -440,7 +440,8 @@ CREATE TABLE config.z3950_source (
db TEXT NOT NULL,
record_format TEXT NOT NULL DEFAULT 'FI',
transmission_format TEXT NOT NULL DEFAULT 'usmarc',
- auth BOOL NOT NULL DEFAULT TRUE
+ auth BOOL NOT NULL DEFAULT TRUE,
+ use_perm INT -- REFERENCES permission.perm_list (id)
);
COMMENT ON TABLE config.z3950_source IS $$
@@ -457,6 +458,10 @@ COMMENT ON COLUMN config.z3950_source.transmission_format IS $$
Z39.50 preferred record syntax..
$$;
+COMMENT ON COLUMN config.z3950_source.use_perm IS $$
+If set, this permission is required for the source to be listed in the staff
+client Z39.50 interface. Similar to permission.grp_tree.application_perm.
+$$;
CREATE TABLE config.z3950_attr (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql
index 4395c64..3777df3 100644
--- a/Open-ILS/src/sql/Pg/800.fkeys.sql
+++ b/Open-ILS/src/sql/Pg/800.fkeys.sql
@@ -122,4 +122,6 @@ ALTER TABLE config.barcode_completion ADD CONSTRAINT config_barcode_completion_o
CREATE INDEX by_heading_and_thesaurus ON authority.record_entry (authority.normalize_heading(marc)) WHERE deleted IS FALSE or deleted = FALSE;
CREATE INDEX by_heading ON authority.record_entry (authority.simple_normalize_heading(marc)) WHERE deleted IS FALSE or deleted = FALSE;
+ALTER TABLE config.z3950_source ADD CONSTRAINT use_perm_fkey FOREIGN KEY (use_perm) REFERENCES permission.perm_list (id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED;
+
COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.czs_use_perm_column.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.czs_use_perm_column.sql
new file mode 100644
index 0000000..db1f077
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.czs_use_perm_column.sql
@@ -0,0 +1,21 @@
+-- Evergreen DB patch XXXX.schema.czs_use_perm_column.sql
+--
+-- This adds a column to config.z3950_source called use_perm.
+-- The idea is that if a permission is set for a given source,
+-- then staff will need the referenced permission to use that
+-- source.
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE config.z3950_source
+ ADD COLUMN use_perm INT REFERENCES permission.perm_list (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+
+COMMENT ON COLUMN config.z3950_source.use_perm IS $$
+If set, this permission is required for the source to be listed in the staff
+client Z39.50 interface. Similar to permission.grp_tree.application_perm.
+$$;
+
+COMMIT;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/examples/fm_IDL.xml | 2 +
.../lib/OpenILS/Application/Search/Z3950.pm | 22 ++++++++++++++++++-
Open-ILS/src/sql/Pg/002.schema.config.sql | 9 ++++++-
Open-ILS/src/sql/Pg/800.fkeys.sql | 2 +
.../Pg/upgrade/0606.schema.czs_use_perm_column.sql | 21 +++++++++++++++++++
5 files changed, 52 insertions(+), 4 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/upgrade/0606.schema.czs_use_perm_column.sql
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list