can pass device instance to check_*

This commit is contained in:
Oliver Gorwits
2017-09-29 07:38:05 +01:00
parent 4256b117df
commit 2a74e0befa
2 changed files with 4 additions and 4 deletions

View File

@@ -35,8 +35,8 @@ register 'register_worker' => sub {
# reduce device_auth by driver, worker's only/no # reduce device_auth by driver, worker's only/no
foreach my $stanza (@userconf) { foreach my $stanza (@userconf) {
if (ref $job->device) { if (ref $job->device) {
next if $no and check_acl_no($job->device->ip, $no); next if $no and check_acl_no($job->device, $no);
next if $only and not check_acl_only($job->device->ip, $only); next if $only and not check_acl_only($job->device, $only);
} }
next if exists $stanza->{driver} and exists $workerconf->{driver} next if exists $stanza->{driver} and exists $workerconf->{driver}
and (($stanza->{driver} || '') ne ($workerconf->{driver} || '')); and (($stanza->{driver} || '') ne ($workerconf->{driver} || ''));

View File

@@ -45,8 +45,8 @@ sub run {
my $no = (exists $stanza->{no} ? $stanza->{no} : undef); my $no = (exists $stanza->{no} ? $stanza->{no} : undef);
my $only = (exists $stanza->{only} ? $stanza->{only} : undef); my $only = (exists $stanza->{only} ? $stanza->{only} : undef);
next if $no and check_acl_no($job->device->ip, $no); next if $no and check_acl_no($job->device, $no);
next if $only and not check_acl_only($job->device->ip, $only); next if $only and not check_acl_only($job->device, $only);
push @newuserconf, $stanza; push @newuserconf, $stanza;
} }