From 46876c7de9926eac46367f1cd5a6bd660fd7bb43 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 15 Sep 2008 20:22:22 +0000 Subject: [PATCH] added a batch org setting fetcher. cleaned up one of the high-org perm checkers, though, this method will slowly deprecate as work_orgs take over git-svn-id: svn://svn.open-ils.org/ILS/trunk@10599 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Actor.pm | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index a443b1e5ba..aa07b05143 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -176,6 +176,17 @@ sub ou_ancestor_setting { return $U->ou_ancestor_setting($orgid, $name); } +__PACKAGE__->register_method( + api_name => 'open-ils.actor.ou_setting.ancestor_default.batch', + method => 'ou_ancestor_setting_batch', +); +sub ou_ancestor_setting_batch { + my( $self, $client, $orgid, $name_list ) = @_; + my %values; + $values{$_} = $U->ou_ancestor_setting($orgid, $_) for @$name_list; + return \%values; +} + @@ -1278,16 +1289,20 @@ __PACKAGE__->register_method( /); sub check_user_perms3 { - my( $self, $client, $authtoken, $userid, $perm ) = @_; + my($self, $client, $authtoken, $user_id, $perm) = @_; + my $e = new_editor(authtoken=>$authtoken); + return $e->event unless $e->checkauth; - my( $staff, $target, $org, $evt ); + my $tree = $self->get_org_tree(); - ( $staff, $target, $evt ) = $apputils->checkses_requestor( - $authtoken, $userid, 'VIEW_PERMISSION' ); - return $evt if $evt; + unless($e->requestor->id == $user_id) { + my $user = $e->retrieve_actor_user($user_id) + or return $e->event; + return $e->event unless $e->allowed('VIEW_PERMISSION', $user->home_ou); + return $U->find_highest_perm_org($perm, $user_id, $user->home_ou, $tree ); + } - my $tree = $U->get_org_tree(); - return $U->find_highest_perm_org( $perm, $userid, $target->ws_ou, $tree ); + return $U->find_highest_perm_org($perm, $user_id, $e->requestor->ws_ou, $tree); } -- 2.43.2