parent
5b5c40db7d
commit
c578d1e15b
1 changed files with 52 additions and 0 deletions
@ -0,0 +1,52 @@ |
|||||||
|
{ |
||||||
|
$OUT = ''; |
||||||
|
my (undef, undef, $uid, $gid, undef, undef, undef, $dir, undef) |
||||||
|
= getpwnam("alias"); |
||||||
|
unless (defined $uid && defined $gid && defined $dir) |
||||||
|
{ |
||||||
|
my $msg = |
||||||
|
"Failed to obtain user details for \'alias\' " |
||||||
|
. "while processing pseudonym assignments."; |
||||||
|
|
||||||
|
warn "$msg\n"; |
||||||
|
$OUT = $msg; |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
my $alias_assign = "alias:${uid}:${gid}:${dir}"; |
||||||
|
|
||||||
|
undef $uid; |
||||||
|
undef $gid; |
||||||
|
undef $dir; |
||||||
|
|
||||||
|
use esmith::AccountsDB; |
||||||
|
my $adb = esmith::AccountsDB->open_ro(); |
||||||
|
|
||||||
|
foreach $pseudonym ( $adb->pseudonyms ) |
||||||
|
{ |
||||||
|
next if ( $pseudonym->key =~ /@/ ); # user@domain goes in virtualdomains |
||||||
|
|
||||||
|
my $account = $pseudonym->prop('Account'); |
||||||
|
unless ($account) |
||||||
|
{ |
||||||
|
my $key = $pseudonym->key; |
||||||
|
warn "pseudonym $key has no account property"; |
||||||
|
next; |
||||||
|
} |
||||||
|
$account = $adb->get($pseudonym->prop('Account')); |
||||||
|
unless ($account) |
||||||
|
{ |
||||||
|
my $key = $pseudonym->key; |
||||||
|
warn "pseudonym $key points to account which does not exist"; |
||||||
|
next; |
||||||
|
} |
||||||
|
if ($account->prop('type') eq "minilist") |
||||||
|
{ |
||||||
|
$OUT .= "=" . $pseudonym->key . ":${alias_assign}:-:" . $account->key . ":\n"; |
||||||
|
$OUT .= "+" . $pseudonym->key . "-:${alias_assign}:-:" . $account->key . ":\n"; |
||||||
|
next; |
||||||
|
} |
||||||
|
} |
||||||
|
chomp($OUT); |
||||||
|
$OUT = "=alias:${alias_assign}:::" unless $OUT; |
||||||
|
} |
Loading…
Reference in new issue