Archived
1
0

Add grant-mail command for account in lpt

This commit is contained in:
Mercier Pierre-Olivier 2013-09-05 12:34:04 +02:00
parent 495202128e
commit e270f53e35

View File

@ -82,6 +82,7 @@ my %cmds_account =
"grant-intra" => \&cmd_account_grantintra, "grant-intra" => \&cmd_account_grantintra,
"grant-lab" => \&cmd_account_grantlab, "grant-lab" => \&cmd_account_grantlab,
"grant-mail" => \&cmd_account_grantmail,
); );
my %cmds_group = my %cmds_group =
@ -299,6 +300,22 @@ sub cmd_account_grantlab($@)
$ldap->unbind or die ("couldn't disconnect correctly"); $ldap->unbind or die ("couldn't disconnect correctly");
} }
sub cmd_account_grantmail($)
{
my $login = shift;
my $ldap = LDAP::ldap_connect();
my $dn = LDAP::search_dn($ldap, "ou=users", "uid=$login");
LDAP::update_attribute($ldap, $dn, "mailAccountActive", "yes");
LDAP::add_attribute($ldap, $dn, "objectClass", "MailAccount");
log(INFO, "$login now grants to receive e-mail. Remember to add some aliases!");
$ldap->unbind or die ("couldn't disconnect correctly");
}
sub cmd_account_mail(@) sub cmd_account_mail(@)
{ {
return cmd_account_vieworchange('mail', 'mail', @_); return cmd_account_vieworchange('mail', 'mail', @_);