Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-22-2010, 04:41 AM
Junior Member
 
Posts: 7
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:

Quote:
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:

Quote:
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):

Quote:
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:

Quote:
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.

Quote:
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:

Quote:
enable_account($disAcct) # Reenable a locked or closed account
Hopefully, these subroutines will help someone trying to accomplish a similar task...
Attached Files
File Type: txt blog-soap.pl.txt (6.7 KB, 99 views)

Last edited by mikewhitton; 09-22-2010 at 05:31 AM..
Reply With Quote
  #2 (permalink)  
Old 10-05-2010, 12:46 PM
Active Member
 
Posts: 28
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!
Reply With Quote
  #3 (permalink)  
Old 10-06-2010, 03:33 AM
Junior Member
 
Posts: 7
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...
Reply With Quote
  #4 (permalink)  
Old 11-03-2010, 05:45 AM
Junior Member
 
Posts: 7
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'.
Reply With Quote
  #5 (permalink)  
Old 03-26-2012, 02:52 PM
Special Member
 
Posts: 149
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.