Switch SSO Service API layer to use the new Django 1.2 ORM layer

This commit is contained in:
2010-11-04 11:47:19 +00:00
parent b8415f294f
commit eeb3266dad
7 changed files with 33 additions and 49 deletions

View File

@@ -41,7 +41,7 @@ class PhpBBService(BaseDBService):
pwhash = self._gen_hash(password)
self._dbcursor.execute(self.SQL_ADD_USER, [username, pwhash, email])
self._db.connection.commit()
transaction.set_dirty()
self.update_groups(username)
return { 'username': username, 'password': password }
@@ -56,12 +56,12 @@ class PhpBBService(BaseDBService):
row = self._dbcursor.fetchone()
if not row:
self._dbcursor.execute(self.SQL_ADD_GROUP, [group.name])
self._db.connection.commit()
transaction.set_dirty()
self._dbcursor.execute(self.SQL_GET_GROUP, [group.name])
row = self._dbcursor.fetchone()
self._dbcursor.execute(self.SQL_ADD_USER_GROUP, [row['group_id'], user_id])
self._db.connection.commit()
transaction.set_dirty()
def check_user(self, username):
""" Check if the username exists """
@@ -83,16 +83,15 @@ class PhpBBService(BaseDBService):
except IntegrityError:
# Record already exists, skip it
pass
self._db.connection.commit()
transaction.set_dirty()
return True
def enable_user(self, uid, password):
""" Enable a user """
pwhash = self._gen_mw_hash(password)
self._dbcursor.execute(self.SQL_ENABLE_USER, [pwhash, uid])
self._db.connection.commit()
self._dbcursor.execute(self.SQL_ENABLE_GROUP, [uid])
self._db.connection.commit()
transaction.set_dirty()
return True
def reset_password(self, uid, password):