"open-ils.storage.direct.actor.user.retrieve", $id);
my $user = $ureq->gather(1);
+ if(!$user) { return undef; }
+
# grab the cards
my $cards_req = $session->request(
"open-ils.storage.direct.actor.card.search.usr.atomic",
__PACKAGE__->register_method(
method => "check_user_perms",
- api_name => "open-ils.actor.user.perm.check");
+ api_name => "open-ils.actor.user.perm.check",
+ notes => <<" NOTES"
+ Takes a user id, an org id, and an array of perm type strings. For each
+ perm type, if the user does *not* have the given permission it is added
+ to a list which is returned from the method. If all permissions
+ are allowed, an empty list is returned
+ NOTES
+ );
sub check_user_perms {
- my( $self, $client, $user_id, $org_id, @perm_types ) = @_;
+ my( $self, $client, $user_id, $org_id, $perm_types ) = @_;
+
+ my @not_allowed;
+ for my $perm (@$perm_types) {
+ if($apputils->check_user_perms($user_id, $org_id, $perm)) {
+ push @not_allowed, $perm;
+ }
+ }
+
+ return \@not_allowed
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__END__
if($apputils->check_user_perms($user->id(), 1, "OPAC_LOGIN")) {
return OpenILS::Perm->new("OPAC_LOGIN");
}
+
+ } else {
+ # 1 is the top level org unit (we should probably load the tree and get id from it)
+ warn "Checking user perms for Staff login\n";
+ if($apputils->check_user_perms($user->id(), 1, "STAFF_LOGIN")) {
+ return OpenILS::Perm->new("STAFF_LOGIN");
+ }
}
my $session_id = md5_hex(time() . $$ . rand());
sub retrieve_holds {
my($self, $client, $login_session, $user_id) = @_;
+
my $user = $apputils->check_user_session($login_session);
if($user->id ne $user_id) {
- if($apputils->check_user_perms($user_id, $user->home_ou, "VIEW_HOLDS")) {
+ if($apputils->check_user_perms($user->id, $user->home_ou, "VIEW_HOLDS")) {
return OpenILS::Perm->new("VIEW_HOLDS");
}
}
# Houses biblio search utilites
+
+__PACKAGE__->register_method(
+ method => "test",
+ api_name => "open-ils.search.test");
+
+sub test { return "test"; }
+
+
+
__PACKAGE__->register_method(
method => "biblio_search_marc",
api_name => "open-ils.search.biblio.marc",
}
+
__PACKAGE__->register_method(
method => "record_id_to_mods_slim",
api_name => "open-ils.search.biblio.record.mods_slim.retrieve",
# converts a record into a mods object with NO copy counts attached
sub record_id_to_mods_slim {
-
my( $self, $client, $id ) = @_;
- warn "Retrieving MODS object for record $id\n";
- return undef unless(defined $id);
+ return undef unless defined $id;
+ if(ref($id) and ref($id) == 'ARRAY') {
+ return _records_to_mods( @$id );
+ }
my $mods_list = _records_to_mods( $id );
my $mods_obj = $mods_list->[0];
return $mods_obj;
}
+__PACKAGE__->register_method(
+ method => "biblio_mrid_to_modsbatch_batch",
+ api_name => "open-ils.search.biblio.metarecord.mods_slim.batch.retrieve");
+
+sub biblio_mrid_to_modsbatch_batch {
+ my( $self, $client, $mrids) = @_;
+ warn "Performing mrid_to_modsbatch_batch...";
+ my @mods;
+ my $method = $self->method_lookup("open-ils.search.biblio.metarecord.mods_slim.retrieve");
+ use Data::Dumper;
+ warn "Grabbing mods for " . Dumper($mrids) . "\n";
+
+ for my $id (@$mrids) {
+ next unless defined $id;
+ #push @mods, biblio_mrid_to_modsbatch($self, $client, $id);
+ my ($m) = $method->run($id);
+ push @mods, $m;
+ }
+ return \@mods;
+}
__PACKAGE__->register_method(
method => "biblio_mrid_to_modsbatch",
- api_name => "open-ils.search.biblio.metarecord.mods_slim.retrieve",
-);
+ api_name => "open-ils.search.biblio.metarecord.mods_slim.retrieve");
sub biblio_mrid_to_modsbatch {
my( $self, $client, $mrid ) = @_;