added a parallel method for perm_org_set which returns the sub-tree for each of the...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 14 Apr 2008 14:04:20 +0000 (14:04 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 14 Apr 2008 14:04:20 +0000 (14:04 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9341 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm

index 92a7b14..5b711f3 100644 (file)
@@ -1309,13 +1309,28 @@ __PACKAGE__->register_method(
     }
 );
 
+__PACKAGE__->register_method(
+       method => 'check_user_work_perms',
+       api_name        => 'open-ils.actor.user.work_perm.highest_org_tree_set',
+    authoritative => 1,
+    signature => q/
+        @see open-ils.actor.user.work_perm.highest_org_set
+        Returns a list of org trees.  The root of each tree
+        is the highest org in the organization hierarchy where the user has the
+        requested permission.  Below each tree root is its full tree of descendants.  
+    /
+);
+
 sub check_user_work_perms {
     my($self, $conn, $auth, $perm, $options) = @_;
     my $e = new_editor(authtoken=>$auth);
     return $e->event unless $e->checkauth;
-    return $U->find_highest_work_orgs($e, $perm, $options);
+    my $orglist = $U->find_highest_work_orgs($e, $perm, $options);
+    return $orglist unless $self->api_name =~ /tree/;
+    return get_org_descendants($self, $conn, $orglist);
 }
 
+
 __PACKAGE__->register_method(
        method => 'check_user_perms4',
        api_name        => 'open-ils.actor.user.perm.highest_org.batch',