Obsolete
/
dnsmanagerv1
Archived
3
0
Fork 0

Suppression d'enregistrements d'une zone.

master
Julien Simonet 2014-01-25 23:35:26 +01:00
parent 95d7368642
commit d9b1a15e72
3 changed files with 82 additions and 3 deletions

View File

@ -353,6 +353,80 @@ prefix '/domain' => sub {
};
get '/del/:domain/:name/:type/:host/:ttl' => sub {
unless( session( 'user' ) and defined param('domain') ) {
session errmsg => q<Domaine non renseigné.>;
redirect get_route;
}
else {
# Load :domain and search for corresponding data
my $app = initco();
my ($auth_ok, $user, $isadmin) = $app->auth(param('login'),
param('password') );
my $zone = $app->get_domain(session('login') , param('domain'));
my $dump = $zone->dump;
my $record;
my $found = false;
given( lc param('type') )
{
when ('a')
{
$record = $zone->a;
$found = true;
}
when ('aaaa')
{
$record = $zone->aaaa;
$found = true;
}
when ('cname')
{
$record = $zone->cname;
$found = true;
}
when ('ns')
{
$record = $zone->ns;
$found = true;
}
when ('mx')
{
$record = $zone->mx;
$found = true;
}
when ('ptr')
{
$record = $zone->ptr;
$found = true;
}
}
if( $found )
{
foreach my $i ( 0 .. scalar @{$record}-1 )
{
if( $record->[$i]->{'name'} eq param('name') &&
$record->[$i]->{'host'} eq param('host') &&
$record->[$i]->{'ttl'} == param('ttl') )
{
delete $record->[$i];
}
}
}
$app->update_domain( session('login'), $zone, param('domain') );
}
redirect '/domain/details/'. param('domain');
}
};
any ['get', 'post'] => '/admin' => sub {

View File

@ -31,6 +31,7 @@
<td>NS</td>
<td><% address.host %></td>
<td><% address.ttl %></td>
<td><button type="button" class="btn btn-primary btn-danger btn-xs" onclick="location.href='http://'+location.host+'/domain/del/<% domain %>/<% address.name %>/NS/<% address.host %>/<% address.ttl %>';">✘</button></td>
</tr>
<% END %>
@ -41,6 +42,7 @@
<td>A</td>
<td><% address.host %></td>
<td><% address.ttl %></td>
<td><button type="button" class="btn btn-primary btn-danger btn-xs" onclick="location.href='http://'+location.host+'/domain/del/<% domain %>/<% address.name %>/A/<% address.host %>/<% address.ttl %>';">✘</button></td>
</tr>
<% END %>
@ -51,6 +53,7 @@
<td>AAAA</td>
<td><% address.host %></td>
<td><% address.ttl %></td>
<td><button type="button" class="btn btn-primary btn-danger btn-xs" onclick="location.href='http://'+location.host+'/domain/del/<% domain %>/<% address.name %>/AAAA/<% address.host %>/<% address.ttl %>';">✘</button></td>
</tr>
<% END %>
@ -61,6 +64,7 @@
<td>CNAME</td>
<td><% address.host %></td>
<td><% address.ttl %></td>
<td><button type="button" class="btn btn-primary btn-danger btn-xs" onclick="location.href='http://'+location.host+'/domain/del/<% domain %>/<% address.name %>/CNAME/<% address.host %>/<% address.ttl %>';">✘</button></td>
</tr>
<% END %>
@ -71,6 +75,7 @@
<td>PTR</td>
<td><% address.host %></td>
<td><% address.ttl %></td>
<td><button type="button" class="btn btn-primary btn-danger btn-xs" onclick="location.href='http://'+location.host+'/domain/del/<% domain %>/<% address.name %>/PTR/<% address.host %>/<% address.ttl %>';">✘</button></td>
</tr>
<% END %>
@ -81,9 +86,9 @@
<td>MX</td>
<td><% address.host %> (<% address.priority %>)</td>
<td><% address.ttl %></td>
<td><button type="button" class="btn btn-primary btn-danger btn-xs" onclick="location.href='http://'+location.host+'/domain/del/<% domain %>/<% address.name %>/MX/<% address.host %>/<% address.ttl %>';">✘</button></td>
</tr>
<% END %>
</table>
<a href='/domain/details/<% domain %>?expert=1'><button type="button" class="btn btn-primary">Visualisation en mode expert</button></a>

View File

@ -37,9 +37,9 @@
<form class="form" role="form" action="/user/login" method="post" accept-charset="utf-8">
<div class="form-group">
<fieldset>
<legend>Se connecter:</legend>
<legend>Se connecter :</legend>
<label for="login">Votre identifiant : </label>
<input type="text" name="login" class="form-control" id="login" placeholder="Votre futur identifiant de connexion" />
<input type="text" name="login" class="form-control" id="login" placeholder="Votre identifiant" />
<label for="password">Votre mot de passe : </label>
<input type="password" name="password" class="form-control" id="password" placeholder="Mot de passe" />