Index: /pykota/trunk/conf/pykota.conf.sample
===================================================================
--- /pykota/trunk/conf/pykota.conf.sample (revision 1968)
+++ /pykota/trunk/conf/pykota.conf.sample (revision 1969)
@@ -104,8 +104,18 @@
 #printerbase: ou=Printers,ou=PyKota,dc=librelogiciel,dc=com
 #printerrdn: cn
-#userquotabase: ou=UQuotas,ou=PyKota,dc=librelogiciel,dc=com
-#groupquotabase: ou=GQuotas,ou=PyKota,dc=librelogiciel,dc=com
 #jobbase: ou=Jobs,ou=PyKota,dc=librelogiciel,dc=com
 #lastjobbase: ou=LastJobs,ou=PyKota,dc=librelogiciel,dc=com
+
+# These two fields are special, they either accept a branch
+# dn, like an ou for example, or the special keywords 'user'
+# and 'group'. If 'user' or 'group' is used, the print quota
+# entries will be created below the user or group entry itself,
+# which will then be used like a branch (you can mix and match
+# different values depending on what you want to do).
+#userquotabase: user
+#userquotabase: ou=UQuotas,ou=PyKota,dc=librelogiciel,dc=com
+#groupquotabase: group
+#groupquotabase: ou=GQuotas,ou=PyKota,dc=librelogiciel,dc=com
+
 #
 # How to create new accounts and groups
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 1968)
+++ /pykota/trunk/NEWS (revision 1969)
@@ -24,6 +24,12 @@
     - 1.21alpha11 :
     
+        - Now user and group print quota entries can be stored directly
+          below the user or group with the LDAP backend, using them
+          as branches. Thanks to Stefan Wold for the patch.
+          See the sample configuration file for details.
+          
         - TLS is now supported with the LDAP backend. Thanks to Stefan
           Wold for the patch.
+          See the sample configuration file for details.
           
         - edpkota now accepts the -U | --used value command line argument
Index: /pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- /pykota/trunk/pykota/storages/ldapstorage.py (revision 1968)
+++ /pykota/trunk/pykota/storages/ldapstorage.py (revision 1969)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.89  2004/12/02 22:27:11  jalet
+# Integrated and extended Stefan Wold's patch to store print quota entries
+# directly below the user or the group object with the LDAP backend
+#
 # Revision 1.88  2004/12/02 22:01:58  jalet
 # TLS is now supported with the LDAP backend
@@ -675,5 +679,8 @@
         userpquota = StorageUserPQuota(self, user, printer)
         if printer.Exists and user.Exists :
-            result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["userquotabase"])
+            if self.info["userquotabase"].lower() == "user" :
+                result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=user.ident)
+            else :    
+                result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["userquotabase"])
             if result :
                 fields = result[0][1]
@@ -706,5 +713,8 @@
         grouppquota = StorageGroupPQuota(self, group, printer)
         if group.Exists :
-            result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["groupquotabase"])
+            if self.info["groupquotabase"].lower() == "group" :
+                result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=group.ident)
+            else :    
+                result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["groupquotabase"])
             if result :
                 fields = result[0][1]
@@ -1028,5 +1038,8 @@
                    "pykotaLifePageCounter" : "0",
                  } 
-        dn = "cn=%s,%s" % (uuid, self.info["userquotabase"])
+        if self.info["userquotabase"].lower() == "user" :
+            dn = "cn=%s,%s" % (uuid, user.ident)
+        else :    
+            dn = "cn=%s,%s" % (uuid, self.info["userquotabase"])
         self.doAdd(dn, fields)
         return self.getUserPQuota(user, printer)
@@ -1041,5 +1054,8 @@
                    "pykotaDateLimit" : "None",
                  } 
-        dn = "cn=%s,%s" % (uuid, self.info["groupquotabase"])
+        if self.info["groupquotabase"].lower() == "group" :
+            dn = "cn=%s,%s" % (uuid, group.ident)
+        else :    
+            dn = "cn=%s,%s" % (uuid, self.info["groupquotabase"])
         self.doAdd(dn, fields)
         return self.getGroupPQuota(group, printer)
