Evolution auto user setup

Panu Matilainen pmatilai at welho.com
Fri Apr 15 05:48:54 UTC 2005


On Fri, 15 Apr 2005, Panu Matilainen wrote:

> On Tue, 12 Apr 2005, David Malcolm wrote:
>
>> On Mon, 2005-04-11 at 14:27 -0700, Sean Bruno wrote:
>>> Was curious if anyone has seen/used any kind of auto-setup scripts for
>>> large amounts of users.  I have a couple of hundred pine/mutt users that
>>> I intend to move over to evolution sooner rather than later.
>>> 
>>> I would like to create their email accounts automatically, and not have
>>> to setup each one seperately as they login.
>>> 
>>> Sean
>> 
>> I've written some Python scripts to make it easier to work with
>> Evolution's configuration information, in the hope of automating mass
>> deployments of Evolution.
> [...]
>> I've tested this, and had it working for an Evolution 2.0 deployment.  I
>> suspect the approach will break under some circumstances, and with
>> different versions of Evolution.  Comments and patches welcome.
>
> Hey, this and Mark's LDAP gconf backend are a really nice start. What's 
> currently missing for my environment is PERSONALIZE_SERVERNAME as there are 
> god-knows-how-many different servers around the company.

Oh well.. this adds optional PERSONALIZE_SERVERNAME and 
PERSONALIZE_MAILBOXNAME settings to it - the mailbox name isn't 
necessarily same as username. Oh and the mailbox name can contain dots in 
it so the mailboxRegex also tweaked.
Didn't test this in action but based on visual inspection of the results 
it seems to do what it's supposed to.

Further todo: currently only the Mail Account entry is fixed, other places 
potentially needing fixing of username and server name are Tasks-, 
Addressbook- and Calendar Source.

 	- Panu -

--- evolution-gconf-tools-0.1.0/lib/personalizevisitor.py.server 
2005-04-15 08:11:16.719442154 +0300
+++ evolution-gconf-tools-0.1.0/lib/personalizevisitor.py       2005-04-15 
08:41:29.216205051 +0300
@@ -22,9 +22,11 @@

  """Personalize from a prototype account"""
  class PersonalizeVisitor(EvolutionAccountGConfVisitor):
-    def __init__(self, username, friendly_name):
+    def __init__(self, username, friendly_name, mailbox_name, 
server_name):
          self.username = username;
          self.friendly_name = friendly_name;
+        self.mailbox_name = mailbox_name
+        self.server_name = server_name

      def personalizeHumanReadableName(self, nameText):
          # The general case isn't doable, but look for things of the form 
SOMEONE at SOMETHING and remap to our username; hopefully this should work 
for many cases:
@@ -85,8 +87,18 @@
          pat = re.compile(patternText);
          mo = pat.search(urlText);

+        if self.server_name:
+            server = self.server_name
+        else:
+            server = mo.group(2)
+
+        if self.mailbox_name:
+            mailbox = self.mailbox_name
+        else:
+            mailbox = self.username
+
          # Personalise the URI and the mailbox:
-        newUrlText = 
"exchange://"+self.username+"@"+mo.group(2)+"/;pf_server="+mo.group(3)+";owa_path="+mo.group(4)+";mailbox="+self.username+";"+mo.group(6)
+        newUrlText = 
"exchange://"+self.username+"@"+server+"/;pf_server="+server+";owa_path="+mo.group(4)+";mailbox="+mailbox+";"+mo.group(6)

          #print urlText
          #print newUrlText
@@ -195,6 +207,8 @@
      # grab configuration information from environment
      username = os.getenv("PERSONALIZE_USERNAME")
      friendlyName = os.getenv("PERSONALIZE_FULLNAME")
+    mailboxName = os.getenv("PERSONALIZE_MAILBOXNAME")
+    serverName = os.getenv("PERSONALIZE_SERVERNAME")

      if username==None:
          print >> sys.stderr, "You must set the PERSONALIZE_USERNAME 
environment variable"
@@ -205,7 +219,7 @@
          sys.exit(-1)

      # process:
-    gconfEntries.accept(PersonalizeVisitor(username, friendlyName))
+    gconfEntries.accept(PersonalizeVisitor(username, friendlyName, 
mailboxName, serverName))

      # output the result:
      print gconfEntries.dom.toxml()
--- evolution-gconf-tools-0.1.0/lib/common.py.server    2005-04-15 
08:37:19.951153360 +0300
+++ evolution-gconf-tools-0.1.0/lib/common.py   2005-04-15 
08:27:03.437583797 +0300
@@ -42,5 +42,5 @@

  schemeRegex = "([a-z]*)";
  usernameRegex = "([A-Za-z0-9\\\\%]*)";
-mailboxRegex = "([A-Za-z0-9]*)";
+mailboxRegex = "([A-Za-z0-9.]*)";
  hostnameRegex = "([A-Za-z0-9\\.]*)";




More information about the Fedora-desktop-list mailing list