release 2.012005

Squashed commit of the following:

commit a031e3f388af144cb6d729e4b16b174a7caf6de9
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 16 17:50:55 2013 +0100

    new version - 2.012005

commit a0215a83fb2cd9f3040cfd04e239a1a40367e056
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 16 17:47:28 2013 +0100

    set last arpnip timestamp

commit 824d311a2503cc91a117d4cc5949b0aca0cabdc9
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 16 17:28:14 2013 +0100

    test release - 2.012003_001

commit d06316eb1ae6a035a2fefd1edd06bfa6ffe38fa8
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 16 17:26:44 2013 +0100

    Improved handling of automatic macsuck/arpnip after initial discover

commit d7c1e7948f22487c0564a884ce94d109a2cdc13c
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 16 13:21:51 2013 +0100

    add rev. proxy timeout to suggested config

commit 040065a50fec4669740ae48ff18352ef7ff3fde1
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 16 13:14:15 2013 +0100

    remove done job from local queue regardless of exit status

commit d0f1d105459c047cc7156d1b4ef897ad27f965bb
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 16 13:12:45 2013 +0100

    fix no_auth to work with new Auth::Extensible plugin
This commit is contained in:
Oliver Gorwits
2013-08-16 17:51:21 +01:00
parent 5b06162d7d
commit 73d2fffc35
12 changed files with 72 additions and 31 deletions

View File

@@ -8,7 +8,7 @@ use Dancer::Plugin::Auth::Extensible;
use Try::Tiny;
sub add_job {
my ($jobtype, $device) = @_;
my ($jobtype, $device, $subaction) = @_;
if ($device) {
$device = NetAddr::IP::Lite->new($device);
@@ -16,32 +16,16 @@ sub add_job {
if ! $device or $device->addr eq '0.0.0.0';
}
# job might already be in the queue, so this could die
try {
# jobs might already be in the queue, so this could die
schema('netdisco')->resultset('Admin')->create({
($device ? (device => $device->addr) : ()),
action => $jobtype,
($subaction ? (subaction => $subaction) : ()),
status => 'queued',
username => session('logged_in_user'),
userip => request->remote_address,
});
if (param('extra') and param('extra') eq 'with-walk') {
schema('netdisco')->resultset('Admin')->create({
action => 'macwalk',
subaction => 'after-discoverall',
status => 'queued',
username => session('logged_in_user'),
userip => request->remote_address,
});
schema('netdisco')->resultset('Admin')->create({
action => 'arpwalk',
subaction => 'after-discoverall',
status => 'queued',
username => session('logged_in_user'),
userip => request->remote_address,
});
}
};
}
@@ -63,14 +47,14 @@ foreach my $jobtype (keys %jobs_all, keys %jobs) {
send_error('Missing device', 400)
if exists $jobs{$jobtype} and not param('device');
add_job($jobtype, param('device'));
add_job($jobtype, param('device'), param('extra'));
};
post "/admin/$jobtype" => require_role admin => sub {
send_error('Missing device', 400)
if exists $jobs{$jobtype} and not param('device');
add_job($jobtype, param('device'));
add_job($jobtype, param('device'), param('extra'));
redirect uri_for('/admin/jobqueue')->as_string;
};
}

View File

@@ -10,12 +10,15 @@ hook 'before' => sub {
if (! session('logged_in_user') && request->path ne uri_for('/login')->path) {
if (setting('trust_x_remote_user') and scalar request->header('X-REMOTE_USER')) {
session(logged_in_user => scalar request->header('X-REMOTE_USER'));
session(logged_in_user_realm => 'users');
}
elsif (setting('trust_remote_user') and $ENV{REMOTE_USER}) {
session(logged_in_user => $ENV{REMOTE_USER});
session(logged_in_user_realm => 'users');
}
elsif (setting('no_auth')) {
session(logged_in_user => 'guest');
session(logged_in_user_realm => 'users');
}
else {
# user has no AuthN - force to handler for '/'