Send Netdot-devel mailing list submissions to
        netdot-devel@osl.uoregon.edu

To subscribe or unsubscribe via the World Wide Web, visit
        https://osl.uoregon.edu/mailman/listinfo/netdot-devel
or, via email, send a message with subject or body 'help' to
        netdot-devel-requ...@osl.uoregon.edu

You can reach the person managing the list at
        netdot-devel-ow...@osl.uoregon.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-devel digest..."


Today's Topics:

   1. [Netdot - Bug #1916] (New) Netdot not displaying all      hosts to
      user type User when browsing IP blocks with multiple      forward
      zones (redm...@osl.uoregon.edu)


----------------------------------------------------------------------

Message: 1
Date: Mon, 7 Aug 2017 14:44:52 -0700
From: redm...@osl.uoregon.edu
Subject: [Netdot-devel] [Netdot - Bug #1916] (New) Netdot not
        displaying all  hosts to user type User when browsing IP blocks with
        multiple        forward zones
To: p...@louisiana.edu, netdot-devel@osl.uoregon.edu
Message-ID: <redmine.issue-1916.20170807144...@osl.uoregon.edu>
Content-Type: text/plain; charset=utf-8


Issue #1916 has been reported by Patrick Landry.

----------------------------------------
Bug #1916: Netdot not displaying all hosts to user type User when browsing IP 
blocks with multiple forward zones
https://osl.uoregon.edu/redmine/issues/1916

Author: Patrick Landry
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 
Resolution: 


When a user of User Type "User" uses the "IP Block Actions" to browse an IP 
Block which
is associated with multiple Forward DNS Zones, only host records from one of 
those Forward
DNS Zones is displayed.

I believe this is due to code in htdocs/user_management/hostinfo_tasks.html
which only fetches one associated Forward Zone.

<pre>
   if ( $ipblock_action eq 'browse_records' ){
        my $ipblock = Ipblock->retrieve($ipblock);
->      if ( my $zone = $ipblock->forward_zone ){
            my $records = $zone->get_hosts($ipblock->id);
            $m->comp('/management/hostlist.mhtml', records=>$records, 
withedit=>1,
                     
return_args=>"?ipblock=$ipblock&ipblock_action='browse_records'");
        }else{
            $m->comp('/generic/error.mhtml', error=>$ipblock->get_label." not 
associated with a zone");
        }
</pre>

My fix was to fetch the forward_zones for the Ipblock into an array (@results), 
loop through all
of the forward zones collecting the host records into an additional array 
(@allrecords), and then displaying all
of those host records in one table. Diff below.

<pre>
--- hostinfo_tasks.html-PREV    2017-08-07 10:59:14.307543082 -0500
+++ hostinfo_tasks.html    2017-08-07 11:01:50.707015825 -0500
@@ -163,23 +163,28 @@
 </table>
 
     </div> <!-- close containerbody -->
   </div> <!-- close container -->
 </div> <!-- close sectiontools -->
 
 <%perl>
 if ( $submit && $ipblock ){
     if ( $ipblock_action eq 'browse_records' ){
     my $ipblock = Ipblock->retrieve($ipblock);
-    if ( my $zone = $ipblock->forward_zone ){
+        my @results;
+        if ( my @results = $ipblock->forward_zone ){
+            my @allrecords;
+            foreach my $zone (@results) {
         my $records = $zone->get_hosts($ipblock->id);
-        $m->comp('/management/hostlist.mhtml', records=>$records, withedit=>1,
+              push @allrecords, @$records;
+            }
+            $m->comp('/management/hostlist.mhtml', records=>\@allrecords, 
withedit=>1,
              return_args=>"?ipblock=$ipblock&ipblock_action='browse_records'");
     }else{
         $m->comp('/generic/error.mhtml', error=>$ipblock->get_label." not 
associated with a zone");
     }
     
     }elsif ( $ipblock_action eq 'show_block' ){
     $m->comp('../management/ip.html', id=>$ipblock, user=>$user);
 
     }elsif ( $ipblock_action eq 'add_host' ){
     $m->comp('add_host.html', add_host_block=>$ipblock);
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://osl.uoregon.edu/redmine/my/account


------------------------------

_______________________________________________
Netdot-devel mailing list
Netdot-devel@osl.uoregon.edu
https://osl.uoregon.edu/mailman/listinfo/netdot-devel


End of Netdot-devel Digest, Vol 123, Issue 2
********************************************

Reply via email to