[open-ils-commits] r10598 - branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Sep 15 16:21:04 EDT 2008


Author: erickson
Date: 2008-09-15 16:21:00 -0400 (Mon, 15 Sep 2008)
New Revision: 10598

Modified:
   branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
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

Modified: branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2008-09-15 20:17:12 UTC (rev 10597)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2008-09-15 20:21:00 UTC (rev 10598)
@@ -176,9 +176,20 @@
     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;
+}
 
 
 
+
 __PACKAGE__->register_method (
 	method		=> "ou_setting_delete",
 	api_name		=> 'open-ils.actor.org_setting.delete',
@@ -1385,16 +1396,20 @@
 	/);
 
 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 _find_highest_perm_org($perm, $user_id, $user->home_ou, $tree );
+    }
 
-	my $tree = $self->get_org_tree();
-	return _find_highest_perm_org( $perm, $userid, $target->ws_ou, $tree );
+    return _find_highest_perm_org($perm, $user_id, $e->requestor->ws_ou, $tree);
 }
 
 



More information about the open-ils-commits mailing list