Changeset 1692
- Timestamp:
- 09/02/04 12:09:30 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/NEWS
r1687 r1692 22 22 PyKota NEWS : 23 23 24 - 1.20alpha6 : 25 26 - Fixed a bug in LDAP user deletion code. 27 24 28 - 1.20alpha5 : 25 29 -
pykota/trunk/pykota/reporter.py
r1582 r1692 22 22 # 23 23 # $Log$ 24 # Revision 1.10 2004/09/02 10:09:30 jalet 25 # Fixed bug in LDAP user deletion code which didn't correctly delete the user's 26 # pykotaLastJob entries. 27 # 24 28 # Revision 1.9 2004/07/01 17:45:49 jalet 25 29 # Added code to handle the description field for printers … … 88 92 89 93 def getPrinterRealPageCounter(self, printer) : 90 try : 91 msg = "%9i" % printer.LastJob.PrinterPageCounter 92 except TypeError : 93 msg = _("unknown") 94 msg = _("unknown") 95 if printer.LastJob.Exists : 96 try : 97 msg = "%9i" % printer.LastJob.PrinterPageCounter 98 except TypeError : 99 pass 94 100 return _("Real : %s") % msg 95 101 -
pykota/trunk/pykota/storage.py
r1624 r1692 22 22 # 23 23 # $Log$ 24 # Revision 1.58 2004/09/02 10:09:30 jalet 25 # Fixed bug in LDAP user deletion code which didn't correctly delete the user's 26 # pykotaLastJob entries. 27 # 24 28 # Revision 1.57 2004/07/22 22:41:48 jalet 25 29 # Hardware accounting for LPRng should be OK now. UNTESTED. … … 480 484 481 485 class StorageJob(StorageObject) : 482 """Printer's LastJob class."""486 """Printer's Job class.""" 483 487 def __init__(self, parent) : 484 488 StorageObject.__init__(self, parent) -
pykota/trunk/pykota/storages/ldapstorage.py
r1601 r1692 22 22 # 23 23 # $Log$ 24 # Revision 1.74 2004/09/02 10:09:30 jalet 25 # Fixed bug in LDAP user deletion code which didn't correctly delete the user's 26 # pykotaLastJob entries. 27 # 24 28 # Revision 1.73 2004/07/17 20:37:27 jalet 25 29 # Missing file... Am I really stupid ? … … 633 637 lastjob.lastjobident = result[0][0] 634 638 lastjobident = result[0][1]["pykotaLastJobIdent"][0] 635 result = self.doSearch("objectClass=pykotaJob", ["pykotaJobSizeBytes", "pykotaHostName", "pykotaUserName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "createTimestamp"], base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE) 639 result = None 640 try : 641 result = self.doSearch("objectClass=pykotaJob", ["pykotaJobSizeBytes", "pykotaHostName", "pykotaUserName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "createTimestamp"], base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE) 642 except PyKotaStorageError : 643 pass # Last job entry exists, but job probably doesn't exist anymore. 636 644 if result : 637 645 fields = result[0][1] … … 1145 1153 def deleteUser(self, user) : 1146 1154 """Completely deletes an user from the Quota Storage.""" 1147 # TODO : What should we do if we delete the last person who used a given printer ? 1148 # TODO : we can't reassign the last job to the previous one, because next user would be 1149 # TODO : incorrectly charged (overcharged). 1150 result = self.doSearch("(&(objectClass=pykotaLastJob)(pykotaUserName=%s))" % user.Name, base=self.info["lastjobbase"]) 1151 for (ident, fields) in result : 1152 self.doDelete(ident) 1155 todelete = [] 1153 1156 result = self.doSearch("(&(objectClass=pykotaJob)(pykotaUserName=%s))" % user.Name, base=self.info["jobbase"]) 1154 1157 for (ident, fields) in result : 1158 todelete.append(ident) 1159 1160 result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s))" % user.Name, ["pykotaPrinterName", "pykotaUserName"], base=self.info["userquotabase"]) 1161 for (ident, fields) in result : 1162 # ensure the user print quota entry will be deleted 1163 todelete.append(ident) 1164 1165 # if last job of current printer was printed by the user 1166 # to delete, we also need to delete the printer's last job entry. 1167 printername = fields["pykotaPrinterName"][0] 1168 printer = self.getPrinter(printername) 1169 if printer.LastJob.UserName == user.Name : 1170 todelete.append(printer.LastJob.lastjobident) 1171 1172 for ident in todelete : 1155 1173 self.doDelete(ident) 1156 result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s))" % user.Name, ["pykotaUserName"], base=self.info["userquotabase"]) 1157 for (ident, fields) in result : 1158 self.doDelete(ident) 1174 1159 1175 result = self.doSearch("objectClass=pykotaAccount", None, base=user.ident, scope=ldap.SCOPE_BASE) 1160 1176 if result : -
pykota/trunk/pykota/version.py
r1687 r1692 22 22 # 23 23 24 __version__ = "1.20alpha 5_unofficial"24 __version__ = "1.20alpha6_unofficial" 25 25 26 26 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""