Show
Ignore:
Timestamp:
04/15/03 23:58:33 (21 years ago)
Author:
jalet
Message:

edpykota now accepts a --delete option.
Preparation to allow edpykota to accept much more command line options
(WARNING : docstring is OK, but code isn't !)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/sql.py

    r917 r921  
    2121# 
    2222# $Log$ 
     23# Revision 1.25  2003/04/15 21:58:33  jalet 
     24# edpykota now accepts a --delete option. 
     25# Preparation to allow edpykota to accept much more command line options 
     26# (WARNING : docstring is OK, but code isn't !) 
     27# 
    2328# Revision 1.24  2003/04/15 13:55:28  jalet 
    2429# Options --limitby and --balance added to edpykota 
     
    288293            return 
    289294         
     295    def deleteUser(self, userid) :     
     296        """Completely deletes an user from the Quota Storage.""" 
     297        queries = [] 
     298        queries.append("DELETE FROM groupsmembers WHERE userid=%s" % self.doQuote(userid)) 
     299        queries.append("DELETE FROM jobhistory WHERE userid=%s" % self.doQuote(userid)) 
     300        queries.append("DELETE FROM userpquota WHERE userid=%s" % self.doQuote(userid)) 
     301        queries.append("DELETE FROM users WHERE id=%s" % self.doQuote(userid)) 
     302        # TODO : What should we do if we delete the last person who used a given printer ? 
     303        self.doQuery(queries) 
     304         
     305    def deleteGroup(self, groupid) :     
     306        """Completely deletes an user from the Quota Storage.""" 
     307        queries = [] 
     308        queries.append("DELETE FROM groupsmembers WHERE groupid=%s" % self.doQuote(groupid)) 
     309        queries.append("DELETE FROM grouppquota WHERE groupid=%s" % self.doQuote(groupid)) 
     310        queries.append("DELETE FROM groups WHERE id=%s" % self.doQuote(groupid)) 
     311        self.doQuery(queries) 
     312         
    290313    def computePrinterJobPrice(self, printerid, jobsize) :     
    291314        """Returns the price for a job on a given printer."""