[open-ils-commits] r8665 - trunk/Open-ILS/src/perlmods/OpenILS/Application

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Feb 6 12:43:10 EST 2008


Author: erickson
Date: 2008-02-06 12:14:41 -0500 (Wed, 06 Feb 2008)
New Revision: 8665

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
now using the find_highest_perm_org and get_org_tree methods provided in apputils

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2008-02-06 16:39:44 UTC (rev 8664)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2008-02-06 17:14:41 UTC (rev 8665)
@@ -1294,26 +1294,11 @@
 		$authtoken, $userid, 'VIEW_PERMISSION' );
 	return $evt if $evt;
 
-	my $tree = $self->get_org_tree();
-	return _find_highest_perm_org( $perm, $userid, $target->ws_ou, $tree );
+	my $tree = $U->get_org_tree();
+	return $U->find_highest_perm_org( $perm, $userid, $target->ws_ou, $tree );
 }
 
 
-sub _find_highest_perm_org {
-	my ( $perm, $userid, $start_org, $org_tree ) = @_;
-	my $org = $apputils->find_org($org_tree, $start_org );
-
-	my $lastid = -1;
-	while( $org ) {
-		last if ($apputils->check_perms( $userid, $org->id, $perm )); # perm failed
-		$lastid = $org->id;
-		$org = $apputils->find_org( $org_tree, $org->parent_ou() );
-	}
-
-	return $lastid;
-}
-
-
 __PACKAGE__->register_method(
 	method => 'check_user_work_perms',
 	api_name	=> 'open-ils.actor.user.work_perm.highest_org_set',
@@ -1368,10 +1353,10 @@
 
 	my @arr;
 	return [] unless ref($perms);
-	my $tree = $self->get_org_tree();
+	my $tree = $U->get_org_tree();
 
 	for my $p (@$perms) {
-		push( @arr, _find_highest_perm_org( $p, $userid, $target->home_ou, $tree ) );
+		push( @arr, $U->find_highest_perm_org( $p, $userid, $target->home_ou, $tree ) );
 	}
 	return \@arr;
 }



More information about the open-ils-commits mailing list