From 81e674e2d8972c8761ab137c643ab9d0f2eb1ad6 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 30 Sep 2015 20:16:02 +0000 Subject: [PATCH] LP#1501471: check OU setting view_perms only when needed Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/Application/Actor.pm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index fcc71a52f4..122b32d7f0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -313,10 +313,23 @@ __PACKAGE__->register_method( ); sub ou_ancestor_setting_batch { my( $self, $client, $orgid, $name_list, $auth ) = @_; - # Make sure $auth is set to something if not given. - $auth ||= -1; + + my %must_check_perm = (); + unless (defined $auth) { + # figure out which OU settings *require* view permission + # checks + my $e = new_editor(); + my $res = $e->search_config_org_unit_setting_type({ + name => $name_list, + view_perm => { "!=" => undef }, + }); + $must_check_perm{ $_->name() } = -1 for @$res; + } my %values; - $values{$_} = $U->ou_ancestor_setting($orgid, $_, undef, $auth) for @$name_list; + $values{$_} = $U->ou_ancestor_setting( + $orgid, $_, undef, + ($auth ? $auth : $must_check_perm{$_}) + ) for @$name_list; return \%values; } -- 2.43.2