|
|
|
@ -4,9 +4,9 @@ use esmith::AccountsDB; |
|
|
|
|
use esmith::ConfigDB; |
|
|
|
|
use POSIX qw(strftime); |
|
|
|
|
|
|
|
|
|
my $date = strftime "%d/%m/%Y %H:%M", localtime; |
|
|
|
|
my $a = esmith::AccountsDB->open_ro() || die "Couldn't open the accounts database"; |
|
|
|
|
my $c = esmith::ConfigDB->open_ro() || die "Couldn't open the configuration database"; |
|
|
|
|
my $date = strftime "%d/%m/%Y %H:%M", localtime; |
|
|
|
|
|
|
|
|
|
sub uniq { |
|
|
|
|
my %seen; |
|
|
|
@ -14,7 +14,7 @@ sub uniq { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print "====== Audit des permissions ======\n\n"; |
|
|
|
|
print "\n====== Audit des permissions ======\n\n"; |
|
|
|
|
|
|
|
|
|
print "===== État des permissions au $date =====\n\n"; |
|
|
|
|
|
|
|
|
@ -24,7 +24,7 @@ print "==== Autorisations d'accès des dossiers partagés ====\n\n"; |
|
|
|
|
|
|
|
|
|
print "^ Dossiers partagés ^ Accès en écriture ^ Accès en lecture seule ^" . "\n"; |
|
|
|
|
|
|
|
|
|
# Pour chaques Share Folder : |
|
|
|
|
# Pour chaques Share Folder : |
|
|
|
|
foreach my $share ($a->get_all_by_prop(type => 'share')) { |
|
|
|
|
my $name = $share->key; |
|
|
|
|
my $desc = $share->prop('Name'); |
|
|
|
@ -143,7 +143,44 @@ foreach my $users (@users) { |
|
|
|
|
print $users->prop('FirstName') . " " . $users->prop('LastName'); |
|
|
|
|
print " | "; |
|
|
|
|
# Affichage des accès RW : |
|
|
|
|
print " RW "; |
|
|
|
|
|
|
|
|
|
# Pour chaques Share Folder : |
|
|
|
|
foreach my $share ($a->get_all_by_prop(type => 'share')) { |
|
|
|
|
my $name = $share->key; |
|
|
|
|
my $desc = $share->prop('Name'); |
|
|
|
|
my $wu = $share->prop('WriteUsers'); |
|
|
|
|
my $wg = $share->prop('WriteGroups'); |
|
|
|
|
my @list_sf_rw; |
|
|
|
|
|
|
|
|
|
# Pour chaque groupe ayant un accès RW : |
|
|
|
|
foreach my $wgroup (split(/,/, $wg)) { |
|
|
|
|
my $rec_wg = $a->get($wgroup); |
|
|
|
|
my $wg_members = $rec_wg->prop('Members'); |
|
|
|
|
my @acces_members_rw = split(/,/, $wg_members); |
|
|
|
|
foreach my $user_rw (@acces_members_rw) { |
|
|
|
|
# Si l'utilisateur du groupe ayant un accès RW a ce Share Folder correspond à l'utilisateur : |
|
|
|
|
if ($user_rw eq $users->key) { |
|
|
|
|
# Injection du nom du Share Folder dans la liste : |
|
|
|
|
push @list_sf_rw, $name . " (" . $desc . ")"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Pour chaque utilisateur ayant un accès RW : |
|
|
|
|
foreach (split(/,/, $wu)) { |
|
|
|
|
my @acces_members_rw = split(/,/, $wu); |
|
|
|
|
foreach my $user_rw (@acces_members_rw) { |
|
|
|
|
# Si l'utilisateur ayant un accès RW a ce Share Folder correspond à l'utilisateur : |
|
|
|
|
if ($user_rw eq $users->key) { |
|
|
|
|
# Injection du nom du Share Folder dans la liste : |
|
|
|
|
push @list_sf_rw, $name . " (" . $desc . ")"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
my @list_sf_rw = uniq(@list_sf_rw); |
|
|
|
|
foreach (@list_sf_rw) { print "$_, "; } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
print " | "; |
|
|
|
|
# Affichage des accès RO : |
|
|
|
|
print " RO "; |
|
|
|
|