Lines 1348-1367
Return true if the patron (usually the logged in user) can see the patron's info
Link Here
|
1348 |
|
1348 |
|
1349 |
sub can_see_patrons_from { |
1349 |
sub can_see_patrons_from { |
1350 |
my ( $self, $branchcode ) = @_; |
1350 |
my ( $self, $branchcode ) = @_; |
1351 |
my $can = 0; |
1351 |
my @branches = $self->libraries_where_can_see_patrons; |
1352 |
if ( $self->branchcode eq $branchcode ) { |
1352 |
return 1 unless @branches; |
1353 |
$can = 1; |
1353 |
return any { $_ eq $branchcode } @branches; |
1354 |
} elsif ( $self->has_permission( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { |
|
|
1355 |
$can = 1; |
1356 |
} elsif ( my $library_groups = $self->library->library_groups ) { |
1357 |
while ( my $library_group = $library_groups->next ) { |
1358 |
if ( $library_group->parent->has_child( $branchcode ) ) { |
1359 |
$can = 1; |
1360 |
last; |
1361 |
} |
1362 |
} |
1363 |
} |
1364 |
return $can; |
1365 |
} |
1354 |
} |
1366 |
|
1355 |
|
1367 |
=head3 can_log_into |
1356 |
=head3 can_log_into |
Lines 1752-1757
sub get_extended_attribute {
Link Here
|
1752 |
return $attribute->next; |
1741 |
return $attribute->next; |
1753 |
} |
1742 |
} |
1754 |
|
1743 |
|
|
|
1744 |
=head3 is_accessible_in_context |
1745 |
|
1746 |
=cut |
1747 |
|
1748 |
sub is_accessible_in_context { |
1749 |
my ($self, $params) = @_; |
1750 |
|
1751 |
my $consumer = $params->{user}; |
1752 |
return $consumer->can_see_patron_infos($self); |
1753 |
} |
1754 |
|
1755 |
=head3 to_api |
1755 |
=head3 to_api |
1756 |
|
1756 |
|
1757 |
my $json = $patron->to_api; |
1757 |
my $json = $patron->to_api; |