1 package OpenILS::Application::Actor::Container;
2 use base 'OpenSRF::Application';
3 use strict; use warnings;
4 use OpenILS::Application::AppUtils;
7 use OpenSRF::EX qw(:try);
10 my $apputils = "OpenILS::Application::AppUtils";
11 my $logger = "OpenSRF::Utils::Logger";
13 sub initialize { return 1; }
15 __PACKAGE__->register_method(
16 method => "bucket_retrieve",
17 api_name => "open-ils.actor.container.biblio_record_entry_bucket.retrieve_by_name",
19 Retrieves a BREB by name. PARAMS(authtoken, bucketOwnerId, bucketName)
20 If requestor ID is different than bucketOwnerId, requestor must have
21 VIEW_CONTAINER permissions.
26 __PACKAGE__->register_method(
27 method => "bucket_retrieve",
28 api_name => "open-ils.actor.container.biblio_record_entry_bucket.retrieve_by_user",
30 Returns all BRE Buckets that belong to the given user.
31 PARAMS( authtoken, bucketOwnerId )
32 If requestor ID is different than bucketOwnerId, requestor must have
33 VIEW_CONTAINER permissions.
38 my($self, $client, $authtoken, $userid, $name) = @_;
40 my ($staff, $user, $perm) =
41 $apputils->handle_requestor( $authtoken, $userid, 'VIEW_CONTAINER');
42 return $perm if $perm;
44 $logger->activity("User " . $staff->id . " retrieving buckets for user $user");
46 my $svc = 'open-ils.storage';
47 my $meth = 'open-ils.storage.direct.container';
48 my $bibmeth = "$meth.biblio_record_entry_bucket";
49 my $cnmeth = "$meth.biblio_record_entry_bucket";
50 my $copymeth = "$meth.biblio_record_entry_bucket";
51 my $usermeth = "$meth.biblio_record_entry_bucket";
53 if( $self->api_name =~ /biblio.*retrieve_by_user/ ) {
54 return $apputils->simplereq( $svc,
55 "$bibmeth.search.owner.atomic", $user ); }
57 if( $self->api_name =~ /biblio.*retrieve_by_name/ ) {
58 return $apputils->simplereq( $svc,
59 "$bibmeth.search_where", { name => $name, owner => $user } ); }