Results 1 to 5 of 5

Thread: [SOLVED] User Provisioning in Zimbra via SOAP using Perl

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    7
    Rep Power
    6

    Default [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:

    my $zimbraAdmin = "admin";
    my $zimbraPasswd = "z1mbra";
    my $mh = "zimbra.test.domain.org";
    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:

    get_zimbra_id($mailAcct) # Returns Zimbra ID as a scalar variable

    get_account($mailAcct) # Prints all account information
    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):

    create_account($newAcct,$newPasswd,$newgivenName,$ newsn,$newdispName,$newempNum)
    To modify an existing account, call the following subroutine with the account name, the attribute to be modified and the new attribute value:

    modify_account($mailAcct,$modZimAttr,$modZimVal)
    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.

    disable_account($disAcct) # Account locked, still visible in GAL

    close_account($disAcct) # Account closed, no longer visible in GAL
    If the user reappears in our personnel database, we simply call the following subroutine and the existing account is restored to an active state:

    enable_account($disAcct) # Reenable a locked or closed account
    Hopefully, these subroutines will help someone trying to accomplish a similar task...
    Attached Files Attached Files
    Last edited by mikewhitton; 09-22-2010 at 05:31 AM.

  2. #2
    Join Date
    Jun 2009
    Posts
    31
    Rep Power
    6

    Default

    Thank you for posting this! It has some good examples that will help me convert my perl script from exec'ing zmmailbox to using SOAP calls. Thanks!

  3. #3
    Join Date
    Sep 2009
    Posts
    7
    Rep Power
    6

    Default

    Prior to sorting out this soap stuff I was exec'ing zmprov commands, it works but can be quite sluggish if many changes need to be made...

  4. #4
    Join Date
    Sep 2009
    Posts
    7
    Rep Power
    6

    Default

    One interesting thing to point out is that when you modify the 'userPassword' field via SOAP it does not require that the password be sent in quotes as is required when using 'zmprov'.

  5. #5
    Join Date
    Dec 2006
    Posts
    184
    Rep Power
    8

    Default

    Quick question - are you supposed to get back a response when creating an account for example? Or is there a way to actually get a response?

    TIA

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 09:06 AM
  2. Recover the mail after the crash HDD
    By MrSnaKe in forum Administrators
    Replies: 3
    Last Post: 12-02-2009, 03:38 AM
  3. [SOLVED] Zimbra logwatch.
    By nishith in forum Administrators
    Replies: 5
    Last Post: 06-10-2009, 04:42 PM
  4. Upgrade to ZCS 5.10
    By blozancic in forum Installation
    Replies: 0
    Last Post: 10-21-2008, 08:03 AM
  5. Services stopped working
    By lilwong in forum Administrators
    Replies: 4
    Last Post: 08-15-2006, 09:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •