[BlueOnyx:02603] Re: Quick List
Michael Stauber
mstauber at blueonyx.it
Mon Oct 12 22:46:24 -05 2009
Hi Darrell,
> What is the quickest way to generate a list of the email addresses of a
> BQ/BO box's admin users? I would ultimately like to make a cron job that
> will automatically fetch each account's admin email address and store it in
> a file.
This script - although it has some drawbacks - might help.
------------------------------------------------------------------------------
#!/usr/bin/perl -I/usr/sausalito/perl -I/usr/sausalito/handlers/base/vsite
# Copyright 2008-2009 Team BlueOnyx. All rights reserved.
use CCE;
my $cce = new CCE;
$cce->connectuds();
# Find all Vsites:
my @vhosts = ();
my (@vhosts) = $cce->findx('Vsite');
# Walk through all Vsites:
for my $vsite (@vhosts) {
($ok, my $my_vsite) = $cce->get($vsite);
# Start with an empty and predefined array:
my @users = ();
# Get all users of this Vsite:
@users = $cce->findx('User', { 'site' => $my_vsite->{name} });
# Walk through all users of that Vsite:
for my $user (@users) {
# Get the username:
($ok, my $myuser) = $cce->get($user);
# Print out only siteAdmin's email addys:
if ($myuser->{capLevels} =~ /&(adminUser|siteAdmin)&/) {
print $myuser->{name} . '@' . $my_vsite->{fqdn} . "\n";
}
}
}
$cce->bye('SUCCESS');
exit(0);
------------------------------------------------------------------------------
It generates a list of all siteAdmins in the format ...
username at fqdn
So if the site is named www.blueonyx.it and the username of the siteAdmin is
mstauber, then the printed out email address would be this:
mstauber at www.blueonyx.it
--
With best regards
Michael Stauber
More information about the Blueonyx
mailing list