[open-ils-commits] r11429 - in trunk/Open-ILS/src/perlmods/OpenILS/Application: . Actor
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Dec 5 17:39:59 EST 2008
Author: erickson
Date: 2008-12-05 17:39:55 -0500 (Fri, 05 Dec 2008)
New Revision: 11429
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor/Friends.pm
Log:
added confirmed-only option to friend retrieval
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor/Friends.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor/Friends.pm 2008-12-05 22:29:36 UTC (rev 11428)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor/Friends.pm 2008-12-05 22:39:55 UTC (rev 11429)
@@ -49,7 +49,8 @@
};
sub retrieve_friends {
- my($self, $e, $user_id) = @_;
+ my($self, $e, $user_id, $options) = @_;
+ $options ||= {};
# users I have links to
$out_links_query->{where}->{'+cub'}->{owner} = $user_id;
@@ -78,11 +79,17 @@
unless grep {$_ == $in_link} @confirmed;
}
- return {
- confirmed => $self->load_linked_user_perms($e, $user_id, @confirmed),
- pending_out => $self->load_linked_user_perms($e, $user_id, @pending_out),
- pending_in => $self->load_linked_user_perms($e, $user_id, @pending_in)
- };
+ if($$options{confirmed_only}) {
+ return {
+ confirmed => $self->load_linked_user_perms($e, $user_id, @confirmed),
+ };
+ } else {
+ return {
+ confirmed => $self->load_linked_user_perms($e, $user_id, @confirmed),
+ pending_out => $self->load_linked_user_perms($e, $user_id, @pending_out),
+ pending_in => $self->load_linked_user_perms($e, $user_id, @pending_in)
+ };
+ }
}
# given a base user and set of linked users, returns the trimmed linked user
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-12-05 22:29:36 UTC (rev 11428)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-12-05 22:39:55 UTC (rev 11429)
@@ -3071,16 +3071,18 @@
);
sub retrieve_friends {
- my($self, $conn, $auth, $user_id) = @_;
+ my($self, $conn, $auth, $user_id, $options) = @_;
my $e = new_editor(authtoken => $auth);
return $e->event unless $e->checkauth;
$user_id ||= $e->requestor->id;
+
if($user_id != $e->requestor->id) {
my $user = $e->retrieve_actor_user($user_id) or return $e->event;
return $e->event unless $e->allowed('VIEW_USER', $user->home_ou);
}
- return OpenILS::Application::Actor::Friends->retrieve_friends($e, $user_id);
+ return OpenILS::Application::Actor::Friends->retrieve_friends(
+ $e, $user_id, $options);
}
More information about the open-ils-commits
mailing list