diff MoinMoin/user.py @ 238:b80624429934

added cfg.user_autocreate, for now for auth.http and auth.ssl_clientcert imported from: moin--main--1.5--patch-241
author Thomas Waldmann <tw@waldmann-edv.de>
date Fri, 25 Nov 2005 20:55:24 +0000
parents 31c1fbb101a3
children 42f749b0d8bb
line wrap: on
line diff
--- a/MoinMoin/user.py	Thu Nov 24 19:21:37 2005 +0000
+++ b/MoinMoin/user.py	Fri Nov 25 20:55:24 2005 +0000
@@ -130,7 +130,8 @@
     @return: user name that can be used in acl lines
     """
     name = name.replace('_', ' ') # we treat _ as a blank
-    username_allowedchars = "'" # ' for names like O'Brian. "," and ":" must not be allowed (ACL delimiters).
+    username_allowedchars = "'@." # ' for names like O'Brian or email addresses.
+                                  # "," and ":" must not be allowed (ACL delimiters).
     # Strip non alpha numeric characters (except username_allowedchars), keep white space
     name = ''.join([c for c in name if c.isalnum() or c.isspace() or c in username_allowedchars])
 
@@ -283,7 +284,16 @@
         # use it reliably in edit locking
         from random import randint
         return "%s.%d" % (str(time.time()), randint(0,65535))
-            
+
+    def create_or_update(self, changed=False):
+        """ Create or update a user profile
+
+        @param changed: bool, set this to True if you updated the user profile values
+        """
+        if self._cfg.user_autocreate:
+            if not self.valid and not self.disabled or changed: # do we need to save/update?
+                self.save() # yes, create/update user profile
+                                
     def __filename(self):
         """ Get filename of the user's file on disk