parent
41a8da4341
commit
b894102a28
1 changed files with 67 additions and 1 deletions
@ -1 +1,67 @@ |
|||||||
init |
#!/usr/bin/perl -w |
||||||
|
use strict; |
||||||
|
use esmith::AccountsDB; |
||||||
|
|
||||||
|
my $a = esmith::AccountsDB->open_ro() || die "Couldn't open the accounts database"; |
||||||
|
|
||||||
|
sub uniq { |
||||||
|
my %seen; |
||||||
|
grep !$seen{$_}++, @_; |
||||||
|
} |
||||||
|
|
||||||
|
print "\n\n\n" . '================================' . "\n\n\n"; |
||||||
|
print "\n" . '^ Dossier partagés ^ Accès en ecriture ^ Accès en lecture seule ^' . "\n"; |
||||||
|
|
||||||
|
foreach my $share ($a->get_all_by_prop(type => 'share')) { |
||||||
|
print "\n\n" . '---------' . "\n\n"; |
||||||
|
my $name = $share->key; |
||||||
|
my $wu = $share->prop('WriteUsers'); |
||||||
|
my $wg = $share->prop('WriteGroups'); |
||||||
|
my $ru = $share->prop('ReadUsers'); |
||||||
|
my $rg = $share->prop('ReadGroups'); |
||||||
|
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 . "," . $wu); |
||||||
|
my @acces_members_rw_filtered = uniq(@acces_members_rw); |
||||||
|
my @list_rw; |
||||||
|
foreach my $user_rw (@acces_members_rw_filtered) { |
||||||
|
my $urw = $a->get($user_rw); |
||||||
|
my $lock_rw = $urw->prop('PasswordSet'); |
||||||
|
if ($lock_rw eq 'no') { |
||||||
|
push @list_rw, "<color #c3c3c3>" . $user_rw . "</color>"; |
||||||
|
} |
||||||
|
else { |
||||||
|
push @list_rw, $user_rw; |
||||||
|
} |
||||||
|
} |
||||||
|
print "\nShare Folder : " . $name . "\n"; |
||||||
|
print "\nListe RW :\n"; |
||||||
|
print @list_rw; |
||||||
|
} |
||||||
|
|
||||||
|
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 . "," . $ru); |
||||||
|
my @acces_members_ro_filtered = uniq(@acces_members_ro); |
||||||
|
my @list_ro; |
||||||
|
foreach my $user_ro (@acces_members_ro_filtered) { |
||||||
|
my $uro = $a->get($user_ro); |
||||||
|
my $lock_ro = $uro->prop('PasswordSet'); |
||||||
|
if ($lock_ro eq 'no') { |
||||||
|
push @list_ro, "<color #c3c3c3>" . $user_ro . "</color>"; |
||||||
|
} |
||||||
|
else { |
||||||
|
push @list_ro, $user_ro; |
||||||
|
} |
||||||
|
} |
||||||
|
print "\nShare Folder : " . $name . "\n"; |
||||||
|
print "\nListe RO :\n"; |
||||||
|
print @list_ro; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
# print "^ " . $name . " | Accès en ecriture | Accès en lecture seule |" . "\n\n"; |
||||||
|
|
||||||
|
print "\n\n\n" . '================================' . "\n\n\n"; |
||||||
|
Loading…
Reference in new issue