[Koha-bugs] [Bug 35228] REST API: Restricted staff users can see patron extended attributes (not exposed via UI)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Nov 2 11:16:23 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35228

--- Comment #2 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
While researching, I looked at this condition in _handle_to_api_child:
        Koha::Exception->throw( "Asked to embed $curr but its return value
doesn't implement to_api" )
            if defined $next and blessed $child and !$child->can('to_api');
At first glance, it sounds good. But it actually does nothing. To_api is
inherited from Koha::Object. So you 'can' do it.
In this case you will get what you want. See below. At a higher level TO_JSON
gets the details and to_api doesnt complain.
use Modern::Perl; use Data::Dumper qw/Dumper/; use Koha::Patron::Attribute;
my $child = Koha::Patron::Attribute->new({ code => 'TEST', attribute => '123'
}); print Dumper( $child->can('to_api'), $child->to_api );
$VAR1 = sub { "DUMMY" };
$VAR2 = {           'type' => 'TEST',            'value' => '123'          };

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list