[open-ils-commits] r12542 - trunk/Open-ILS/src/perlmods/OpenILS/Application (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Mar 16 12:46:50 EDT 2009
Author: erickson
Date: 2009-03-16 12:46:48 -0400 (Mon, 16 Mar 2009)
New Revision: 12542
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
added method to return trigger events by user and type
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2009-03-16 16:44:58 UTC (rev 12541)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2009-03-16 16:46:48 UTC (rev 12542)
@@ -3178,5 +3178,47 @@
}
+__PACKAGE__->register_method (
+ method => 'user_events',
+ api_name => 'open-ils.actor.user.events.circ',
+ stream => 1,
+);
+__PACKAGE__->register_method (
+ method => 'user_events',
+ api_name => 'open-ils.actor.user.events.ahr',
+ stream => 1,
+);
+
+sub user_events {
+ my($self, $conn, $auth, $user_id, $filters) = @_;
+ my $e = new_editor(authtoken => $auth);
+ return $e->event unless $e->checkauth;
+
+ (my $obj_type = $self->api_name) =~ s/.*\.([a-z]+)$/$1/;
+ my $user_field = 'usr';
+
+ $filters ||= {};
+ $filters->{target} = {
+ select => { $obj_type => ['id'] },
+ from => $obj_type,
+ where => {usr => $user_id}
+ };
+
+ my $user = $e->retrieve_actor_user($user_id) or return $e->event;
+ if($e->requestor->id != $user_id) {
+ return $e->event unless $e->allowed('VIEW_USER', $user->home_ou);
+ }
+
+ my $ses = OpenSRF::AppSession->create('open-ils.trigger');
+ my $req = $ses->request('open-ils.trigger.events_by_target', $obj_type, $filters);
+ while(my $resp = $req->recv) {
+ my $val = $resp->content;
+ $conn->respond($val) if $val;
+ }
+
+ return undef;
+}
+
+
1;
More information about the open-ils-commits
mailing list