Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'develop'

  • Loading branch information...
commit ecb6149a254650090ec9e202dd4f3c1e57211a94 2 parents b625ff9 + 18f46a3
@barryo barryo authored
View
32 application/controllers/CustAdminController.php
@@ -3,21 +3,21 @@
/*
* Copyright (C) 2009-2011 Internet Neutral Exchange Association Limited.
* All Rights Reserved.
- *
+ *
* This file is part of IXP Manager.
- *
+ *
* IXP Manager is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version v2.0 of the License.
- *
+ *
* IXP Manager is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
- *
+ *
* You should have received a copy of the GNU General Public License v2.0
* along with IXP Manager. If not, see:
- *
+ *
* http://www.gnu.org/licenses/gpl-2.0.html
*/
@@ -119,7 +119,8 @@ public function addUserAction()
}
$form = new INEX_Form_User( null, $isEdit,
- Zend_Controller_Front::getInstance()->getBaseUrl() . "/cust-admin"
+ Zend_Controller_Front::getInstance()->getBaseUrl() . "/cust-admin",
+ true
);
if( $this->_request->getParam( 'commit', null ) != 1 )
@@ -131,8 +132,6 @@ public function addUserAction()
$form->getElement( 'disabled' )->setChecked( true );
}
- $form->getElement( 'username' )->setAttrib( 'readonly', '1' );
-
$form->setAction( Zend_Controller_Front::getInstance()->getBaseUrl() . "/cust-admin/edit-user/id/" . $u->id );
$form->getElement( 'submit' )->setLabel( 'Save Changes' );
}
@@ -141,23 +140,10 @@ public function addUserAction()
$isEdit = false;
$form = new INEX_Form_User( null, $isEdit,
- Zend_Controller_Front::getInstance()->getBaseUrl() . "/cust-admin"
+ Zend_Controller_Front::getInstance()->getBaseUrl() . "/cust-admin",
+ true
);
$form->setAction( Zend_Controller_Front::getInstance()->getBaseUrl() . "/cust-admin/add-user" );
-
- // let's capture the user's name and add them to the contact table also
- $name = $form->createElement( 'text', 'name' );
- $name->addValidator( 'stringLength', false, array( 2, 64 ) )
- ->setRequired( true )
- ->setAttrib( 'size', 50 )
- ->setLabel( 'Name' )
- ->addFilter( 'StringTrim' )
- ->addFilter( new INEX_Filter_StripSlashes() );
-
- $elements = $form->getElements();
- $form->clearElements();
- $form->addElement( $name );
- $form->addElements( $elements );
}
$form->removeElement( 'privs' );
View
7 application/controllers/DashboardController.php
@@ -452,7 +452,10 @@ public function p2pAction()
->where( 's.infrastructure = ?', $infra )
->andWhere( 'vint.ipv' . $proto . 'enabled = 1' )
->andWhere( 'c.shortname != ?', $shortname )
- ->andWhere( 'c.type != ?', Cust::TYPE_INTERNAL )
+ ->andWhereIn( 'c.type', array( Cust::TYPE_FULL, Cust::TYPE_PROBONO ) )
+ ->andWhere( 'c.status = ?', array( Cust::STATUS_NORMAL ) )
+ ->andWhere( 'c.dateleave = 0 or c.dateleave IS NULL' )
+ ->andWhere( 'pi.status = ?', Physicalinterface::STATUS_CONNECTED )
->orderBy( 'c.name ASC' );
if( $dvid )
@@ -566,7 +569,7 @@ public function switchGraphsAction()
{
// get the available graphs
$_switches = Doctrine_Query::create()
- ->select( 'sw.name' )
+ ->select( 'sw.id, c.id, l.id, sw.name' )
->addSelect( 'sw.model' )
->addSelect( 'l.name AS location' )
->from( 'Switchtable sw' )
View
2  application/controllers/MrtgController.php
@@ -185,7 +185,7 @@ function retrieveImageAction()
function retrieveP2pImageAction()
{
- //header( 'Content-Type: image/png' );
+ header( 'Content-Type: image/png' );
header( 'Expires: Thu, 01 Jan 1970 00:00:00 GMT' );
$period = $this->getRequest()->getParam( 'period', INEX_Mrtg::$PERIODS['Day'] );
View
8 application/views/cust-admin/add-edit.tpl
@@ -24,13 +24,15 @@
</p>
<p>
- Your new user's password will be sent by SMS to the mobile
- number provided and they will receive a welcome email to the email address provided.
+ Your new user's account will be locked until they set their password via the forgotten password
+ procedure (available on the login page and instructions included in the welcome email which
+ will be sent on completion of the below form).
</p>
{/if}
-
+<br />
+<br />
{$form}
View
48 application/views/cust-admin/list.tpl
@@ -10,12 +10,12 @@
<div id="ajaxMessage"></div>
<div class="alert alert-block alert-info">
- <h4 class="alert-heading">Remember! The customer admin account is only intended for creating users for your organisation.</h4>
+ <h4 class="alert-heading">Remember! The admin account is only intended for creating users for your organisation.</h4>
For full IXP Manager functionality, graphs and member information, log in under one of your user accounts.
</div>
-<table id="ixpDataTable" class="table table-striped table-bordered" cellspacing="0" cellpadding="0" border="0" style="display: none;">
+<table id="ixpDataTable" class="table table-striped table-bordered" cellspacing="0" cellpadding="0" border="0">
<thead>
<tr>
@@ -40,15 +40,15 @@
<td align="center">
<a href="{genUrl controller="cust-admin" action="toggle-enabled" id=$u->id}">
{if $u->disabled}
- <img src="{genUrl}/images/icon_no.png" width="16" height="16" alt="[DISABLED]" title="Disabled - click to enable" />
+ <i class="icon-remove"></i>
{else}
- <img src="{genUrl}/images/icon_yes.png" width="16" height="16" alt="[ENABLED]" title="Enabled - click to disable" />
+ <i class="icon-ok"></i>
{/if}
</a>
</td>
<td>
- <a href="{genUrl controller="cust-admin" action="edit-user" id=$u->id}">
- <img src="{genUrl}/images/joomla-admin/menu/edit.png" width="16" height="16" alt="[EDIT]" title="Click to edit" />
+ <a class="btn btn-mini" href="{genUrl controller="cust-admin" action="edit-user" id=$u->id}">
+ <i class="icon-pencil"></i>
</a>
</td>
</tr>
@@ -60,45 +60,29 @@
</table>
<p>
+ <br />
<a class="btn btn-primary" href="{genUrl controller='cust-admin' action='add-user'}">
Add New User
</a>
</p>
-<div id="instructions" title="IXP Manager - Instructions" style="display: hide;">
- <p>
- Welcome to INEX's IXP Manager!
- </p>
- <p>
- This account is a customer admin account and it can only be
- used to create sub users. Those sub users can then access the
- full functionality of this system.
- </p>
-</div>
<script>
-$(document).ready(function() {ldelim}
-
- oTable = $('#ixpDataTable').dataTable({ldelim}
-
- "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
- "sPaginationType": "bootstrap",
- "aaSorting": [[ 0, 'asc' ]],
- "iDisplayLength": 25,
- {rdelim}).show();
-
- $( '#instructions' ).dialog({ldelim}
- "autoOpen": false,
- "model": true
- {rdelim});
+$(document).ready(function() {
{if not $skipInstructions}
- $( '#instructions' ).dialog( 'open' );
+ bootbox.alert(
+ "<p><strong>Welcome to IXP Manager!</strong></p>"
+
+ + "<p>This account is an admin account and it can only be "
+ + "used to create user accounts for use within your organisation. "
+ + "Those users can then access the full functionality of this system."
+ );
{/if}
-{rdelim});
+});
</script>
View
5 application/views/dashboard/index-tab-overview-news.tpl
@@ -24,11 +24,6 @@
You can now manage your mailing list subscriptions via
your <a href="{genUrl controller="profile"}">profile page</a>.
</li>
- <li>
- There are issues with the peering matrices (which also affect your
- <a href="{genUrl controller="dashboard" action="my-peering-manager"}">Peering Manager</a>).
- We are aware of this and are working on a fix.
- </li>
<li> Redesigned <a href="{genUrl controller="dashboard" action="statistics"}">statistics pages</a> making them clearer and more intuitive. </li>
<li>
Added weather maps for peering <a href="{genUrl controller="dashboard" action="weathermap" id=1}">LAN 1</a>
View
2  application/views/peering-manager/index-rejected.tpl
@@ -1,7 +1,7 @@
<p>
-Any peers appearing below are here because you (or one of your colleuges) selected to have
+Any peers appearing below are here because you (or one of your colleagues) selected to have
them <em>ignored</em> in the drop down actions.
</p>
View
128 library/INEX/Form/User.php
@@ -39,7 +39,7 @@ class INEX_Form_User extends INEX_Form
*
*
*/
- public function __construct( $options = null, $isEdit = false, $cancelLocation )
+ public function __construct( $options = null, $isEdit = false, $cancelLocation, $isCustAdmin = false )
{
parent::__construct( $options, $isEdit );
@@ -47,6 +47,19 @@ public function __construct( $options = null, $isEdit = false, $cancelLocation )
// Create and configure elements
////////////////////////////////////////////////
+ if( $isCustAdmin && !$isEdit )
+ {
+ // let's capture the user's name and add them to the contact table also
+ $name = $this->createElement( 'text', 'name' );
+ $name->addValidator( 'stringLength', false, array( 2, 64 ) )
+ ->setRequired( true )
+ ->setAttrib( 'size', 50 )
+ ->setLabel( 'Name' )
+ ->addFilter( 'StringTrim' )
+ ->addFilter( new INEX_Filter_StripSlashes() );
+ $this->addElement( $name );
+ }
+
$username = $this->createElement( 'text', 'username' );
$username->addValidator( 'stringLength', false, array( 2, 30 ) )
->setRequired( true )
@@ -58,29 +71,34 @@ public function __construct( $options = null, $isEdit = false, $cancelLocation )
->addValidator( 'stringLength', false, array( 6, 30 ) )
->addValidator( 'regex', true, array( '/^[a-zA-Z0-9\-_\.]+$/' ) );
+ if( $isCustAdmin && $isEdit )
+ $username->setAttrib( 'readonly', '1' );
+
$this->addElement( $username );
- $password = $this->createElement( 'text', 'password' );
- $password->addValidator( 'stringLength', false, array( 8, 30 ) )
- ->addValidator( 'regex', true, array( '/^[a-zA-Z0-9\!\£\$\%\^\&\*\(\)\-\=\_\+\{\}\[\]\;\'\#\:\@\~\,\.\/\<\>\?\|]+$/' ) )
- ->setRequired( true )
- ->setLabel( 'Password' )
- ->addFilter( 'StringTrim' )
- ->addFilter( new INEX_Filter_StripSlashes() )
- ->setErrorMessages( array( 'The password must between 8 and 30 characters and cannot contain a double quote - " - character.' ) );
-
- $this->addElement( $password );
-
-
- $privileges = $this->createElement( 'select', 'privs' );
- $privileges->setMultiOptions( User::$PRIVILEGES )
- ->setRegisterInArrayValidator( true )
- ->setLabel( 'Privileges' )
- ->setAttrib( 'class', 'chzn-select' )
- ->setErrorMessages( array( 'Please select the users privilege level' ) );
-
- $this->addElement( $privileges );
-
+ if( !$isCustAdmin )
+ {
+ $password = $this->createElement( 'text', 'password' );
+ $password->addValidator( 'stringLength', false, array( 8, 30 ) )
+ ->addValidator( 'regex', true, array( '/^[a-zA-Z0-9\!\£\$\%\^\&\*\(\)\-\=\_\+\{\}\[\]\;\'\#\:\@\~\,\.\/\<\>\?\|]+$/' ) )
+ ->setRequired( true )
+ ->setLabel( 'Password' )
+ ->addFilter( 'StringTrim' )
+ ->addFilter( new INEX_Filter_StripSlashes() )
+ ->setErrorMessages( array( 'The password must between 8 and 30 characters and cannot contain a double quote - " - character.' ) );
+
+ $this->addElement( $password );
+
+
+ $privileges = $this->createElement( 'select', 'privs' );
+ $privileges->setMultiOptions( User::$PRIVILEGES )
+ ->setRegisterInArrayValidator( true )
+ ->setLabel( 'Privileges' )
+ ->setAttrib( 'class', 'chzn-select' )
+ ->setErrorMessages( array( 'Please select the users privilege level' ) );
+
+ $this->addElement( $privileges );
+ }
$email = $this->createElement( 'text', 'email' );
$email->addValidator( 'stringLength', false, array( 1, 255 ) )
@@ -96,65 +114,67 @@ public function __construct( $options = null, $isEdit = false, $cancelLocation )
$mobile = $this->createElement( 'text', 'authorisedMobile' );
$mobile->addValidator( 'stringLength', false, array( 0, 30 ) )
- ->addValidator( 'regex', true, array( '/^[1-9]+[0-9]*$/' ) )
->setRequired( false )
->setLabel( 'Mobile' )
- ->setAttrib( 'placeholder', '353861234567' )
+ ->setAttrib( 'placeholder', '+353 86 123 4567' )
->addFilter( 'StringTrim' )
->addFilter( new INEX_Filter_StripSlashes() );
$this->addElement( $mobile );
-
- $dbCusts = Doctrine_Query::create()
- ->from( 'Cust c' )
- ->orderBy( 'c.name ASC' )
- ->execute();
-
- $custs = array( '0' => '' );
- $maxId = 0;
-
- foreach( $dbCusts as $c )
+ if( !$isCustAdmin )
{
- $custs[ $c['id'] ] = "{$c['name']}";
- if( $c['id'] > $maxId ) $maxId = $c['id'];
+ $dbCusts = Doctrine_Query::create()
+ ->from( 'Cust c' )
+ ->orderBy( 'c.name ASC' )
+ ->execute();
+
+ $custs = array( '0' => '' );
+ $maxId = 0;
+
+ foreach( $dbCusts as $c )
+ {
+ $custs[ $c['id'] ] = "{$c['name']}";
+ if( $c['id'] > $maxId ) $maxId = $c['id'];
+ }
+
+ $cust = $this->createElement( 'select', 'custid' );
+ $cust->setMultiOptions( $custs );
+ $cust->setRegisterInArrayValidator( true )
+ ->setRequired( true )
+ ->setLabel( 'Customer' )
+ ->setAttrib( 'class', 'chzn-select' )
+ ->addValidator( 'between', false, array( 1, $maxId ) )
+ ->setErrorMessages( array( 'Please select a customer' ) );
+
+ $this->addElement( $cust );
}
- $cust = $this->createElement( 'select', 'custid' );
- $cust->setMultiOptions( $custs );
- $cust->setRegisterInArrayValidator( true )
- ->setRequired( true )
- ->setLabel( 'Customer' )
- ->setAttrib( 'class', 'chzn-select' )
- ->addValidator( 'between', false, array( 1, $maxId ) )
- ->setErrorMessages( array( 'Please select a customer' ) );
-
- $this->addElement( $cust );
-
-
-
-
$disabled = $this->createElement( 'checkbox', 'disabled' );
$disabled->setLabel( 'Disabled?' )
->setCheckedValue( '1' );
$this->addElement( $disabled );
+
+
$commit = $this->createElement( 'hidden', 'commit' );
$commit->setValue( '1' );
$this->addElement( $commit );
+
+
+ $submit = $this->createElement( 'submit', 'submit' );
+ $submit->setLabel( $isEdit ? 'Save' : 'Add' );
+ $this->addElement( $submit );
+
$cancel = $this->createElement( 'button', 'cancel' );
$cancel->setLabel( 'Cancel' )
->setAttrib( 'onClick', "parent.location='{$cancelLocation}'" );
$this->addElement( $cancel );
- $submit = $this->createElement( 'submit', 'submit' );
- $submit->setLabel( $isEdit ? 'Save' : 'Add' );
- $this->addElement( $submit );
}
}
-?>
View
2  tools/perl-lib/IXPManager/lib/IXPManager/Utils.pm
@@ -49,8 +49,6 @@ sub switchporttosnmpidentifier {
} elsif ($vendorid == VENDORID_BROCADE) {
$shortport =~ s/10gigabitethernet/ethernet/gi;
$shortport =~ s/gigabitethernet/ethernet/gi;
- } else {
- die "ARGH: unexpected vendorid: $vendorid\n";
}
return $shortport;
View
36 tools/runtime/mrtg/update-mrtg-config-from-db.pl
@@ -37,6 +37,7 @@
# --ixpname <name> Pretty name for the IXP
# --ixpmaxbits <num> the maximum amount of traffic that the IXP is
# expected to pass (bits/sec)
+# --debug Output piles of debugging information
use strict;
use warnings;
@@ -56,14 +57,16 @@
my $dirowner = "mrtg";
my $ixpfullname = "INEX";
my $ixpmaxbits = 200*1000*1000*1000; # 200 Gbit/sec
+my $debug = 0;
GetOptions(
'configdir=s' => \$mrtgconfigdir,
- 'templatename=s' => \$mrtgconfigtemplate,
'datadir=s' => \$mrtgdatadir,
- 'owner=s' => \$dirowner,
- 'ixpname=s' => \$ixpfullname,
+ 'debug' => \$debug,
'ixpmaxbits=i' => \$ixpmaxbits,
+ 'ixpname=s' => \$ixpfullname,
+ 'owner=s' => \$dirowner,
+ 'templatename=s' => \$mrtgconfigtemplate,
);
my $mrtgconfigfile = "$mrtgconfigdir/mrtg.cfg";
@@ -110,26 +113,20 @@
# Get a list of all the switch IDs on each infrastructure and insert into cache
$query = 'SELECT
id,
+ name,
infrastructure
FROM switch
WHERE
active > 0
- AND infrastructure IN (
- SELECT DISTINCT
- infrastructure
- FROM
- switch
- WHERE
- infrastructure IS NOT NULL
- AND
- infrastructure != 0
- )
+ AND infrastructure IS NOT NULL
+ AND switchtype = ?
';
$sth = $dbh->prepare($query) || die "$dbh->errstr\n";
-$sth->execute() || die "$dbh->errstr\n";
+$sth->execute(SWITCHTYPE_SWITCH) || die "$dbh->errstr\n";
while (my $rec = $sth->fetchrow_hashref) {
+ $debug && print STDERR ("INFO: calculating infrastructure for id: $rec->{id}, infrastructure: $rec->{infrastructure}, name: $rec->{name}\n");
push (@{$lans->{$rec->{infrastructure}}->{switchids}}, $rec->{id});
}
@@ -159,6 +156,7 @@
foreach my $switchid (@{$lans->{$infra}->{switchids}}) {
$sth->execute(SWITCHPORT_TYPE_PEERING, $switchid) || die "$dbh->errstr\n";
while (my $rec = $sth->fetchrow_hashref) {
+ $debug && print STDERR ("INFO: adding switchport: $rec->{switchname}, port: $rec->{switchport}\n");
$lans->{$infra}->{$rec->{switchid}}->{name} = $rec->{switchname};
$lans->{$infra}->{$rec->{switchid}}->{snmppasswd} = $rec->{snmppasswd};
$lans->{$infra}->{$rec->{switchid}}->{vendorid} = $rec->{vendorid};
@@ -175,6 +173,7 @@
foreach my $switchid (@{$lans->{$infra}->{switchids}}) {
foreach my $switchport (@{$lans->{$infra}->{$switchid}->{ports}}) {
my $spidentifier = IXPManager::Utils::switchporttosnmpidentifier($switchport, $lans->{$infra}->{$switchid}->{vendorid});
+ $debug && print STDERR ("INFO: per-infra aggregate pushed $spidentifier (\"$switchport\") to infra $infra\n");
my $mrtgobj = $traffictypes->{$traffictype}->{in}.'#'.$spidentifier.
'&'.
$traffictypes->{$traffictype}->{out}.'#'.$spidentifier.
@@ -184,6 +183,7 @@
$lans->{$infra}->{$switchid}->{name}.
':::::2';
+ $debug && print STDERR ("INFO: per-infra aggregate pushed $spidentifier (\"$switchport\") to infra $infra\n");
push (@{$target->{'ixp_peering-network'.$infra.'-'.$traffictype}}, $mrtgobj);
}
}
@@ -329,6 +329,7 @@
push (@{$gl}, $rec);
$grouplist->{$shortname} = $gl;
+ $debug && print STDERR ("INFO: added per-customer entries: $membername, $switch:$switchport, $speed Mbps\n");
# print out mrtg single configuration entry
print OUTPUT <<EOF;
# $membername - $tag - bits in/out
@@ -428,9 +429,12 @@
EOF
- mkdir ("$mrtgdatadir/$mrtgsubdir/$shortname", 0755);
+ -d "$mrtgdatadir/$mrtgsubdir/$shortname"
+ or mkdir ("$mrtgdatadir/$mrtgsubdir/$shortname", 0755)
+ or die "ERROR: mkdir(\"$mrtgdatadir/$mrtgsubdir/$shortname\") failed\n";
+
chown $uid, $gid, "$mrtgdatadir/$mrtgsubdir/$shortname";
}
close (OUTPUT);
-move ($tmpmrtgconfigfile, $mrtgconfigfile);
+move ($tmpmrtgconfigfile, $mrtgconfigfile) or die "ERROR: move(\"$tmpmrtgconfigfile\", \"$mrtgconfigfile\") failed\n";
Please sign in to comment.
Something went wrong with that request. Please try again.