#929 implement first half of multi tenancy with tenant_databases setting
This commit is contained in:
@@ -79,7 +79,7 @@ ajax "/ajax/control/admin/snapshot_req" => require_role admin => sub {
|
||||
if ! $device or $device->addr eq '0.0.0.0';
|
||||
|
||||
add_job('loadmibs')
|
||||
if not schema('netdisco')->resultset('SNMPObject')->count();
|
||||
if not schema(vars->{'tenant'})->resultset('SNMPObject')->count();
|
||||
|
||||
# will store for download and for browsing
|
||||
add_job('snapshot', $device->addr, 'yes') or send_error('Bad device', 400);
|
||||
@@ -90,7 +90,7 @@ get "/ajax/content/admin/snapshot_get" => require_role admin => sub {
|
||||
send_error('Bad device', 400)
|
||||
if ! $device or $device->addr eq '0.0.0.0';
|
||||
|
||||
my $content = schema('netdisco')->resultset('DeviceSnapshot')->find($device->addr)->cache;
|
||||
my $content = schema(vars->{'tenant'})->resultset('DeviceSnapshot')->find($device->addr)->cache;
|
||||
send_file( \$content, content_type => 'text/plain', filename => ($device->addr .'-snapshot.txt') );
|
||||
};
|
||||
|
||||
@@ -99,8 +99,8 @@ ajax "/ajax/control/admin/snapshot_del" => require_role setting('defanged_admin'
|
||||
send_error('Bad device', 400)
|
||||
if ! $device or $device->addr eq '0.0.0.0';
|
||||
|
||||
schema('netdisco')->resultset('DeviceSnapshot')->find($device->addr)->delete;
|
||||
schema('netdisco')->resultset('DeviceBrowser')->search({ip => $device->addr})->delete;
|
||||
schema(vars->{'tenant'})->resultset('DeviceSnapshot')->find($device->addr)->delete;
|
||||
schema(vars->{'tenant'})->resultset('DeviceBrowser')->search({ip => $device->addr})->delete;
|
||||
};
|
||||
|
||||
get '/admin/*' => require_role admin => sub {
|
||||
|
||||
Reference in New Issue
Block a user