Show
Ignore:
Timestamp:
02/17/06 23:51:17 (18 years ago)
Author:
jerome
Message:

pkusers now mostly works. Removing an user from a group with
LDAP is not yet done though. Also no test was done with
LDAP yet.
filldb now really creates users (it uses pkusers instead
of edpykota)

Files:
1 modified

Legend:

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

    r2698 r2706  
    545545            self.doModify("INSERT INTO groupsmembers (groupid, userid) VALUES (%s, %s)" % (self.doQuote(group.ident), self.doQuote(user.ident))) 
    546546             
     547    def delUserFromGroup(self, user, group) :     
     548        """Removes an user from a group.""" 
     549        self.doModify("DELETE FROM groupsmembers WHERE groupid=%s AND userid=%s" % \ 
     550                       (self.doQuote(group.ident), self.doQuote(user.ident))) 
     551             
    547552    def addUserPQuota(self, user, printer) : 
    548553        """Initializes a user print quota on a printer.""" 
     
    564569                                 self.doQuote(printer.PricePerJob), \ 
    565570                                 self.doQuote(printer.ident))) 
    566          
    567     def writeUserOverCharge(self, user, factor) : 
    568         """Sets the user's overcharging coefficient.""" 
    569         self.doModify("UPDATE users SET overcharge=%s WHERE id=%s" % (self.doQuote(factor), self.doQuote(user.ident))) 
    570          
    571     def writeUserLimitBy(self, user, limitby) :     
    572         """Sets the user's limiting factor.""" 
    573         self.doModify("UPDATE users SET limitby=%s WHERE id=%s" % (self.doQuote(limitby), self.doQuote(user.ident))) 
    574          
    575     def writeGroupLimitBy(self, group, limitby) :     
    576         """Sets the group's limiting factor.""" 
    577         self.doModify("UPDATE groups SET limitby=%s WHERE id=%s" % (self.doQuote(limitby), self.doQuote(group.ident))) 
     571                                  
     572    def saveUser(self, user) :         
     573        """Saves the user to the database in a single operation.""" 
     574        self.doModify("UPDATE users SET limitby=%s, email=%s, overcharge=%s, description=%s WHERE id=%s" \ 
     575                               % (self.doQuote(user.LimitBy or 'quota'), \ 
     576                                  self.doQuote(user.Email), \ 
     577                                  self.doQuote(user.OverCharge), \ 
     578                                  self.doQuote(self.userCharsetToDatabase(user.Description)), \ 
     579                                  self.doQuote(user.ident))) 
     580                                   
     581    def saveGroup(self, group) :         
     582        """Saves the group to the database in a single operation.""" 
     583        self.doModify("UPDATE groups SET limitby=%s, description=%s WHERE id=%s" \ 
     584                               % (self.doQuote(group.LimitBy or 'quota'), \ 
     585                                  self.doQuote(self.userCharsetToDatabase(group.Description)), \ 
     586                                  self.doQuote(group.ident))) 
    578587         
    579588    def writeUserPQuotaDateLimit(self, userpquota, datelimit) :