[open-ils-commits] r8965 - branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 11 12:18:34 EDT 2008


Author: erickson
Date: 2008-03-11 11:45:21 -0400 (Tue, 11 Mar 2008)
New Revision: 8965

Modified:
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm
Log:
added ability to pass an object ID and hint to allowed() for object perm checking

Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm	2008-03-11 15:15:25 UTC (rev 8964)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm	2008-03-11 15:45:21 UTC (rev 8965)
@@ -406,7 +406,7 @@
 };
 
 sub allowed {
-	my( $self, $perm, $org, $object ) = @_;
+	my( $self, $perm, $org, $object, $hint ) = @_;
 	my $uid = $self->requestor->id;
 	$org ||= $self->requestor->ws_ou;
 
@@ -416,8 +416,15 @@
 	    $self->log(I, "checking perms user=$uid, org=$org, perm=$perm");
     
         if($object) {
-            my $id_field = $object->Identity;
-            my $params = [$perm, $object->json_hint, $object->$id_field];
+            my $params;
+            if(ref $object) {
+                # determine the ID field and json_hint from the object
+                my $id_field = $object->Identity;
+                $params = [$perm, $object->json_hint, $object->$id_field];
+            } else {
+                # we were passed an object-id and json_hint
+                $params = [$perm, $hint, $object];
+            }
             push(@$params, $org) if $org;
             $OBJECT_PERM_QUERY->{select}->{au}->[0]->{params} = $params;
             $OBJECT_PERM_QUERY->{where}->{id} = $uid;



More information about the open-ils-commits mailing list