Branch Coverage

blib/lib/Apache/Sling/LDAPSynch.pm
Criterion Covered Total %
branch 25 134 18.6


line true false branch
34 1 1 unless (defined $authn)
35 0 1 defined $disabled ? :
36 1 0 defined $filter ? :
37 0 1 defined $verbose ? :
53 0 1 unless my $content = 'Apache::Sling::Content'->new($authn, $verbose, $log)
55 0 1 unless my $user = 'Apache::Sling::User'->new($authn, $verbose, $log)
85 0 0 unless $$class{'LDAP'} = 'Net::LDAP'->new($$class{'LDAPHost'})
87 0 0 if (defined $$class{'LDAPDN'} and defined $$class{'LDAPPASS'}) { }
88 0 0 unless my $mesg = $$class{'LDAP'}->bind($$class{'LDAPDN'}, 'password', $$class{'LDAPPASS'}, 'version', '3')
95 0 0 unless my $mesg = $$class{'LDAP'}->bind('version', '3')
122 0 0 unless (${$$class{'Content'};}->check_exists($$class{'CachePath'} . '/' . $$class{'CacheFile'}))
128 0 0 unless print {$tmp_cache_file_handle;} 'Data::Dumper'->Dump([\%synch_cache], ['synch_cache'])
131 0 0 unless close $tmp_cache_file_handle
134 0 0 unless ${$$class{'Content'};}->upload_file($tmp_cache_file_name, $$class{'CachePath'}, $$class{'CacheFile'})
138 0 0 unless unlink $tmp_cache_file_name
152 0 0 unless (${$$class{'Content'};}->check_exists($$class{'CachePath'} . '/' . $$class{'CacheFile'}))
157 0 0 unless ${$$class{'Content'};}->view_file($$class{'CachePath'} . '/' . $$class{'CacheFile'})
162 0 0 unless (defined $success)
176 0 0 unless print {$tmp_cache_file_handle;} 'Data::Dumper'->Dump([$synch_cache], ['synch_cache'])
179 0 0 unless close $tmp_cache_file_handle
182 0 0 unless ${$$class{'Content'};}->upload_file($tmp_cache_file_name, $$class{'CachePath'}, $$class{'CacheFile'})
187 0 0 unless ${$$class{'Content'};}->upload_file($tmp_cache_file_name, $$class{'CacheBackupPath'}, "cache$time.txt")
191 0 0 unless unlink $tmp_cache_file_name
203 0 0 unless (${$$class{'Content'};}->check_exists($$class{'CachePath'} . '/' . $$class{'UserList'}))
208 0 0 unless ${$$class{'Content'};}->view_file($$class{'CachePath'} . '/' . $$class{'UserList'})
213 0 0 unless (defined $success)
227 0 0 unless print {$tmp_user_list_file_handle;} 'Data::Dumper'->Dump([$synch_user_list], ['synch_user_list'])
230 0 0 unless close $tmp_user_list_file_handle
233 0 0 unless ${$$class{'Content'};}->upload_file($tmp_user_list_file_name, $$class{'CachePath'}, $$class{'UserList'})
240 0 0 unless ${$$class{'Content'};}->upload_file($tmp_user_list_file_name, $$class{'CacheBackupPath'}, "user_list$time.txt")
244 0 0 unless unlink $tmp_user_list_file_name
258 0 0 if (open my $out, '>>', $user_list_file) { }
260 0 0 unless print {$out;} $user . "\n"
264 0 0 unless close $out
284 0 0 if (open my $input, '<', $user_list_file) { }
289 0 0 unless close $input
307 2 1 if (defined $ldap_attrs_array and defined $sling_attrs_array)
308 2 0 if (defined $ldap_attrs)
311 2 0 if (defined $sling_attrs)
314 1 1 if (@{$ldap_attrs_array;} != @{$sling_attrs_array;})
331 1 0 unless (defined $$cached_properties{$property_key})
336 0 0 if ($$new_properties{$property_key} ne $$cached_properties{$property_key})
364 0 0 if (defined $value)
371 0 0 if (defined $$synch_cache{$user_id}) { }
374 0 0 if ($$synch_cache{$user_id}{$$class{'Disabled'}} eq '1') { }
378 0 0 unless print "Re-enabling previously disabled user: $user_id\n"
380 0 0 unless ${$$class{'User'};}->update($user_id, \@properties_array)
388 0 0 if (check_for_property_modifications(\%properties_hash, \%{$$synch_cache{$user_id};})) { }
396 0 0 unless print "Updating existing user $user_id\n"
398 0 0 unless ${$$class{'User'};}->update($user_id, \@properties_array)
407 0 0 unless print "No user modifications, skipping: $user_id\n"
415 0 0 unless print "Creating new user: $user_id\n"
416 0 0 unless ${$$class{'User'};}->add($user_id, 'password', \@properties_array)
435 0 0 unless parse_attributes($ldap_attrs, $sling_attrs, \@ldap_attrs_array, \@sling_attrs_array)
459 0 0 if ($$synch_cache{$cache_entry}{$$class{'Disabled'}} eq '0' and not defined $seen_user_ids{$cache_entry})
462 0 0 unless print "Disabling user record in sling that no longer exists in ldap: $cache_entry\n"
465 0 0 unless ${$$class{'User'};}->update($cache_entry, \@disable_property)
533 0 1 unless GetOptions $ldap_synch_config, 'auth=s', 'help|?', 'log|L=s', 'man|M', 'pass|p=s', 'threads|t=s', 'url|U=s', 'user|u=s', 'verbose|v+', 'download-user-list', 'ldap-attributes|a=s', 'ldap-base|b=s', 'ldap-dn|d=s', 'ldap-filter|f=s', 'ldap-host|h=s', 'ldap-pass|P=s', 'attributes|A=s', 'synch-full|s', 'synch-full-since|S=s', 'synch-listed|l', 'synch-listed-since', 'upload-user-list'
682 1 1 unless (defined $config)
692 0 1 if ($$sling{'Help'}) { }
0 1 elsif ($$sling{'Man'}) { }
0 1 elsif (defined ${$$config{'download-user-list'};}) { }
0 1 elsif (defined ${$$config{'upload-user-list'};}) { }
0 1 elsif (defined ${$$config{'synch-full'};}) { }
0 1 elsif (defined ${$$config{'synch-full-since'};}) { }
0 1 elsif (defined ${$$config{'synch-listed'};}) { }
0 1 elsif (defined ${$$config{'synch-listed-since'};}) { }