Index: /pykota/trunk/conf/pykota.conf.sample
===================================================================
--- /pykota/trunk/conf/pykota.conf.sample (revision 1746)
+++ /pykota/trunk/conf/pykota.conf.sample (revision 1757)
@@ -186,5 +186,5 @@
 # Some people reported that WinXP sends mixed case usernames
 # setting 'utolower: Yes' solves the problem.
-# Of course you have to user lowercase only when adding
+# Of course you have to use lowercase only when adding
 # users with edpykota, because ALL database accesses are
 # still case sensitive.
@@ -192,5 +192,5 @@
 # If utolower is Yes, the usernames received from the printing
 # system is converted to lowercase at the start of the cupspykota
-# backend or of the pykota filter.
+# backend or of the lprngpykota filter.
 #
 # If utolower is No, which is the default, strict case checking
@@ -198,4 +198,22 @@
 # different. Printer and groups names are ALWAYS case sensitive.
 utolower: No
+
+# Should we split usernames on a specific separator when printing ?
+# Default is No, i.e. if the value is unset.
+# This is a global option only.
+# This option adds support for Samba's Winbind utility, which
+# prefixes usernames with domain name and separator character.
+# Of course if you set this then you have to use NO separator when 
+# adding users with edpykota.
+#
+# If winbind_separator is set, the usernames received from the printing
+# system are split on the separator's value, and only the last part
+# (real username) is used.
+#
+# If winbind_separator is not set, which is the default, strict 
+# username equality checking will be done (modulo the setting
+# of the 'utolower' directive), this means that users 'DOMAIN1/jerome',
+# 'Domain2/jerome' and 'jerome' are different. 
+# winbind_separator: /
 
 # What is the accounting backend to use
Index: /pykota/trunk/TODO
===================================================================
--- /pykota/trunk/TODO (revision 1755)
+++ /pykota/trunk/TODO (revision 1757)
@@ -28,12 +28,4 @@
         - Maybe put "gracedelay" in the database.
         
-        - Allow admin to specify a prefix to delete from
-          usernames when printing, just like what is done
-          for the "utolower" directive.
-          Better : allow the admin to set the Samba's
-          winbind separator value (or do this automatically)
-          and split the domain from the username automagically
-          (but only if the admin asks so).
-          
         - Price multiplier/divisor which can be set on a per
           user or per user group basis.
Index: /pykota/trunk/pykota/tool.py
===================================================================
--- /pykota/trunk/pykota/tool.py (revision 1756)
+++ /pykota/trunk/pykota/tool.py (revision 1757)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.123  2004/09/29 20:20:52  jalet
+# Added the winbind_separator directive to pykota.conf to allow the admin to
+# strip out the Samba/Winbind domain name when users print.
+#
 # Revision 1.122  2004/09/28 21:38:56  jalet
 # Now computes the job's datas MD5 checksum to later forbid duplicate print jobs.
@@ -959,6 +963,14 @@
         
         self.username = self.username or 'root' # when printing test page from CUPS web interface, username is empty
+        
+        # do we want to strip out the Samba/Winbind domain name ?
+        separator = self.config.getWinbindSeparator()
+        if separator is not None :
+            self.username = self.username.split(separator)[-1]
+            
+        # do we want to lowercase usernames ?    
         if self.config.getUserNameToLower() :
             self.username = self.username.lower()
+            
         self.preserveinputfile = self.inputfile 
         try :
Index: /pykota/trunk/pykota/config.py
===================================================================
--- /pykota/trunk/pykota/config.py (revision 1687)
+++ /pykota/trunk/pykota/config.py (revision 1757)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.52  2004/09/29 20:20:52  jalet
+# Added the winbind_separator directive to pykota.conf to allow the admin to
+# strip out the Samba/Winbind domain name when users print.
+#
 # Revision 1.51  2004/08/31 23:29:53  jalet
 # Introduction of the new 'onaccountererror' configuration directive.
@@ -530,2 +534,6 @@
         """Returns 1 if we want to convert usernames to lowercase when printing, else 0."""
         return self.isTrue(self.getGlobalOption("utolower", ignore=1))
+        
+    def getWinbindSeparator(self) :          
+        """Returns the winbind separator's value if it is set, else None."""
+        return self.getGlobalOption("winbind_separator", ignore=1)
Index: /pykota/trunk/pykota/version.py
===================================================================
--- /pykota/trunk/pykota/version.py (revision 1751)
+++ /pykota/trunk/pykota/version.py (revision 1757)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.20alpha17_unofficial"
+__version__ = "1.20alpha18_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 1755)
+++ /pykota/trunk/NEWS (revision 1757)
@@ -22,4 +22,10 @@
 PyKota NEWS :
 
+    - 1.20alpha18 :
+    
+        - Added the new "winbind_separator" directive to strip
+          out the Samba/Winbind domain name while printing if
+          needed (Off by default).
+          
     - 1.20alpha17 :
     
