Changeset 1969

Show
Ignore:
Timestamp:
12/02/04 23:27:11 (19 years ago)
Author:
jalet
Message:

Integrated and extended Stefan Wold's patch to store print quota entries
directly below the user or the group object with the LDAP backend

Location:
pykota/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/conf/pykota.conf.sample

    r1968 r1969  
    104104#printerbase: ou=Printers,ou=PyKota,dc=librelogiciel,dc=com 
    105105#printerrdn: cn 
    106 #userquotabase: ou=UQuotas,ou=PyKota,dc=librelogiciel,dc=com 
    107 #groupquotabase: ou=GQuotas,ou=PyKota,dc=librelogiciel,dc=com 
    108106#jobbase: ou=Jobs,ou=PyKota,dc=librelogiciel,dc=com 
    109107#lastjobbase: ou=LastJobs,ou=PyKota,dc=librelogiciel,dc=com 
     108 
     109# These two fields are special, they either accept a branch 
     110# dn, like an ou for example, or the special keywords 'user' 
     111# and 'group'. If 'user' or 'group' is used, the print quota 
     112# entries will be created below the user or group entry itself, 
     113# which will then be used like a branch (you can mix and match 
     114# different values depending on what you want to do). 
     115#userquotabase: user 
     116#userquotabase: ou=UQuotas,ou=PyKota,dc=librelogiciel,dc=com 
     117#groupquotabase: group 
     118#groupquotabase: ou=GQuotas,ou=PyKota,dc=librelogiciel,dc=com 
     119 
    110120# 
    111121# How to create new accounts and groups 
  • pykota/trunk/NEWS

    r1968 r1969  
    2424    - 1.21alpha11 : 
    2525     
     26        - Now user and group print quota entries can be stored directly 
     27          below the user or group with the LDAP backend, using them 
     28          as branches. Thanks to Stefan Wold for the patch. 
     29          See the sample configuration file for details. 
     30           
    2631        - TLS is now supported with the LDAP backend. Thanks to Stefan 
    2732          Wold for the patch. 
     33          See the sample configuration file for details. 
    2834           
    2935        - edpkota now accepts the -U | --used value command line argument 
  • pykota/trunk/pykota/storages/ldapstorage.py

    r1968 r1969  
    2222# 
    2323# $Log$ 
     24# Revision 1.89  2004/12/02 22:27:11  jalet 
     25# Integrated and extended Stefan Wold's patch to store print quota entries 
     26# directly below the user or the group object with the LDAP backend 
     27# 
    2428# Revision 1.88  2004/12/02 22:01:58  jalet 
    2529# TLS is now supported with the LDAP backend 
     
    675679        userpquota = StorageUserPQuota(self, user, printer) 
    676680        if printer.Exists and user.Exists : 
    677             result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["userquotabase"]) 
     681            if self.info["userquotabase"].lower() == "user" : 
     682                result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=user.ident) 
     683            else :     
     684                result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["userquotabase"]) 
    678685            if result : 
    679686                fields = result[0][1] 
     
    706713        grouppquota = StorageGroupPQuota(self, group, printer) 
    707714        if group.Exists : 
    708             result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["groupquotabase"]) 
     715            if self.info["groupquotabase"].lower() == "group" : 
     716                result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=group.ident) 
     717            else :     
     718                result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["groupquotabase"]) 
    709719            if result : 
    710720                fields = result[0][1] 
     
    10281038                   "pykotaLifePageCounter" : "0", 
    10291039                 }  
    1030         dn = "cn=%s,%s" % (uuid, self.info["userquotabase"]) 
     1040        if self.info["userquotabase"].lower() == "user" : 
     1041            dn = "cn=%s,%s" % (uuid, user.ident) 
     1042        else :     
     1043            dn = "cn=%s,%s" % (uuid, self.info["userquotabase"]) 
    10311044        self.doAdd(dn, fields) 
    10321045        return self.getUserPQuota(user, printer) 
     
    10411054                   "pykotaDateLimit" : "None", 
    10421055                 }  
    1043         dn = "cn=%s,%s" % (uuid, self.info["groupquotabase"]) 
     1056        if self.info["groupquotabase"].lower() == "group" : 
     1057            dn = "cn=%s,%s" % (uuid, group.ident) 
     1058        else :     
     1059            dn = "cn=%s,%s" % (uuid, self.info["groupquotabase"]) 
    10441060        self.doAdd(dn, fields) 
    10451061        return self.getGroupPQuota(group, printer)