[open-ils-commits] r10761 -
trunk/Open-ILS/src/perlmods/OpenILS/Application
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Oct 6 09:46:22 EDT 2008
Author: erickson
Date: 2008-10-06 09:46:20 -0400 (Mon, 06 Oct 2008)
New Revision: 10761
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
default to requesting user. if a single setting is requested, only grab that setting from the DB
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-10-06 11:27:52 UTC (rev 10760)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-10-06 13:46:20 UTC (rev 10761)
@@ -57,6 +57,8 @@
my $e = new_editor(xact => 1, authtoken => $auth);
return $e->die_event unless $e->checkauth;
+ $user_id = $e->requestor->id unless defined $user_id;
+
unless($e->requestor->id == $user_id) {
my $user = $e->retrieve_actor_user($user_id) or return $e->die_event;
return $e->die_event unless $e->allowed('UPDATE_USER', $user->home_ou);
@@ -143,11 +145,13 @@
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;
+ if($setting) {
+ my $val = $e->search_actor_user_setting({usr => $user_id, name => $setting})->[0];
+ return OpenSRF::Utils::JSON->JSON2perl($val->value);
+ } else {
+ my $s = $e->search_actor_user_setting({usr => $user_id});
+ return { map { ( $_->name => OpenSRF::Utils::JSON->JSON2perl($_->value) ) } @$s };
+ }
}
More information about the open-ils-commits
mailing list