You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.1 KiB
67 lines
2.1 KiB
#!/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";
|
|
|