#!/usr/bin/perl -w
use strict;
use esmith::AccountsDB;
use esmith::ConfigDB;
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 $main_dom = $c->get('DomainName')->value;
my @fws_accounts = qw(
fws
maillog
backup
mails-partages
scanner
deploiement
auth
);
print '^ Identifiant ^ Nom ^ Prénom ^ Adresse email principale ^' . "\n";
foreach ($a->users){
my $name = $_->key;
if (grep { $name eq $_ } @fws_accounts){
$name = '' . $_->key . '';
} elsif (($_->prop('PasswordSet') || 'no') ne 'yes'){
$name = '' . $_->key . '';
}
print '|' . $name . ' |' . $_->prop('LastName') . ' |' . $_->prop('FirstName') . ' |' . ($_->prop('PreferredMail') || $_->key . '@' . $main_dom) . ' |' . $_->prop('Phone') . ' |' . $_->prop('Function1') . "|\n";
}