view the SF RO accès for each user

master
Heuzef 7 years ago
parent cc89ce3d9a
commit 5f8838a351
  1. 45
      report_acl.pl

@ -116,9 +116,9 @@ foreach my $share ($a->get_all_by_prop(type => 'share')) {
my @list_ro_uniq = uniq(@list_ro); my @list_ro_uniq = uniq(@list_ro);
print "^ " . $name . " (" . $desc . ") | "; print "^ " . $name . " (" . $desc . ") | ";
foreach (@list_rw_uniq) { print "$_, "; } foreach (@list_rw_uniq) { print "$_" . "\\\\ "; }
print " | "; print " | ";
foreach (@list_ro_uniq) { print "$_, "; } foreach (@list_ro_uniq) { print "$_" . "\\\\ "; }
print " |" . "\n"; print " |" . "\n";
} }
@ -143,7 +143,6 @@ foreach my $users (@users) {
print $users->prop('FirstName') . " " . $users->prop('LastName'); print $users->prop('FirstName') . " " . $users->prop('LastName');
print " | "; print " | ";
# Affichage des accès RW : # Affichage des accès RW :
# Pour chaques Share Folder : # Pour chaques Share Folder :
foreach my $share ($a->get_all_by_prop(type => 'share')) { foreach my $share ($a->get_all_by_prop(type => 'share')) {
my $name = $share->key; my $name = $share->key;
@ -178,12 +177,46 @@ foreach my $users (@users) {
} }
} }
my @list_sf_rw = uniq(@list_sf_rw); my @list_sf_rw = uniq(@list_sf_rw);
foreach (@list_sf_rw) { print "$_\\ "; } foreach (@list_sf_rw) { print "$_" . "\\\\ "; }
} }
print " | "; print " | ";
# Affichage des accès RO : # Affichage des accès RO :
print " RO "; # Pour chaques Share Folder :
foreach my $share ($a->get_all_by_prop(type => 'share')) {
my $name = $share->key;
my $desc = $share->prop('Name');
my $ru = $share->prop('ReadUsers');
my $rg = $share->prop('ReadGroups');
my @list_sf_ro;
# Pour chaque groupe ayant un accès RO :
foreach my $rgroup (split(/,/, $rg)) {
my $rec_rg = $a->get($rgroup);
my $rg_members = $rec_rg->prop('Members');
my @acces_members_ro = split(/,/, $rg_members);
foreach my $user_ro (@acces_members_ro) {
# Si l'utilisateur du groupe ayant un accès RO a ce Share Folder correspond à l'utilisateur :
if ($user_ro eq $users->key) {
# Injection du nom du Share Folder dans la liste :
push @list_sf_ro, $name . " (" . $desc . ")";
}
}
}
# Pour chaque utilisateur ayant un accès RO :
foreach (split(/,/, $ru)) {
my @acces_members_ro = split(/,/, $ru);
foreach my $user_ro (@acces_members_ro) {
# Si l'utilisateur ayant un accès RO a ce Share Folder correspond à l'utilisateur :
if ($user_ro eq $users->key) {
# Injection du nom du Share Folder dans la liste :
push @list_sf_ro, $name . " (" . $desc . ")";
}
}
}
my @list_sf_ro = uniq(@list_sf_ro);
foreach (@list_sf_ro) { print "$_" . "\\\\ "; }
}
print " |\n"; print " |\n";
} }

Loading…
Cancel
Save