|
|
|
@ -147,25 +147,35 @@ while (my $ref = $sth->fetchrow_hashref) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$report .= "-----------------------------------------------------------------------\n"; |
|
|
|
|
|
|
|
|
|
if ($msg ne ''){ |
|
|
|
|
$ko_cnt++; |
|
|
|
|
$report .= "An error occured while processing account for $info->{last_name} $info->{first_name}. " . |
|
|
|
|
"The error is : $msg\n"; |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
# Default expiration is at the end of the current year |
|
|
|
|
if ($info->{end_contract} eq ''){ |
|
|
|
|
$info->{end_contract} = (localtime())[5] + 1900 . '-12-31'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
print "Creating user account $info->{login} ($info->{first_name} $info->{last_name})\n"; |
|
|
|
|
|
|
|
|
|
if (not $dry){ |
|
|
|
|
$a->new_record($info->{login}, { |
|
|
|
|
type => 'user', |
|
|
|
|
FirstName => $info->{first_name}, |
|
|
|
|
LastName => $info->{last_name}, |
|
|
|
|
Phone => $info->{phone}, |
|
|
|
|
Dept => $info->{supervisor_name}, |
|
|
|
|
PasswordSet => 'no', |
|
|
|
|
Company => $info->{unit}, |
|
|
|
|
PreferredMail => $info->{email} |
|
|
|
|
type => 'user', |
|
|
|
|
FirstName => $info->{first_name}, |
|
|
|
|
LastName => $info->{last_name}, |
|
|
|
|
Phone => $info->{phone}, |
|
|
|
|
Dept => $info->{supervisor_name}, |
|
|
|
|
PasswordSet => 'no', |
|
|
|
|
Company => $info->{unit}, |
|
|
|
|
PreferredMail => $info->{email}, |
|
|
|
|
ExpireLockOn => $info->{end_contract}, |
|
|
|
|
ExpireAutoReply => 'enabled', |
|
|
|
|
ExpireWarnUser => 'enabled', |
|
|
|
|
ExpireDeleteAfterLock => 7, |
|
|
|
|
MaxBlocks => 5120000, |
|
|
|
|
MaxBlocksSoftLim => 4608000 |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
unless ( system("/sbin/e-smith/signal-event", "user-create", $info->{login}) == 0 ){ |
|
|
|
@ -185,15 +195,9 @@ while (my $ref = $sth->fetchrow_hashref) { |
|
|
|
|
* Email : $info->{email} |
|
|
|
|
* Unit : $info->{unit} |
|
|
|
|
* Supervisor : $info->{supervisor_name} |
|
|
|
|
* Expiration date : $info->{end_contract} |
|
|
|
|
_EOF |
|
|
|
|
|
|
|
|
|
# Set expiration |
|
|
|
|
if ($info->{end_contract} ne ''){ |
|
|
|
|
$a->set_prop($info->{login}, 'ExpireLockOn', $info->{end_contract}); |
|
|
|
|
$a->set_prop($info->{login}, 'ExpireAutoReply', 'enabled'); |
|
|
|
|
$a->set_prop($info->{login}, 'ExpireDeleteAfterLock', '365'); |
|
|
|
|
$report .= " * Expiration date : $info->{end_contract}\n" |
|
|
|
|
} |
|
|
|
|
$report .= "\n\n\n"; |
|
|
|
|
} |
|
|
|
|
$new_date = $ref->{submitdate}; |
|
|
|
|