Changeset 1969 for pykota/trunk/pykota

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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)