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

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 18 22:59:41 EDT 2008


Author: erickson
Date: 2008-03-18 22:25:26 -0400 (Tue, 18 Mar 2008)
New Revision: 9074

Modified:
   branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
ported user prefs call to cstoreEditor, with finer grained perm checking

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-03-18 16:35:05 UTC (rev 9073)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2008-03-19 02:25:26 UTC (rev 9074)
@@ -119,21 +119,21 @@
 	api_name	=> "open-ils.actor.patron.settings.retrieve",
 );
 sub user_settings {
-	my( $self, $client, $user_session, $uid, $setting ) = @_;
-	
-	my( $staff, $user, $evt ) = 
-		$apputils->checkses_requestor( $user_session, $uid, 'VIEW_USER' );
-	return $evt if $evt;
+	my( $self, $client, $auth, $user_id, $setting ) = @_;
 
-	$logger->debug("User " . $staff->id . " fetching user $uid\n");
-	my $s = $apputils->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.actor.user_setting.search.atomic', { usr => $uid } );
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
 
+    my $patron = $e->retrieve_actor_user($user_id) or return $e->event;
+    if($e->requestor->id != $user_id) {
+        return $e->event unless $e->allowed('VIEW_USER', $patron->home_ou);
+    }
+
+    my $s = $e->search_actor_user_setting({usr => $user_id});
 	my $settings =  { map { ( $_->name => OpenSRF::Utils::JSON->JSON2perl($_->value) ) } @$s };
 
-   return $$settings{$setting} if $setting;
-   return $settings;
+    return $$settings{$setting} if $setting;
+    return $settings;
 }
 
 
@@ -3048,9 +3048,5 @@
 }
 
 
-
-
-
-
 1;
 



More information about the open-ils-commits mailing list