+
+ if ($cnf->{enable}) {
+ $app->hook(before_render => sub {
+ my ($c, $args) = @_;
+ return if (!defined $args->{json});
+
+ my $json = $args->{json};
+ my $result = $json;
+ if (defined $json->{result} && ref($json->{result}) eq "HASH") {
+ $result = $json->{result};
+ }
+
+ if ($result->{item}) {
+ my $type = $result->{item}->{content_type};
+ if ($type) {
+ apply_seclev_filter($c, $type, $result->{item});
+ }
+ }
+
+ if ($result->{items} && ref($result->{items}) eq "ARRAY") {
+ for my $item (@{$result->{items}}) {
+ my $type = $item->{content_type};
+ if ($type) {
+ apply_seclev_filter($c, $type, $item);
+ }
+ }
+ }
+ });
+ }