Group
Extension

Matches 63

App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Util/DeviceAuth.pm ( view source; MetaCPAN )
}
          else {
            my $stanza = undef;
            try {
              $stanza = from_json( $line );
              debug sprintf '[%s] external credentials stanza added',
                $
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Util/Snapshot.pm ( view source; MetaCPAN )
search({ -or => [
        -bool => \q{ array_length(oid_parts, 1) IS NULL },
        -bool => \q{ jsonb_typeof(value) != 'array' }, ] })->count) {

      my @rows = $device->oids->search({},{
        
],
      })->hri->all;

      $oids{$_->{oid}} = {
          %{ $_ },
          value => (@{ from_json($_->{value}) })[0],
      } for @rows;
  }
  # or we have an snmpwalk file on disk
  elsif (-f $
     => $oid,
            oid_parts => [], # not needed temporarily 
            value     => to_json([ ((defined $type and $type eq 'BASE64') ? $value
                                               
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/DB/Result.pm ( view source; MetaCPAN )
ToJSON});

  # this replacement will avoid the issue of relation names which override
  # field names, causing TO_JSON to return object instances, breaking to_json
  *DBIx::Class::Helper::Row::ToJSON:
:TO_JSON = sub {
      my $self = shift;
      my $columns_info = $self->columns_info($self->serializable_columns);
      my $columns_data = { $self->get_columns };
      return {
         map +($_ =>
 $columns_data->{$_}), keys %$columns_info
      };
  };
}

# for DBIx::Class::Helper::Row::ToJSON
# to allow text columns to be included in results

sub unserializable_data_types {
   return {
      
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Util/SNMP.pm ( view source; MetaCPAN )
pec::Functions qw/splitdir catdir catfile/;
use MIME::Base64 'decode_base64';
use SNMP::Info;
use JSON::PP ();

use base 'Exporter';
our @EXPORT = ();
our @EXPORT_OK = qw/
  get_communities
  snmp_com
 Base64 encoded,
decodes it and then munge to handle data format, before finally pretty
render in JSON format.

=cut

sub get_code_info { return ($_[0]) =~ m/^(.+)::(.*?)$/ }
sub sub_name      { retur
ength $encoded;

    my $json = JSON::PP->new->utf8->pretty->allow_nonref->allow_unknown->canonical;
    $json->sort_by( sub { sortable_oid($JSON::PP::a) cmp sortable_oid($JSON::PP::b) } );

    retur
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Util/CustomFields.pm ( view source; MetaCPAN )
Netdisco::DB::ResultSet::Device;
use App::Netdisco::DB::ResultSet::DevicePort;

my %device_fields_json = ();
my @inline_device_actions = ();
my @inline_device_port_actions = ();

foreach my $config (@
'name'};
  push @inline_device_actions, $config->{'name'};
  ++$device_fields_json{ $config->{'name'} } if $config->{'json_list'};
}

foreach my $config (@{ setting('custom_fields')->{'device_port'} |
    map {( ('cf_'. $_) => \[
              ($device_fields_json{$_} ? q{ARRAY(SELECT json_array_elements_text((me.custom_fields ->> ?) ::json))::text[]}
                                       : 'me.cu
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/AdminTask.pm ( view source; MetaCPAN )
                      ip => $device->addr,
                                          -bool => \q{ jsonb_typeof(value) = 'array' },
                                       })->hri->all;

    send_error(
lar @rows;

    my @snmpwalk = ();
    foreach my $row (@rows) {
        $row->{value} = (@{ from_json($row->{value}) })[0];
        if (ref {} eq ref $row->{value}) {
            foreach my $k (keys 
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/TypeAhead.pm ( view source; MetaCPAN )
t'})->resultset('DeviceSkip')->get_distinct_col('backend');

    content_type 'application/json';
    to_json \@backends;
};

ajax '/ajax/data/queue/typeahead/username' => require_role admin => sub {
enant'})->resultset('Admin')->get_distinct_col('username');

    content_type 'application/json';
    to_json \@users;
};

ajax '/ajax/data/queue/typeahead/action' => require_role admin => sub {
    m
meta( param('query') || param('term') || param('action') );

    content_type 'application/json';
    to_json [
      grep { $q ? m/^$q/ : true }
      grep { defined }
      List::MoreUtils::uniq
   
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/PortControl.pm ( view source; MetaCPAN )
est->remote_address,
        log => $log,
      });
    });

    content_type('application/json');
    to_json({});
};

ajax '/ajax/userlog' => require_login sub {
    my @jobs = jq_userlog( session('
t;/; $_}
        map  { $_->log }
        grep { $_->status eq 'error' }
        grep { defined }
        @jobs
      ],
    );

    content_type('application/json');
    to_json(\%status);
};

true;
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/AuthN.pm ( view source; MetaCPAN )
th
      or request->path eq uri_for('/logout')->path
      or request->path eq uri_for('/swagger.json')->path
      or index(request->path, uri_for('/swagger-ui')->path) == 0
    );

    # Dancer wil
> {
    'application/json' => { api_key => 'cc9d5c02d8898e5728b7d7a0339c0785' } } },
  },
},
post '/login' => sub {
    my $api = ((request->accept and request->accept =~ m/(?:json|javascript)/) ? tru
n => \'LOCALTIMESTAMP' });

        if ($api) {
            header('Content-Type' => 'application/json');

            # if there's a current valid token then reissue it and reset timer
            $
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Util/Web.pm ( view source; MetaCPAN )
est_is_api

Client has requested JSON format data and an endpoint under C</api>.

=cut

sub request_is_api {
  return ((request->accept and request->accept =~ m/(?:json|javascript)/) and (
    index(r
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/JobQueue/PostgreSQL.pm ( view source; MetaCPAN )
_actions';
use App::Netdisco::Backend::Job;
use App::Netdisco::DB::ExplicitLocking ':modes';

use JSON::PP ();
use Try::Tiny;

use base 'Exporter';
our @EXPORT = ();
our @EXPORT_OK = qw/
  jq_warm_thr
}

          die 'failed to find row for custom field update' unless $row;

          my $coder = JSON::PP->new->utf8(0)->allow_nonref(1)->allow_unknown(1);
          $spec->{subaction} = $coder->enco
row->make_column_dirty('custom_fields');
          $row->update({
            custom_fields => \['jsonb_set(custom_fields, ?, ?)'
                              => (qq{{$spec->{action}}}, $spec->{subac
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/Plugin/Report/IpInventory.pm ( view source; MetaCPAN )
@results;

    if ( request->is_ajax ) {
        my $json = to_json( \@results );
        template 'ajax/report/ipinventory.tt', { results => $json }, { layout => 'noop' };
    }
    else {
        he
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortVLANMismatch.pm ( view source; MetaCPAN )
 };
    }

    if (request->is_ajax) {
        my $json = to_json (\@results);
        template 'ajax/report/portvlanmismatch.tt', { results => $json }, { layout => 'noop' };
    }
    else {
        
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Transport/Python.pm ( view source; MetaCPAN )
use File::ShareDir 'dist_dir';
use File::Slurper qw/read_text write_text/;
use File::Temp ();
use JSON::PP ();
use YAML::XS ();
use Try::Tiny;

=head1 NAME

App::Netdisco::Transport::Python

=head1 DE
klet {
  my ($self, $job, $workerconf) = @_;
  my $action = $workerconf->{action};

  my $coder = JSON::PP->new->utf8(1)
                           ->allow_nonref(1)
                           ->allow
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/Plugin/Report/ApClients.pm ( view source; MetaCPAN )
 @results;

    if ( request->is_ajax ) {
        my $json = to_json( \@results );
        template 'ajax/report/apclients.tt', { results => $json }, { layout => 'noop' };
    }
    else {
        hea
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/Plugin/Device/SNMP.pm ( view source; MetaCPAN )
=~ m/^\.1(\.\d+)*$/ or send_error('Bad OID Base', 404);

    content_type 'application/json';

    return to_json [{
      text => 'No data for this device. Admins can request a snapshot in the Detail
unt;

    # snapshot should run a loadmibs, but just in case that didn't happen...
    return to_json [{
      text => 'No MIB objects. Please run a loadmibs job.',
      children => \0,
      state 
et_snmp_data($device->ip, $base);
    to_json $items;
};

ajax '/ajax/data/snmp/typeahead' => require_login sub {
    my $term = param('term') or return to_json [];

    my $device = param('ip');
    
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortAdminDown.pm ( view source; MetaCPAN )
@results;

    if ( request->is_ajax ) {
        my $json = to_json (\@results);
        template 'ajax/report/portadmindown.tt', { results => $json }, { layout => 'noop' };
    }
    else {
        h
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/Plugin/Device/Addresses.pm ( view source; MetaCPAN )
ar @results;

    if (request->is_ajax) {
        my $json = to_json( \@results );
        template 'ajax/device/addresses.tt', { results => $json },
            { layout => undef };
    }
    else {
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortBlocking.pm ( view source; MetaCPAN )
@results;

    if ( request->is_ajax ) {
        my $json = to_json (\@results);
        template 'ajax/report/portblocking.tt', { results => $json }, { layout => 'noop' };
    }
    else {
        he
App-Netdisco ( O/OL/OLIVER/App-Netdisco-2.095004.tar.gz, OLIVER, 2025; MetaCPAN )
App-Netdisco/lib/App/Netdisco/Web/Plugin/Device/Vlans.pm ( view source; MetaCPAN )
 scalar @results;

    if (request->is_ajax) {
      my $json = to_json( \@results );
      template 'ajax/device/vlans.tt', { results => $json },
        { layout => 'noop' };
    }
    else {
      

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.