Ticket #1113: delete.session_attributes.and.permissions.patch

File delete.session_attributes.and.permissions.patch, 0.8 kB (added by s0undt3ch, 6 months ago)

Patch for trac 0.11 revision 7087 and plugin revision [3706]

  • acct_mgr/api.py

    old new  
    104104        return self.password_store.check_password(user, password) 
    105105 
    106106    def delete_user(self, user): 
     107        db = self.env.get_db_cnx() 
     108        cursor = db.cursor() 
     109        # Delete session attributes 
     110        cursor.execute("DELETE FROM session_attribute where sid=%s", (user,)) 
     111        # Delete session 
     112        cursor.execute("DELETE FROM session where sid=%s", (user,)) 
     113        # Delete any custom permissions set for the user 
     114        cursor.execute("DELETE FROM permission where username=%s", (user,)) 
     115        # Delete from password store 
    107116        if self.password_store.delete_user(user): 
    108117            self._notify('deleted', user) 
    109118