Changeset 1998

Show
Ignore:
Timestamp:
12/31/04 17:10:57 (19 years ago)
Author:
jalet
Message:

Fixed recently introduced bugs due to extended userquotabase and groupquotabase
directives.

Location:
pykota/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/NEWS

    r1995 r1998  
    2222PyKota NEWS : 
    2323 
     24    - 1.21alpha16 : 
     25     
     26        - fixed several recently introduced bugs in LDAP backend code, 
     27          thanks to Matt Hyclak. 
     28           
    2429    - 1.21alpha15 : 
    2530       
  • pykota/trunk/pykota/storages/ldapstorage.py

    r1995 r1998  
    2222# 
    2323# $Log$ 
     24# Revision 1.93  2004/12/31 16:10:57  jalet 
     25# Fixed recently introduced bugs due to extended userquotabase and groupquotabase 
     26# directives. 
     27# 
    2428# Revision 1.92  2004/12/26 14:50:51  jalet 
    2529# Normalized fields names in dumpykota's output so that an LDAP or PostgreSQL 
     
    702706        if printer.Exists and user.Exists : 
    703707            if self.info["userquotabase"].lower() == "user" : 
    704                 result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=user.ident) 
     708                base = user.ident 
    705709            else :     
    706                 result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["userquotabase"]) 
     710                base = self.info["userquotabase"] 
     711            result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=base) 
    707712            if result : 
    708713                fields = result[0][1] 
     
    736741        if group.Exists : 
    737742            if self.info["groupquotabase"].lower() == "group" : 
    738                 result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=group.ident) 
     743                base = group.ident 
    739744            else :     
    740                 result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["groupquotabase"]) 
     745                base = self.info["groupquotabase"] 
     746            result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=base) 
    741747            if result : 
    742748                fields = result[0][1] 
     
    765771                if usernamesfilter : 
    766772                    usernamesfilter = "(|%s)" % usernamesfilter 
    767                 result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)%s)" % (printer.Name, usernamesfilter), ["pykotaPageCounter", "pykotaLifePageCounter"], base=self.info["userquotabase"]) 
     773                if self.info["userquotabase"].lower() == "user" : 
     774                    base = self.info["userbase"] 
     775                else : 
     776                    base = self.info["userquotabase"] 
     777                result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)%s)" % (printer.Name, usernamesfilter), ["pykotaPageCounter", "pykotaLifePageCounter"], base=base) 
    768778                if result : 
    769779                    for userpquota in result :     
     
    885895        """Returns the list of users who uses a given printer, along with their quotas.""" 
    886896        usersandquotas = [] 
    887         result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)(|%s))" % (printer.Name, "".join(["(pykotaUserName=%s)" % uname for uname in names])), ["pykotaUserName", "pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["userquotabase"]) 
     897        if self.info["userquotabase"].lower() == "user" : 
     898           base = self.info["userbase"] 
     899        else : 
     900           base = self.info["userquotabase"] 
     901        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)(|%s))" % (printer.Name, "".join(["(pykotaUserName=%s)" % uname for uname in names])), ["pykotaUserName", "pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=base) 
    888902        if result : 
    889903            for (userquotaid, fields) in result : 
     
    920934        """Returns the list of groups which uses a given printer, along with their quotas.""" 
    921935        groupsandquotas = [] 
    922         result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s)(|%s))" % (printer.Name, "".join(["(pykotaGroupName=%s)" % gname for gname in names])), ["pykotaGroupName"], base=self.info["groupquotabase"]) 
     936        if self.info["groupquotabase"].lower() == "group" : 
     937           base = self.info["groupbase"] 
     938        else : 
     939           base = self.info["groupquotabase"] 
     940        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s)(|%s))" % (printer.Name, "".join(["(pykotaGroupName=%s)" % gname for gname in names])), ["pykotaGroupName"], base=base) 
    923941        if result : 
    924942            for (groupquotaid, fields) in result : 
     
    13281346        for (ident, fields) in result : 
    13291347            todelete.append(ident) 
    1330              
    1331         result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s))" % user.Name, ["pykotaPrinterName", "pykotaUserName"], base=self.info["userquotabase"]) 
     1348        if self.info["userquotabase"].lower() == "user" : 
     1349            base = self.info["userbase"] 
     1350        else : 
     1351            base = self.info["userquotabase"] 
     1352        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s))" % user.Name, ["pykotaPrinterName", "pykotaUserName"], base=base) 
    13321353        for (ident, fields) in result : 
    13331354            # ensure the user print quota entry will be deleted 
     
    13691390    def deleteGroup(self, group) :     
    13701391        """Completely deletes a group from the Quota Storage.""" 
    1371         result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s))" % group.Name, ["pykotaGroupName"], base=self.info["groupquotabase"]) 
     1392        if self.info["groupquotabase"].lower() == "group" : 
     1393            base = self.info["groupbase"] 
     1394        else : 
     1395            base = self.info["groupquotabase"] 
     1396        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s))" % group.Name, ["pykotaGroupName"], base=base) 
    13721397        for (ident, fields) in result : 
    13731398            self.doDelete(ident) 
     
    14001425        for (ident, fields) in result : 
    14011426            self.doDelete(ident) 
    1402         result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s))" % printer.Name, base=self.info["groupquotabase"]) 
     1427        if self.info["groupquotabase"].lower() == "group" : 
     1428            base = self.info["groupbase"] 
     1429        else : 
     1430            base = self.info["groupquotabase"] 
     1431        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s))" % printer.Name, base=base) 
    14031432        for (ident, fields) in result : 
    14041433            self.doDelete(ident) 
    1405         result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s))" % printer.Name, base=self.info["userquotabase"]) 
     1434        if self.info["userquotabase"].lower() == "user" : 
     1435            base = self.info["userbase"] 
     1436        else : 
     1437            base = self.info["userquotabase"] 
     1438        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s))" % printer.Name, base=base) 
    14061439        for (ident, fields) in result : 
    14071440            self.doDelete(ident) 
  • pykota/trunk/pykota/version.py

    r1993 r1998  
    2222# 
    2323 
    24 __version__ = "1.21alpha15_unofficial" 
     24__version__ = "1.21alpha16_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""