[SOLVED] User Provisioning in Zimbra via SOAP using Perl
For the past several weeks I have been looking on the internet for, but unable to find, some information on how to perform user provisioning tasks in Zimbra via SOAP/Perl.
Attached is a Perl script that contains several subroutines that allow easy manipulation of a Zimbra server using only the perl modules that were supplied with the Zimbra installation. To setup the script, modify these variables to match your Zimbra server:
To retrieve either just the Zimbra ID or a complete listing of all of the attributes associated with a specific user account, call one of the following subroutines:
my $zimbraAdmin = "admin";
my $zimbraPasswd = "z1mbra";
my $mh = "zimbra.test.domain.org";
To create a new account, call the following subroutine with the new account name, a password, the users name, and an employee number (this is the primary key of our personnel database, not necessary for normal Zimbra operation):
get_zimbra_id($mailAcct) # Returns Zimbra ID as a scalar variable
get_account($mailAcct) # Prints all account information
To modify an existing account, call the following subroutine with the account name, the attribute to be modified and the new attribute value:
The policy in our organization is to disable (lock) accounts after a user disappears from our personnel database. A locked account will still receive any email sent to it, however, the user will not be able to log in and retrieve these messages. After a period of 90 days, the account is then closed (mail sent will bounce back to sender) and the admin is notified to archive and remove the account from Zimbra.
If the user reappears in our personnel database, we simply call the following subroutine and the existing account is restored to an active state:
disable_account($disAcct) # Account locked, still visible in GAL
close_account($disAcct) # Account closed, no longer visible in GAL
Hopefully, these subroutines will help someone trying to accomplish a similar task...
enable_account($disAcct) # Reenable a locked or closed account